/** * @Author: jager * @Email: lhj168os@gmail.com * @File: msg_test * @Date: 2021/12/17 5:56 下午 * @package: msg * @Version: v1.0.0 * * @Description: * */ package msg import ( xml2 "encoding/xml" "fmt" "testing" "time" ) func Test_Post(t *testing.T) { wMsg := &xml{ ToUserName: "rMsg.FromUserName", FromUserName: "rMsg.ToUserName", CreateTime: int(time.Now().Unix()), MsgType: "text", Content: "收到,谢谢!", } bty, _ := xml2.Marshal(wMsg) fmt.Println(string(bty)) }