123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package services
- import (
- "fmt"
- "hongze/hongze_clpt/models"
- "hongze/hongze_clpt/utils"
- "time"
- )
- // 添加用户阅读标签到Redis
- func ArticleHistoryUserLabelLogAdd(articleId, uid int) (err error) {
- defer func() {
- if err != nil {
- fmt.Println(err)
- msg := fmt.Sprint("articleId:", articleId, "userId:", uid)
- go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2)
- }
- }()
- // SourceType 1:文章阅读、 2产业关注、3:活动到会、4系列关注、5专项调研活动到会。
- log := &models.CygxUserLabelLogRedis{UserId: uid, SourceId: articleId, SourceType: 1, CreateTime: time.Now()}
- if utils.Re == nil {
- err := utils.Rc.LPush(utils.CYGX_USER_KEY_LABEL, log)
- if err != nil {
- fmt.Println("CygxUserLabelLogRedis LPush Err:" + err.Error())
- }
- }
- return
- }
- // 添加用户2产业关注标签到Redis
- func IndustryFllowUserLabelLogAdd(industrialManagementId, count, uid int) (err error) {
- var isFllow int
- if count == 0 {
- isFllow = 1
- } else {
- isFllow = 0
- }
- defer func() {
- if err != nil {
- fmt.Println(err)
- msg := fmt.Sprint("industrialManagementId:", industrialManagementId, "isFllow:", isFllow, "userId:", uid)
- go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2)
- }
- }()
- log := &models.CygxUserLabelLogRedis{UserId: uid, SourceId: industrialManagementId, SourceType: 2, IsFllow: isFllow, CreateTime: time.Now()}
- if utils.Re == nil {
- err := utils.Rc.LPush(utils.CYGX_USER_KEY_LABEL, log)
- if err != nil {
- fmt.Println("RecordNewLogs LPush Err:" + err.Error())
- }
- }
- return
- }
- // 添加用户4系列关注标签到Redis
- func CategoryFllowUserLabelLogAdd(industrialManagementId, count, uid int) (err error) {
- var isFllow int
- if count == 0 {
- isFllow = 1
- } else {
- isFllow = 0
- }
- defer func() {
- if err != nil {
- fmt.Println(err)
- msg := fmt.Sprint("industrialManagementId:", industrialManagementId, "isFllow:", isFllow, "userId:", uid)
- go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2)
- }
- }()
- log := &models.CygxUserLabelLogRedis{UserId: uid, SourceId: industrialManagementId, SourceType: 4, IsFllow: isFllow, CreateTime: time.Now()}
- if utils.Re == nil {
- err := utils.Rc.LPush(utils.CYGX_USER_KEY_LABEL, log)
- if err != nil {
- fmt.Println("RecordNewLogs LPush Err:" + err.Error())
- }
- }
- return
- }
|