|
@@ -20,16 +20,34 @@ func tagAllSync() {
|
|
//dwd_f_userbase_order_info -->product_type去重 -->userid
|
|
//dwd_f_userbase_order_info -->product_type去重 -->userid
|
|
//dwd_f_userbase_order_info -->product_type=VIP订阅 vip_endtime 一周内到期、一月内到期 -->userid 暂时不要了
|
|
//dwd_f_userbase_order_info -->product_type=VIP订阅 vip_endtime 一周内到期、一月内到期 -->userid 暂时不要了
|
|
//dwd_f_userbase_event_info -->createtime查昨天有没有数据, 有数据-昨日浏览过 没数据-昨日未浏览 -->userid
|
|
//dwd_f_userbase_event_info -->createtime查昨天有没有数据, 有数据-昨日浏览过 没数据-昨日未浏览 -->userid
|
|
|
|
+
|
|
log.Println("用户标签定时任务开始")
|
|
log.Println("用户标签定时任务开始")
|
|
// TiDb.ExecBySql(`SET session max_execution_time=86400`)
|
|
// TiDb.ExecBySql(`SET session max_execution_time=86400`)
|
|
count := 0
|
|
count := 0
|
|
|
|
+ now := time.Now()
|
|
|
|
+ var allUser []map[string]interface{}
|
|
|
|
+ startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
|
|
TiDb.SelectByBath(100, func(l *[]map[string]interface{}) bool {
|
|
TiDb.SelectByBath(100, func(l *[]map[string]interface{}) bool {
|
|
for _, v := range *l {
|
|
for _, v := range *l {
|
|
- count++
|
|
|
|
- FormatTag(v, count)
|
|
|
|
|
|
+ allUser = append(allUser, v)
|
|
}
|
|
}
|
|
return true
|
|
return true
|
|
- }, `select l_registedate,userid,uid,base_user_id from dwd_f_userbase_baseinfo order by updatetime desc`)
|
|
|
|
|
|
+ }, fmt.Sprintf(`select userid from dwd_f_userbase_visit_info where createtime>"%s" order by createtime asc`, startOfDay.Format(time.DateTime)))
|
|
|
|
+ //}, fmt.Sprintf(`select userid from dwd_f_userbase_visit_info where createtime>"%s" order by createtime asc`, "2024-08-07 16:04:09"))
|
|
|
|
+ TiDb.Update("dwd_f_crm_attribute_label", map[string]interface{}{}, map[string]interface{}{
|
|
|
|
+ "members_info": "昨日未浏览",
|
|
|
|
+ "updatetime": time.Now().Format("2006-01-02 15:04:05"),
|
|
|
|
+ })
|
|
|
|
+ for _, v := range allUser {
|
|
|
|
+ count++
|
|
|
|
+ //查询用户信息
|
|
|
|
+ userId := common.ObjToString(v["userid"])
|
|
|
|
+ userData := TiDb.SelectBySql("select l_registedate,userid,uid,base_user_id from dwd_f_userbase_baseinfo where userid=?", userId)
|
|
|
|
+ for _, vv := range *userData {
|
|
|
|
+ FormatTag(vv, count)
|
|
|
|
+ }
|
|
|
|
+ log.Println(count)
|
|
|
|
+ }
|
|
log.Println("用户标签定时任务结束")
|
|
log.Println("用户标签定时任务结束")
|
|
}
|
|
}
|
|
|
|
|
|
@@ -49,7 +67,6 @@ func FormatTag(data map[string]interface{}, count int) {
|
|
if visitData != nil && len(*visitData) > 0 {
|
|
if visitData != nil && len(*visitData) > 0 {
|
|
date = common.ObjToString((*visitData)["date"])
|
|
date = common.ObjToString((*visitData)["date"])
|
|
}
|
|
}
|
|
-
|
|
|
|
//搜索数据
|
|
//搜索数据
|
|
searchData := TiDb.Find("dwd_f_userbase_search_info", map[string]interface{}{"userid": userId}, "", "", -1, -1)
|
|
searchData := TiDb.Find("dwd_f_userbase_search_info", map[string]interface{}{"userid": userId}, "", "", -1, -1)
|
|
if searchData != nil && len(*searchData) > 0 {
|
|
if searchData != nil && len(*searchData) > 0 {
|
|
@@ -94,7 +111,6 @@ func FormatTag(data map[string]interface{}, count int) {
|
|
search_areass = strings.Join(search_areas_arr, ",")
|
|
search_areass = strings.Join(search_areas_arr, ",")
|
|
search_wordss = strings.Join(search_words_arr, ",")
|
|
search_wordss = strings.Join(search_words_arr, ",")
|
|
}
|
|
}
|
|
-
|
|
|
|
//订单购买的服务
|
|
//订单购买的服务
|
|
orderData := TiDb.Find("dwd_f_userbase_order_info", map[string]interface{}{"userid": userId, "order_status": 1, "delete_status": 0}, "", "", -1, -1)
|
|
orderData := TiDb.Find("dwd_f_userbase_order_info", map[string]interface{}{"userid": userId, "order_status": 1, "delete_status": 0}, "", "", -1, -1)
|
|
if orderData != nil && len(*orderData) > 0 {
|
|
if orderData != nil && len(*orderData) > 0 {
|
|
@@ -118,14 +134,12 @@ func FormatTag(data map[string]interface{}, count int) {
|
|
}
|
|
}
|
|
product_types = strings.Join(product_type_arrs, ",")
|
|
product_types = strings.Join(product_type_arrs, ",")
|
|
}
|
|
}
|
|
-
|
|
|
|
//订阅数据
|
|
//订阅数据
|
|
subscribeData := TiDb.FindOne("dwd_f_userbase_subscribe_info", map[string]interface{}{"userid": userId}, "", "updatetime desc")
|
|
subscribeData := TiDb.FindOne("dwd_f_userbase_subscribe_info", map[string]interface{}{"userid": userId}, "", "updatetime desc")
|
|
if subscribeData != nil && len(*subscribeData) > 0 {
|
|
if subscribeData != nil && len(*subscribeData) > 0 {
|
|
subscribe_keywords = common.ObjToString((*subscribeData)["subscribe_keywords"])
|
|
subscribe_keywords = common.ObjToString((*subscribeData)["subscribe_keywords"])
|
|
subscribe_areas = common.ObjToString((*subscribeData)["subscribe_areas"])
|
|
subscribe_areas = common.ObjToString((*subscribeData)["subscribe_areas"])
|
|
}
|
|
}
|
|
-
|
|
|
|
//会员介绍页面
|
|
//会员介绍页面
|
|
start := time.Now().AddDate(0, 0, -1).Format("2006-01-02") + " 00:00:00"
|
|
start := time.Now().AddDate(0, 0, -1).Format("2006-01-02") + " 00:00:00"
|
|
end := time.Now().Format("2006-01-02") + " 00:00:00"
|
|
end := time.Now().Format("2006-01-02") + " 00:00:00"
|
|
@@ -158,7 +172,7 @@ func FormatTag(data map[string]interface{}, count int) {
|
|
}
|
|
}
|
|
if len(keyMap) > 0 {
|
|
if len(keyMap) > 0 {
|
|
keyArr := []string{}
|
|
keyArr := []string{}
|
|
- for k, _ := range keyMap {
|
|
|
|
|
|
+ for k := range keyMap {
|
|
keyArr = append(keyArr, k)
|
|
keyArr = append(keyArr, k)
|
|
}
|
|
}
|
|
keyStr = strings.Join(keyArr, ",")
|
|
keyStr = strings.Join(keyArr, ",")
|