diff --git a/outMsg.go b/outMsg.go
index cabd86a..e3c520f 100644
--- a/outMsg.go
+++ b/outMsg.go
@@ -31,14 +31,28 @@ func BuildTextMsg(txt string, ToUserName string) (xml string, err error) {
return
}
-//BuildLocationMsg doesn't work for build location message
-func BuildLocationMsg(long, lat, precision float64, ToUserName string) (xml string) {
- msg := buildLocationMsg()
+//BuildKFTransferAnyOneMsg Transfer to anyone
+func BuildKFTransferAnyOneMsg(toUser string) (xml string, err error) {
+ return BuildKFTransferMsg(toUser, "")
+
+}
+
+//BuildKFTransferMsg Transfer a message to specific kf
+func BuildKFTransferMsg(toUser, kf string) (xml string, err error) {
+ msg := buildKfForwardMsg(toUser, kf)
e := Encode(msg)
xml, _, _, _ = signMsg(e)
return
}
+//BuildLocationMsg doesn't work for build location message
+// func BuildLocationMsg(long, lat, precision float64, ToUserName string) (xml string) {
+// msg := buildLocationMsg()
+// e := Encode(msg)
+// xml, _, _, _ = signMsg(e)
+// return
+// }
+
func signMsg(content string) (xml string, timestamp int32, nonce int32, signature string) {
timestamp = int32(time.Now().Unix())
nonce = rand.Int31()
@@ -253,16 +267,45 @@ func newsMsgTemplate() string {
`
}
-func buildLocationMsg() string {
- template := `
-
-
-1494124221
-
-23.134521
-113.358803
-20
-
- `
- return template
+// func buildLocationMsg() string {
+// template := `
+//
+//
+// 1494124221
+//
+// 23.134521
+// 113.358803
+// 20
+//
+// `
+// return template
+// }
+
+func buildKfForwardMsg(toUser string, kf string) (msg string) {
+ //转发信息到任意客服
+ template := `s
+
+
+%d
+
+ `
+
+ //发送信息指定客服人员
+ templateKF := `
+
+
+%d
+
+
+
+
+`
+
+ if kf == "" {
+ msg = fmt.Sprintf(template, toUser, APIConfig.PublicAccountID, time.Now().Unix())
+ } else {
+ msg = fmt.Sprintf(templateKF, toUser, APIConfig.PublicAccountID, time.Now().Unix(), kf)
+ }
+
+ return
}