|
@@ -25,22 +25,14 @@ const (
|
|
//msgnotify_tplid = "b7iuAMiTCIolnPhTdueKBVYThEMf2D-Bh2M_9v3J-68" //消息提醒
|
|
//msgnotify_tplid = "b7iuAMiTCIolnPhTdueKBVYThEMf2D-Bh2M_9v3J-68" //消息提醒
|
|
)
|
|
)
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
var identify_tplid, offLineMsg_tplid, msgnotify_tplid, managernotiry_tplid string
|
|
var identify_tplid, offLineMsg_tplid, msgnotify_tplid, managernotiry_tplid string
|
|
-=======
|
|
|
|
-var identify_tplid, offLineMsg_tplid, msgnotify_tplid, managerNotify_tplid string
|
|
|
|
->>>>>>> 4923307c616d9c1f95b881ad75878f4d07df5134
|
|
|
|
|
|
|
|
//读取配置
|
|
//读取配置
|
|
func InitTpl() {
|
|
func InitTpl() {
|
|
identify_tplid = wf.SysConfig.MessageTpl["identifytplid"]
|
|
identify_tplid = wf.SysConfig.MessageTpl["identifytplid"]
|
|
offLineMsg_tplid = wf.SysConfig.MessageTpl["offLinemsgtplid"]
|
|
offLineMsg_tplid = wf.SysConfig.MessageTpl["offLinemsgtplid"]
|
|
msgnotify_tplid = wf.SysConfig.MessageTpl["msgnotifytplid"]
|
|
msgnotify_tplid = wf.SysConfig.MessageTpl["msgnotifytplid"]
|
|
-<<<<<<< HEAD
|
|
|
|
managernotiry_tplid = wf.SysConfig.MessageTpl["managernotirytplid"]
|
|
managernotiry_tplid = wf.SysConfig.MessageTpl["managernotirytplid"]
|
|
-=======
|
|
|
|
- managerNotify_tplid = wf.SysConfig.MessageTpl["managernotifytplid"]
|
|
|
|
->>>>>>> 4923307c616d9c1f95b881ad75878f4d07df5134
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func (wxrpc *WeiXinRpc) SendPushTplMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) (err error) {
|
|
func (wxrpc *WeiXinRpc) SendPushTplMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) (err error) {
|
|
@@ -126,8 +118,8 @@ func (wxrpc *WeiXinRpc) SendIdentifyTplMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcR
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//发送管理员通知
|
|
func (wxrpc *WeiXinRpc) SendManagerNotifyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) (err error) {
|
|
func (wxrpc *WeiXinRpc) SendManagerNotifyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) (err error) {
|
|
- log.Println("tpl::", identify_tplid)
|
|
|
|
//构造自定义消息文本
|
|
//构造自定义消息文本
|
|
var msg struct {
|
|
var msg struct {
|
|
ToUser string `json:"touser"`
|
|
ToUser string `json:"touser"`
|
|
@@ -150,7 +142,7 @@ func (wxrpc *WeiXinRpc) SendManagerNotifyMsg(param *qrpc.NotifyMsg, ret *qrpc.Rp
|
|
} `json:"data"`
|
|
} `json:"data"`
|
|
}
|
|
}
|
|
msg.ToUser = param.Openid
|
|
msg.ToUser = param.Openid
|
|
- msg.TplId = managerNotify_tplid
|
|
|
|
|
|
+ msg.TplId = managernotiry_tplid
|
|
msg.Url = param.Url
|
|
msg.Url = param.Url
|
|
msg.Data.Title.Value = param.Title
|
|
msg.Data.Title.Value = param.Title
|
|
msg.Data.Detail.Value = param.Detail
|
|
msg.Data.Detail.Value = param.Detail
|
|
@@ -206,46 +198,6 @@ func (wxrpc *WeiXinRpc) SendOffLineMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResul
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//发送管理员通知
|
|
|
|
-func (wxrpc *WeiXinRpc) SendManagerNotifyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) (err error) {
|
|
|
|
- //构造自定义消息文本
|
|
|
|
- var msg struct {
|
|
|
|
- ToUser string `json:"touser"`
|
|
|
|
- TplId string `json:"template_id"`
|
|
|
|
- Url string `json:"url"`
|
|
|
|
- Topcolor string `json:"topcolor"`
|
|
|
|
- Data struct {
|
|
|
|
- Title struct {
|
|
|
|
- Value string `json:"value"`
|
|
|
|
- } `json:"first"`
|
|
|
|
- Detail struct {
|
|
|
|
- Value string `json:"value"`
|
|
|
|
- } `json:"keyword1"`
|
|
|
|
- Result struct {
|
|
|
|
- Value string `json:"value"`
|
|
|
|
- } `json:"keyword2"`
|
|
|
|
- Remark struct {
|
|
|
|
- Value string `json:"value"`
|
|
|
|
- } `json:"remark"`
|
|
|
|
- } `json:"data"`
|
|
|
|
- }
|
|
|
|
- msg.ToUser = param.Openid
|
|
|
|
- msg.TplId = managernotiry_tplid
|
|
|
|
- msg.Url = param.Url
|
|
|
|
- msg.Data.Title.Value = param.Title
|
|
|
|
- msg.Data.Detail.Value = param.Detail
|
|
|
|
- msg.Data.Result.Value = param.Result
|
|
|
|
- msg.Data.Remark.Value = param.Remark
|
|
|
|
-
|
|
|
|
- err = wxrpc.wx.PostTextCustom(tplapi_url, &msg)
|
|
|
|
- if err != nil {
|
|
|
|
- log.Println(err.Error())
|
|
|
|
- } else {
|
|
|
|
- log.Println("send tplmsg success!")
|
|
|
|
- }
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func StartWeixinRpc(wx *weixin.Weixin) {
|
|
func StartWeixinRpc(wx *weixin.Weixin) {
|
|
wrpc := &WeiXinRpc{wx: wx}
|
|
wrpc := &WeiXinRpc{wx: wx}
|
|
//在此可以注册多个Rpc服务接口
|
|
//在此可以注册多个Rpc服务接口
|