zhangchuanxing 1 сар өмнө
parent
commit
b9efb31cd3

+ 2 - 1
controllers/chart.go

@@ -59,7 +59,8 @@ func (this *ChartController) Detail() {
 			detail.IsCollection = true
 		}
 	}
-	go services.ServerAddCygxChartRecord(user, chartId) //用户阅读图表,添加浏览记录
+	go services.ServerAddCygxChartRecord(user, chartId)                  //用户阅读图表,添加浏览记录
+	go services.KeyChartWxUserRaiLabelRedisAdd(chartId, user.UserId, "") //用户阅读图表,添加浏览记录
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 19 - 0
services/wx_user_rai_label.go

@@ -82,3 +82,22 @@ func ActivityVivoWxUserRaiLabelRedisAdd(sourceId, uid int, createTime time.Time)
 	}
 	return
 }
+
+// 添加用户阅读图表标签到Redis
+func KeyChartWxUserRaiLabelRedisAdd(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: 10, 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
+}