package services import ( "fmt" "hongze/hongze_web_mfyx/models" "hongze/hongze_web_mfyx/utils" "time" ) // 添加用户搜索标签到Redis func KeyWordsWxUserRaiLabelRedisAdd(sourceId, uid int, label string) (err error) { defer func() { if err != nil { fmt.Println(err) msg := fmt.Sprint("sourceId:", sourceId, "userId:", uid) go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2) } }() log := &models.WxUserRaiLabelRedis{UserId: uid, SourceId: sourceId, SourceType: 1, Label: label, CreateTime: time.Now(), RegisterPlatform: utils.REGISTER_PLATFORM} if utils.Re == nil { err := utils.Rc.LPush(utils.WX_USER_RAI_LABEL_KEY, log) if err != nil { fmt.Println("WxUserRaiLabelRedis LPush Err:" + err.Error()) } } return } // 添加用户阅读文章标签到Redis func ArticleWxUserRaiLabelRedisAdd(sourceId, uid int, createTime time.Time) (err error) { defer func() { if err != nil { fmt.Println(err) msg := fmt.Sprint("sourceId:", sourceId, "userId:", uid) go utils.SendAlarmMsg("用户关注产业更新相关标签,写入Redis队列消息失败:"+err.Error()+msg, 2) } }() log := &models.WxUserRaiLabelRedis{UserId: uid, SourceId: sourceId, SourceType: 1, TableName: utils.CYGX_OBJ_ARTICLE, CreateTime: createTime, RegisterPlatform: utils.REGISTER_PLATFORM} if utils.Re == nil { err := utils.Rc.LPush(utils.WX_USER_RAI_LABEL_KEY, log) if err != nil { fmt.Println("WxUserRaiLabelRedis LPush Err:" + err.Error()) } } return }