WH01243 пре 1 месец
родитељ
комит
104472f7a4
1 измењених фајлова са 6 додато и 5 уклоњено
  1. 6 5
      clueSync/jobutil.go

+ 6 - 5
clueSync/jobutil.go

@@ -562,7 +562,7 @@ func users() {
 	log.Println("新注册用户定时任务开始", cfg.LastUserId)
 	selectTimeEnd := cfg.LastUserId
 	sql := fmt.Sprintf(`select * from dwd_f_userbase_baseinfo   where createtime > "%s" and (s_platform != 'xcx' or    s_sourceid='jyzbw'    or  s_platform is  NULL)  and source = "0101" and status != 2  order by  createtime asc`, selectTimeEnd)
-	//sql := fmt.Sprintf(`select * from dwd_f_userbase_baseinfo   where id= 2259277`)
+	//sql := fmt.Sprintf(`select * from dwd_f_userbase_baseinfo   where id= 12617743`)
 	data := TiDb.SelectBySql(sql)
 	if data != nil && *data != nil && len(*data) > 0 {
 		for k, v := range *data {
@@ -570,7 +570,7 @@ func users() {
 			createtime := common.ObjToString(v["createtime"])
 			changeCode := GetUserChannel(gconv.String(v["userid"]))
 			if changeCode != "" {
-				TiDb.Update("", map[string]interface{}{
+				TiDb.Update("dwd_f_userbase_baseinfo", map[string]interface{}{
 					"userid": gconv.String(v["userid"]),
 				}, map[string]interface{}{
 					"belong_to": changeCode,
@@ -1807,8 +1807,8 @@ func nextYearActivity() {
 }
 
 // 获取用户渠道信息
-func GetUserChannel(uid string) string {
-	if uid == "" {
+func GetUserChannel(userId string) string {
+	if userId == "" {
 		return ""
 	}
 	codeArr := []string{}
@@ -1818,7 +1818,8 @@ func GetUserChannel(uid string) string {
 		}
 	}
 	//查找注册日志表
-	courceData := ThirdParty.SelectBySql(fmt.Sprintf(`select  channel_code   from   user_source     where  user_id  =""  and   channel_code  in   ()   ORDER BY   create_time  desc   limit   10  `))
+	sql := fmt.Sprintf(`select  channel_code   from   user_source     where  user_id  ="%s"  and   channel_code  in   (%s)   ORDER BY   create_time  desc   limit   10  `, userId, strings.Join(codeArr, ","))
+	courceData := ThirdParty.SelectBySql(sql)
 	if courceData != nil && len(*courceData) > 0 {
 		channelCode := gconv.String((*courceData)[0]["channel_code"])
 		data, exit := UserChannel[channelCode]