28 lines
692 B
Go
28 lines
692 B
Go
package enterprise_msg
|
|
|
|
import (
|
|
enterprise "git.rosy.net.cn/baseapi/platformapi/enterprise_wechat"
|
|
"git.rosy.net.cn/jx-callback/globals/api"
|
|
)
|
|
|
|
func SendUserMessage(phone, title, description, url string) error {
|
|
// 根据电话号码获取用户touserId
|
|
enterpriseUserId, err := api.EnterpriseChatMin.GetUserIdByMobile(phone)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
msg := &enterprise.EnterpriseSendMsgReq{
|
|
Touser: enterpriseUserId,
|
|
Msgtype: enterprise.MsgTypeTextCard,
|
|
Agentid: 1000005,
|
|
Textcard: enterprise.TextCardObject{
|
|
Title: title,
|
|
Description: description,
|
|
Url: url,
|
|
Btntxt: "详情",
|
|
},
|
|
}
|
|
return api.EnterpriseChatMin.SendMsgToUser(msg)
|
|
}
|