|
@@ -565,3 +565,55 @@ func GetYanxuanSpecialDetailUserPower(user *models.WxUserItem) (havePower bool,
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+func GetYanxuanSpecialLikeCountDifferent(cont context.Context) (err error) {
|
|
|
+
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("err:", err)
|
|
|
+ go utils.SendAlarmMsg(" 专栏文章获得点赞时,模板消息通知作者(每个整点发送,不同文章分多条发送)失败,GetYanxuanSpecialLikeCountDifferent Err:"+err.Error(), 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition += ` AND like_count > like_count_history `
|
|
|
+ list, e := models.GetYanxuanSpecialListBycondition(condition, pars, 0, 0)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetYanxuanSpecialListBycondition, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(list) == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var userIds []int
|
|
|
+ for _, v := range list {
|
|
|
+ fmt.Println(v.Id)
|
|
|
+ userIds = append(userIds, v.UserId)
|
|
|
+ }
|
|
|
+
|
|
|
+ listUser, e := models.GetWxUserByUserIds(userIds)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetWxUserByUserIds, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapUserMobile := make(map[int]string)
|
|
|
+ var mobiles []string
|
|
|
+ for _, v := range listUser {
|
|
|
+ mobiles = append(mobiles, v.Mobile)
|
|
|
+ mapUserMobile[v.UserId] = v.Mobile
|
|
|
+ }
|
|
|
+ for _, v := range list {
|
|
|
+ if mapUserMobile[v.UserId] == "" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ go SendCategoryTemplateMsgLikeCountDifferentByYxCategory(v.LikeCount-v.LikeCountHistory, v.Id, mapUserMobile[v.UserId], v.Title)
|
|
|
+ time.Sleep(time.Second * 1)
|
|
|
+ }
|
|
|
+
|
|
|
+ err = models.UpdateYanxuanSpecialLikeCountHistory()
|
|
|
+
|
|
|
+ return
|
|
|
+}
|