|
@@ -14,6 +14,7 @@ import (
|
|
|
|
|
|
util "app.yhyue.com/moapp/jybase/common"
|
|
util "app.yhyue.com/moapp/jybase/common"
|
|
. "app.yhyue.com/moapp/jybase/date"
|
|
. "app.yhyue.com/moapp/jybase/date"
|
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
"app.yhyue.com/moapp/jybase/logger"
|
|
"app.yhyue.com/moapp/jybase/logger"
|
|
. "app.yhyue.com/moapp/jybase/mongodb"
|
|
. "app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
@@ -162,10 +163,13 @@ func (n *NoMsgTipJob) beforeTip(taskType int, allTip []*UserInfo, wxTplSurplus i
|
|
|
|
|
|
//
|
|
//
|
|
func (n *NoMsgTipJob) toTip(taskType int, user *UserInfo, wxTplSurplus int64, noMsgTipLastId atomic.Value) {
|
|
func (n *NoMsgTipJob) toTip(taskType int, user *UserInfo, wxTplSurplus int64, noMsgTipLastId atomic.Value) {
|
|
- firstTitle, area, jcly, mailContent, infoCount, firstAutoId := n.SubRecommend(user)
|
|
|
|
|
|
+ firstTitle, area, jcly, mailContent, infoCount, firstAutoId, firstId, isNewestBid := n.SubRecommend(user)
|
|
if infoCount == 0 {
|
|
if infoCount == 0 {
|
|
logger.Info("无消息提醒任务", taskType, "没有要推荐的信息,过滤掉", user.Id)
|
|
logger.Info("无消息提醒任务", taskType, "没有要推荐的信息,过滤掉", user.Id)
|
|
return
|
|
return
|
|
|
|
+ } else if user.Phone != "" && isNewestBid {
|
|
|
|
+ logger.Info("无消息提醒任务", taskType, "有手机号不再推送最新标讯", user.Id)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
now := time.Now()
|
|
now := time.Now()
|
|
redis.Put(Pushcache_2_c, NoMsgTipKey(user.Id), 1, OneDaySecond)
|
|
redis.Put(Pushcache_2_c, NoMsgTipKey(user.Id), 1, OneDaySecond)
|
|
@@ -194,7 +198,7 @@ func (n *NoMsgTipJob) toTip(taskType int, user *UserInfo, wxTplSurplus int64, no
|
|
}
|
|
}
|
|
if isWxPush {
|
|
if isWxPush {
|
|
logger.Info("无消息提醒任务", taskType, "开始微信推送", user.Id)
|
|
logger.Info("无消息提醒任务", taskType, "开始微信推送", user.Id)
|
|
- isWxPushOk = n.sendWeixin(user, firstTitle, area, jcly, infoCount)
|
|
|
|
|
|
+ isWxPushOk = n.sendWeixin(user, firstTitle, area, jcly, infoCount, firstId, isNewestBid)
|
|
logger.Info("无消息提醒任务", taskType, "微信推送结束", isWxPushOk, user.Id)
|
|
logger.Info("无消息提醒任务", taskType, "微信推送结束", isWxPushOk, user.Id)
|
|
} else {
|
|
} else {
|
|
if noMsgTipLastId.Load().(string) < user.Id {
|
|
if noMsgTipLastId.Load().(string) < user.Id {
|
|
@@ -228,7 +232,7 @@ func (n *NoMsgTipJob) toTip(taskType int, user *UserInfo, wxTplSurplus int64, no
|
|
}
|
|
}
|
|
|
|
|
|
//推送微信
|
|
//推送微信
|
|
-func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle, area, jcly string, infoCount int) bool {
|
|
|
|
|
|
+func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle, area, jcly string, infoCount int, firstId string, isNewestBid bool) bool {
|
|
tmplData := map[string]*qrpc.TmplItem{
|
|
tmplData := map[string]*qrpc.TmplItem{
|
|
"thing3": &qrpc.TmplItem{
|
|
"thing3": &qrpc.TmplItem{
|
|
Value: area,
|
|
Value: area,
|
|
@@ -246,17 +250,21 @@ func (n *NoMsgTipJob) sendWeixin(user *UserInfo, firstTitle, area, jcly string,
|
|
Value: fmt.Sprintf("%d条", infoCount),
|
|
Value: fmt.Sprintf("%d条", infoCount),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
+ thisUrl := Config.NoMsgTip.Wx.Url
|
|
|
|
+ if user.Phone == "" && isNewestBid {
|
|
|
|
+ thisUrl = fmt.Sprintf(Config.NoMsgTip.Wx.UnbindUrl, encrypt.CommonEncodeArticle("content", firstId), time.Now().Unix())
|
|
|
|
+ }
|
|
ok := putil.SendWeixin(user, &qrpc.WxTmplMsg{
|
|
ok := putil.SendWeixin(user, &qrpc.WxTmplMsg{
|
|
OpenId: user.S_m_openid,
|
|
OpenId: user.S_m_openid,
|
|
TplId: Config.NoMsgTip.Wx.Id,
|
|
TplId: Config.NoMsgTip.Wx.Id,
|
|
TmplData: tmplData,
|
|
TmplData: tmplData,
|
|
- Url: Config.WxDomain + "/front/sess/" + Se.EncodeString(user.Id+",_id,"+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(Config.NoMsgTip.Wx.Url),
|
|
|
|
|
|
+ Url: Config.WxDomain + "/front/sess/" + Se.EncodeString(user.Id+",_id,"+strconv.Itoa(int(time.Now().Unix()))+",") + "__" + Se.EncodeString(thisUrl),
|
|
})
|
|
})
|
|
return ok
|
|
return ok
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
//
|
|
-func (n *NoMsgTipJob) SubRecommend(user *UserInfo) (string, string, string, string, int, int64) {
|
|
|
|
|
|
+func (n *NoMsgTipJob) SubRecommend(user *UserInfo) (string, string, string, string, int, int64, string, bool) {
|
|
n.selectPool <- true
|
|
n.selectPool <- true
|
|
defer func() {
|
|
defer func() {
|
|
<-n.selectPool
|
|
<-n.selectPool
|