浏览代码

Merge branch 'dev_v1.5.36.2_wh' of jianyu/datatools into hotfix/v1.5.36.2

王浩 1 月之前
父节点
当前提交
23f864e809
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      clueSync/jobutil.go

+ 9 - 1
clueSync/jobutil.go

@@ -635,6 +635,14 @@ WHERE
 			//判断用户是否有小程序切使用过剑鱼其他产品
 			//判断uid
 			uId := ""
+			changeCode := GetUserChannel(gconv.String(v["userId"]))
+			if changeCode != "" {
+				TiDb.Update("dwd_f_userbase_baseinfo", map[string]interface{}{
+					"userid": gconv.String(v["userId"]),
+				}, map[string]interface{}{
+					"belong_to": changeCode,
+				})
+			}
 			for i := 0; i < 10; i++ {
 				phone := common.ObjToString(v["phone"])
 				contactsData := TiDb.SelectBySql("select * from dwd_f_userbase_contacts where phone = ? and is_delete = 1", phone)
@@ -1818,7 +1826,7 @@ func GetUserChannel(userId string) string {
 		}
 	}
 	//查找注册日志表
-	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, ","))
+	sql := fmt.Sprintf(`select  channel_code   from   user_source     where  user_id  ="%s"  and   channel_code  in   (%s)   ORDER BY   create_time  desc   limit   1  `, userId, strings.Join(codeArr, ","))
 	courceData := ThirdParty.SelectBySql(sql)
 	if courceData != nil && len(*courceData) > 0 {
 		channelCode := gconv.String((*courceData)[0]["channel_code"])