|
@@ -4,6 +4,7 @@ import (
|
|
|
"bytes"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "hongze/hongze_mobile_admin/models/tables/admin"
|
|
|
"hongze/hongze_mobile_admin/models/tables/user_template_record"
|
|
|
"hongze/hongze_mobile_admin/models/tables/wx_user"
|
|
|
"hongze/hongze_mobile_admin/services/alarm_msg"
|
|
@@ -101,7 +102,7 @@ func SendCompanyApplyWxTemplateMsg(mobile, redirectUrl, wxAppPath string, wxMsgM
|
|
|
}()
|
|
|
utils.FileLog.Info("%s", "services SendMsg")
|
|
|
|
|
|
- accessToken, err := WxGetAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
+ accessToken, err := WxGetRedisAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
if err != nil {
|
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
|
return
|
|
@@ -113,12 +114,18 @@ func SendCompanyApplyWxTemplateMsg(mobile, redirectUrl, wxAppPath string, wxMsgM
|
|
|
utils.FileLog.Info("mobile:%s", mobile)
|
|
|
|
|
|
//获取openid列表
|
|
|
- openIdStr := WxUsersGet()
|
|
|
- openIdList, err := wx_user.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
+ openIdStr := WxAdminOpenIdGet()
|
|
|
+ adminOpenIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
if err != nil {
|
|
|
msg = "get openIdList err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ openIdList := make([]*wx_user.OpenIdList, 0)
|
|
|
+ for _, v := range adminOpenIdList {
|
|
|
+ tmp := new(wx_user.OpenIdList)
|
|
|
+ tmp.OpenId = v.OpenId
|
|
|
+ openIdList = append(openIdList, tmp)
|
|
|
+ }
|
|
|
utils.FileLog.Info("openIdListCount:%s", len(openIdList))
|
|
|
//fmt.Println("openIdListCount:", len(openIdList))
|
|
|
if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" {
|
|
@@ -182,7 +189,7 @@ func SendWxMsgWithRoadshowDetailResult(first, keyword1, keyword2, remark, mobile
|
|
|
}()
|
|
|
utils.FileLog.Info("%s", "services SendMsg")
|
|
|
|
|
|
- accessToken, err := WxGetAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
+ accessToken, err := WxGetRedisAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
if err != nil {
|
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
|
return
|
|
@@ -194,12 +201,18 @@ func SendWxMsgWithRoadshowDetailResult(first, keyword1, keyword2, remark, mobile
|
|
|
utils.FileLog.Info("mobile:%s", mobile)
|
|
|
|
|
|
//获取openid列表
|
|
|
- openIdStr := WxUsersGet()
|
|
|
- openIdList, err := wx_user.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
+ openIdStr := WxAdminOpenIdGet()
|
|
|
+ adminOpenIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
if err != nil {
|
|
|
msg = "get openIdList err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ openIdList := make([]*wx_user.OpenIdList, 0)
|
|
|
+ for _, v := range adminOpenIdList {
|
|
|
+ tmp := new(wx_user.OpenIdList)
|
|
|
+ tmp.OpenId = v.OpenId
|
|
|
+ openIdList = append(openIdList, tmp)
|
|
|
+ }
|
|
|
utils.FileLog.Info("openIdListCount:%s", len(openIdList))
|
|
|
//fmt.Println("openIdListCount:", len(openIdList))
|
|
|
if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" {
|
|
@@ -244,7 +257,7 @@ func SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4,
|
|
|
}()
|
|
|
utils.FileLog.Info("%s", "services SendMsg")
|
|
|
|
|
|
- accessToken, err := WxGetAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
+ accessToken, err := WxGetRedisAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
if err != nil {
|
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
|
return
|
|
@@ -255,12 +268,18 @@ func SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4,
|
|
|
}
|
|
|
|
|
|
//获取openid列表
|
|
|
- openIdStr := WxUsersGet()
|
|
|
- openIdList, err := wx_user.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
+ openIdStr := WxAdminOpenIdGet()
|
|
|
+ adminOpenIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
if err != nil {
|
|
|
msg = "get openIdList err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ openIdList := make([]*wx_user.OpenIdList, 0)
|
|
|
+ for _, v := range adminOpenIdList {
|
|
|
+ tmp := new(wx_user.OpenIdList)
|
|
|
+ tmp.OpenId = v.OpenId
|
|
|
+ openIdList = append(openIdList, tmp)
|
|
|
+ }
|
|
|
utils.FileLog.Info("openIdListCount:%s", len(openIdList))
|
|
|
//fmt.Println("openIdListCount:", len(openIdList))
|
|
|
if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" {
|
|
@@ -305,7 +324,7 @@ func SendWxMsgWithRoadshowDeleteNotice(first, keyword1, keyword2, remark, wxAppP
|
|
|
}()
|
|
|
utils.FileLog.Info("%s", "services SendMsg")
|
|
|
|
|
|
- accessToken, err := WxGetAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
+ accessToken, err := WxGetRedisAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
if err != nil {
|
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
|
return
|
|
@@ -316,12 +335,18 @@ func SendWxMsgWithRoadshowDeleteNotice(first, keyword1, keyword2, remark, wxAppP
|
|
|
}
|
|
|
|
|
|
//获取openid列表
|
|
|
- openIdStr := WxUsersGet()
|
|
|
- openIdList, err := wx_user.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
+ openIdStr := WxAdminOpenIdGet()
|
|
|
+ adminOpenIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
if err != nil {
|
|
|
msg = "get openIdList err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ openIdList := make([]*wx_user.OpenIdList, 0)
|
|
|
+ for _, v := range adminOpenIdList {
|
|
|
+ tmp := new(wx_user.OpenIdList)
|
|
|
+ tmp.OpenId = v.OpenId
|
|
|
+ openIdList = append(openIdList, tmp)
|
|
|
+ }
|
|
|
utils.FileLog.Info("openIdListCount:%s", len(openIdList))
|
|
|
//fmt.Println("openIdListCount:", len(openIdList))
|
|
|
if len(openIdList) > 0 && utils.TemplateIdByCompanyApply != "" {
|
|
@@ -360,7 +385,7 @@ func SendSealFinishedWxTemplateMsg(mobile string, companyName string, sealId int
|
|
|
}
|
|
|
}()
|
|
|
utils.FileLog.Info("%s", "services SendMsg")
|
|
|
- accessToken, err := WxGetAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
+ accessToken, err := WxGetRedisAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
if err != nil {
|
|
|
msg = "GetWxAccessToken Err:" + err.Error()
|
|
|
return
|
|
@@ -370,12 +395,18 @@ func SendSealFinishedWxTemplateMsg(mobile string, companyName string, sealId int
|
|
|
return
|
|
|
}
|
|
|
utils.FileLog.Info("mobile:%s", mobile)
|
|
|
- openIdStr := WxUsersGet()
|
|
|
- openIdList, err := wx_user.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
+ openIdStr := WxAdminOpenIdGet()
|
|
|
+ adminOpenIdList, err := admin.GetOpenIdListByMobile(mobile, openIdStr)
|
|
|
if err != nil {
|
|
|
msg = "get openIdList err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ openIdList := make([]*wx_user.OpenIdList, 0)
|
|
|
+ for _, v := range adminOpenIdList {
|
|
|
+ tmp := new(wx_user.OpenIdList)
|
|
|
+ tmp.OpenId = v.OpenId
|
|
|
+ openIdList = append(openIdList, tmp)
|
|
|
+ }
|
|
|
utils.FileLog.Info("openIdListCount:%s", len(openIdList))
|
|
|
|
|
|
if len(openIdList) > 0 && utils.WxMsgTemplateIdWithSealApplyFinished != "" {
|
|
@@ -418,8 +449,8 @@ func SendYbQuestionDistributeWxMsg(questionId, userId int, openid, questionTitle
|
|
|
go alarm_msg.SendAlarmMsg(alarmMsg, 3)
|
|
|
}
|
|
|
}()
|
|
|
-
|
|
|
- accessToken, err := WxGetAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
+ // todo 修改openID
|
|
|
+ accessToken, err := WxGetRedisAccessToken(utils.AdminWxAppId, utils.AdminWxAppSecret)
|
|
|
if err != nil {
|
|
|
errMsg = "GetWxAccessToken Err:" + err.Error()
|
|
|
return
|