|
@@ -90,7 +90,7 @@ func (w *WeiXinRpc) SendBidOpenMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) e
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//数据报告订阅成功发送模板消息
|
|
|
+// 数据报告订阅成功发送模板消息
|
|
|
func (w *WeiXinRpc) SendDataReportMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) error {
|
|
|
_, err := w.Wwx.PostTemplateMessage(param.Openid, TPL_DATAREPORT_ID, param.Url,
|
|
|
weixin.TmplData{
|
|
@@ -111,7 +111,7 @@ func (w *WeiXinRpc) SendDataReportMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//发送保函消息
|
|
|
+// 发送保函消息
|
|
|
func (w *WeiXinRpc) SendLOGApplyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) error {
|
|
|
_, err := w.Wwx.PostTemplateMessage(param.Openid, TPL_LOGAPPLY_ID, param.Url,
|
|
|
weixin.TmplData{
|
|
@@ -130,7 +130,7 @@ func (w *WeiXinRpc) SendLOGApplyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult)
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//发送年终活动消息
|
|
|
+// 发送年终活动消息
|
|
|
func (w *WeiXinRpc) SendACTIVEApplyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) error {
|
|
|
*ret = "Y"
|
|
|
_, err := w.Wwx.PostTemplateMessage(param.Openid, TPL_ACTIVEAPPLY_ID, param.Url,
|
|
@@ -151,7 +151,7 @@ func (w *WeiXinRpc) SendACTIVEApplyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResul
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//取得JS接口参数
|
|
|
+// 取得JS接口参数
|
|
|
func (w *WeiXinRpc) GetJSInterfaceParam(currenturl string, ret *[]string) (err error) {
|
|
|
timestamp := time.Now().Unix()
|
|
|
noncestr := util.Uuid(32)
|
|
@@ -165,11 +165,15 @@ func (w *WeiXinRpc) GetJSInterfaceParam(currenturl string, ret *[]string) (err e
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-/**生成分享二维码
|
|
|
+/*
|
|
|
+*生成分享二维码
|
|
|
规则:自动生成二维码,存储并存储到redis中
|
|
|
+
|
|
|
开发在使用时,先查看redis,没有的话再调用此RPC方法
|
|
|
生成的二维码有效期为一个月
|
|
|
-**/
|
|
|
+
|
|
|
+*
|
|
|
+*/
|
|
|
func (w *WeiXinRpc) GetShareQR(shareid uint32, ret *string) (err error) {
|
|
|
//构造自定义消息文本
|
|
|
var msg struct {
|
|
@@ -193,6 +197,7 @@ func (w *WeiXinRpc) GetShareQR(shareid uint32, ret *string) (err error) {
|
|
|
tmp := map[string]interface{}{}
|
|
|
json.Unmarshal(data, &tmp)
|
|
|
url := tmp["url"].(string)
|
|
|
+
|
|
|
//生二维码
|
|
|
r, _ := qr.Encode(url, qr.L)
|
|
|
pngdat := r.PNG()
|
|
@@ -207,7 +212,7 @@ func (w *WeiXinRpc) GetShareQR(shareid uint32, ret *string) (err error) {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//剑鱼标讯相关二维码
|
|
|
+// 剑鱼标讯相关二维码
|
|
|
func (w *WeiXinRpc) GetShareQRStr(id string, ret *string) (err error) {
|
|
|
expire := 8640
|
|
|
if strings.Contains(id, "seal") {
|
|
@@ -227,7 +232,7 @@ func (w *WeiXinRpc) GetShareQRStr(id string, ret *string) (err error) {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//剑鱼标讯开放平台相关二维码
|
|
|
+// 剑鱼标讯开放平台相关二维码
|
|
|
func (w *WeiXinRpc) Jyop_GetQrCode(id string, ret *string) (err error) {
|
|
|
expire := 8640
|
|
|
pngdat, err := tempQrCodeFromWx(id, expire, w.Wwx)
|
|
@@ -241,7 +246,7 @@ func (w *WeiXinRpc) Jyop_GetQrCode(id string, ret *string) (err error) {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//从微信获取临时二维码
|
|
|
+// 从微信获取临时二维码
|
|
|
func tempQrCodeFromWx(id string, expire int, w *weixin.Weixin) ([]byte, error) {
|
|
|
//构造自定义消息文本
|
|
|
var msg struct {
|
|
@@ -273,7 +278,7 @@ func tempQrCodeFromWx(id string, expire int, w *weixin.Weixin) ([]byte, error) {
|
|
|
return r.PNG(), nil
|
|
|
}
|
|
|
|
|
|
-//发送管理员通知
|
|
|
+// 发送管理员通知
|
|
|
func (w *WeiXinRpc) SendFeedbackNotifyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) error {
|
|
|
_, err := w.Wwx.PostTemplateMessage(param.Openid, TPL_MANAGERNOTIFY_ID, param.Url,
|
|
|
weixin.TmplData{
|
|
@@ -290,7 +295,7 @@ func (w *WeiXinRpc) SendFeedbackNotifyMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcRe
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//取得预生成订单编号,我们的系统要控制下,别订单重复了
|
|
|
+// 取得预生成订单编号,我们的系统要控制下,别订单重复了
|
|
|
func (w *WeiXinRpc) GetPrepayId(param map[string]string, res *[]byte) error {
|
|
|
defer util.Catch()
|
|
|
attachmsg := param["attachmsg"]
|
|
@@ -371,7 +376,7 @@ func (w *WeiXinRpc) GetPrepayId(param map[string]string, res *[]byte) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//最通用的发送模板消息
|
|
|
+// 最通用的发送模板消息
|
|
|
func (w *WeiXinRpc) SendTmplMsg(param *qrpc.WxTmplMsg, ret *qrpc.RpcResult) error {
|
|
|
tmplData := make(weixin.TmplData)
|
|
|
for k, v := range param.TmplData {
|
|
@@ -400,7 +405,7 @@ func (w *WeiXinRpc) SendTmplMsg(param *qrpc.WxTmplMsg, ret *qrpc.RpcResult) erro
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//自定义模板消息
|
|
|
+// 自定义模板消息
|
|
|
func (w *WeiXinRpc) SendCustomTplMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult) error {
|
|
|
_, err := w.Wwx.PostTemplateMessage(param.Openid, param.TplId, param.Url,
|
|
|
weixin.TmplData{
|
|
@@ -419,7 +424,7 @@ func (w *WeiXinRpc) SendCustomTplMsg(param *qrpc.NotifyMsg, ret *qrpc.RpcResult)
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//自定义消息
|
|
|
+// 自定义消息
|
|
|
func (w *WeiXinRpc) SendCustomMsg(p *[]byte, ret *string) error {
|
|
|
var d map[string]interface{}
|
|
|
err := json.Unmarshal(*p, &d)
|
|
@@ -444,7 +449,7 @@ func (w *WeiXinRpc) SendCustomMsg(p *[]byte, ret *string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//支付订单关闭
|
|
|
+// 支付订单关闭
|
|
|
func (w *WeiXinRpc) CloseOrder(param map[string]string, res *bool) error {
|
|
|
defer util.Catch()
|
|
|
appid := param["appid"]
|
|
@@ -492,7 +497,7 @@ func (w *WeiXinRpc) CloseOrder(param map[string]string, res *bool) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//分销系统分享相关二维码
|
|
|
+// 分销系统分享相关二维码
|
|
|
func (w *WeiXinRpc) JyDis_GetQrCode(id string, ret *string) (err error) {
|
|
|
pngdat, err := permQrCodeFromWx(id, w.Wwx)
|
|
|
if err != nil {
|
|
@@ -505,7 +510,7 @@ func (w *WeiXinRpc) JyDis_GetQrCode(id string, ret *string) (err error) {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//从微信获取永久str二维码
|
|
|
+// 从微信获取永久str二维码
|
|
|
func permQrCodeFromWx(id string, w *weixin.Weixin) ([]byte, error) {
|
|
|
//构造自定义消息文本
|
|
|
var msg struct {
|
|
@@ -536,7 +541,7 @@ func permQrCodeFromWx(id string, w *weixin.Weixin) ([]byte, error) {
|
|
|
return r.PNG(), nil
|
|
|
}
|
|
|
|
|
|
-//剑鱼标讯获取未关注用户得unionid
|
|
|
+// 剑鱼标讯获取未关注用户得unionid
|
|
|
func (w *WeiXinRpc) GetUnionid(openid string, unionid *string) (err error) {
|
|
|
bs, err := w.Wwx.GetUserInfo(openid)
|
|
|
if err != nil {
|