|
@@ -36,8 +36,10 @@ func everythingSync() {
|
|
|
data := ThirdParty.SelectBySql(sql)
|
|
|
if data != nil && *data != nil && len(*data) > 0 {
|
|
|
for _, v := range *data {
|
|
|
- channel_code := gconv.String("channel_code")
|
|
|
- channeName := UserChannel[channel_code]
|
|
|
+ channel_code := gconv.String(v["channel_code"])
|
|
|
+ changeMap := UserChannel[channel_code]
|
|
|
+ channeName := changeMap["name"]
|
|
|
+ channelCode := changeMap["clueCode"]
|
|
|
user_id := common.ObjToString(v["user_id"])
|
|
|
position_id := common.Int64All(v["position_id"])
|
|
|
phone := common.ObjToString(v["phone"])
|
|
@@ -154,7 +156,7 @@ func everythingSync() {
|
|
|
})
|
|
|
}
|
|
|
if clueId > 0 && is_assign != 1 && is_transfer != 1 {
|
|
|
- TiDb.Update("dwd_f_userbase_baseinfo", map[string]interface{}{"userid": user_id}, map[string]interface{}{"belong_to": "0301"})
|
|
|
+ TiDb.Update("dwd_f_userbase_baseinfo", map[string]interface{}{"userid": user_id}, map[string]interface{}{"belong_to": channelCode})
|
|
|
TiDb.Update("dwd_f_crm_clue_info", map[string]interface{}{"phone": phone}, map[string]interface{}{"is_assign": -1})
|
|
|
TiDb.Insert("dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
"clue_id": clueId,
|
|
@@ -173,10 +175,9 @@ func everythingSync() {
|
|
|
log.Println("三方渠道数据定时任务结束")
|
|
|
}
|
|
|
|
|
|
-func saveEverything(user_id, phone, item, sourceName, sourceCode, channeName string) bool {
|
|
|
- if channeName == "" {
|
|
|
- channeName = "一切都好"
|
|
|
- }
|
|
|
+func saveEverything(user_id, phone, item, sourceName, sourceCode, belongTo string) bool {
|
|
|
+ changeMap := UserChannel[belongTo]
|
|
|
+ changeName := gconv.String(changeMap["name"])
|
|
|
nowTime, isOk := time.Now().Format(dates.Date_Full_Layout), false
|
|
|
user_mold, is_assign, is_transfer, last_login_time, registe_time, mailbox, source, order_type, sales_leads_source := 4, 0, 0, "", "", "", "", "", ""
|
|
|
owner, sales_lead_phone, sales_ent_name, sales_position, sales_dep, data_request, clueId, position_id := "", "", "", "", "", "", int64(0), int64(0)
|
|
@@ -311,7 +312,7 @@ func saveEverything(user_id, phone, item, sourceName, sourceCode, channeName str
|
|
|
"clue_id": clueId,
|
|
|
"position_id": common.If(position_id > 0, position_id, -1),
|
|
|
"change_type": "退出公海",
|
|
|
- "new_value": fmt.Sprintf("通过合作渠道%s登录", channeName),
|
|
|
+ "new_value": fmt.Sprintf("通过合作渠道%s登录", changeName),
|
|
|
"createtime": nowTime,
|
|
|
"BCPCID": common.GetRandom(32),
|
|
|
"operator_id": -1,
|