|
@@ -7,6 +7,7 @@ import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"hongze/hongze_yb/global"
|
|
|
+ "hongze/hongze_yb/models/tables/user_record"
|
|
|
"hongze/hongze_yb/models/tables/user_template_record"
|
|
|
"hongze/hongze_yb/services/alarm_msg"
|
|
|
"hongze/hongze_yb/utils"
|
|
@@ -174,8 +175,8 @@ func SendMultiTemplateMsg(sendMap map[string]interface{}, items []*OpenIdList, r
|
|
|
}
|
|
|
|
|
|
// SendQuestionReplyWxMsg 推送研报小程序模板消息-问答社区回复
|
|
|
-func SendQuestionReplyWxMsg(questionId, userId int, openid, questionTitle string) (err error) {
|
|
|
- if userId == 0 || openid == "" {
|
|
|
+func SendQuestionReplyWxMsg(questionId, userId int, questionTitle string) (err error) {
|
|
|
+ if userId == 0 {
|
|
|
return
|
|
|
}
|
|
|
var errMsg string
|
|
@@ -185,10 +186,24 @@ func SendQuestionReplyWxMsg(questionId, userId int, openid, questionTitle string
|
|
|
go alarm_msg.SendAlarmMsg(alarmMsg, 3)
|
|
|
}
|
|
|
}()
|
|
|
+ // 校验用户是否取消关注公众号
|
|
|
+ userRecord, e := user_record.GetByUserId(userId, utils.USER_RECORD_PLATFORM_RDDP)
|
|
|
+ if e != nil {
|
|
|
+ // 用户无公众号信息
|
|
|
+ if e == utils.ErrNoRow {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = errors.New("获取用户Record信息失败, Err:" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 取消关注则不推送
|
|
|
+ if userRecord.Subscribe == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
openIdList := make([]*OpenIdList, 0)
|
|
|
openIdList = append(openIdList, &OpenIdList{
|
|
|
- OpenId: openid,
|
|
|
+ OpenId: userRecord.OpenID,
|
|
|
UserId: userId,
|
|
|
})
|
|
|
|