|
@@ -115,10 +115,13 @@ func VisitInfoAdd(start, end int64) {
|
|
|
if config.JianyuSubjectdb.CountBySql(`select count(1) from dwd_f_userbase_visit_info where userid = ? and createtime>= ? and createtime <?`, userid, starttime, endtime) > 0 {
|
|
|
if contentnum != 0 {
|
|
|
config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set number = number+1,contentnum = contentnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
+ //config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set contentnum = contentnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
} else if portraitnum != 0 {
|
|
|
- config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set number = number+1,portraitnum = contentnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
+ config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set number = number+1,portraitnum = portraitnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
+ //config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set portraitnum = portraitnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
} else if searchnum != 0 {
|
|
|
- config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set number = number+1,searchnum = contentnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
+ config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set number = number+1,searchnum = searchnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
+ //config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set searchnum = searchnum + 1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
} else {
|
|
|
config.JianyuSubjectdb.UpdateOrDeleteBySql(`update dwd_f_userbase_visit_info set number = number+1,date =?,platform=? where userid = ? and createtime>= ? and createtime <?`, craetetimeStr, platform, userid, starttime, endtime)
|
|
|
}
|
|
@@ -256,6 +259,7 @@ func CountMaxVisit() {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+ mData = make(map[string]*UserVisit)
|
|
|
}
|
|
|
|
|
|
// @Author jianghan
|
|
@@ -311,8 +315,8 @@ func Count3DaysSearch() {
|
|
|
countSql = "SELECT COUNT(v.id) FROM dwd_f_userbase_search_info v WHERE DATE(v.search_time) BETWEEN DATE(NOW() - INTERVAL 3 DAY) AND DATE(NOW())"
|
|
|
} else {
|
|
|
aTime := time.Now().Add(-1 * time.Hour)
|
|
|
- sql = "SELECT v.userid, b.uid, v.search_time FROM dwd_f_userbase_search_info v LEFT JOIN dwd_f_userbase_baseinfo b ON v.userid = b.userid WHERE v.search_time >= " + aTime.Format(time.DateTime) + " ORDER BY v.date ASC"
|
|
|
- countSql = "SELECT COUNT(v.id) FROM dwd_f_userbase_search_info v WHERE v.search_time >= " + aTime.Format(time.DateTime)
|
|
|
+ sql = fmt.Sprintf("SELECT v.userid, b.uid, v.search_time FROM dwd_f_userbase_search_info v LEFT JOIN dwd_f_userbase_baseinfo b ON v.userid = b.userid WHERE v.search_time >= '%s' ORDER BY v.date ASC", aTime.Format(time.DateTime))
|
|
|
+ countSql = fmt.Sprintf("SELECT COUNT(v.id) FROM dwd_f_userbase_search_info v WHERE v.search_time >= '%s'", aTime.Format(time.DateTime))
|
|
|
}
|
|
|
total = config.JianyuSubjectdb.CountBySql(countSql)
|
|
|
log.Println("Count3DaysSearch total---", total)
|
|
@@ -364,6 +368,7 @@ func Count3DaysSearch() {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+ mSearchMap = make(map[string]int)
|
|
|
}
|
|
|
|
|
|
func Count3DaysDetail() {
|
|
@@ -391,8 +396,8 @@ func Count3DaysDetail() {
|
|
|
countSql = "SELECT COUNT(v.id) FROM dwd_f_userbase_visit_info v WHERE DATE(date) BETWEEN DATE(NOW() - INTERVAL 3 DAY) AND DATE(NOW())"
|
|
|
} else {
|
|
|
aTime := time.Now().Add(-1 * time.Hour)
|
|
|
- sql = "SELECT v.userid, b.uid, v.date, v.contentnum FROM dwd_f_userbase_visit_info v LEFT JOIN dwd_f_userbase_baseinfo b ON v.userid = b.userid WHERE v.date >= " + aTime.Format(time.DateTime) + " ORDER BY v.date ASC"
|
|
|
- countSql = "SELECT COUNT(v.id) FROM dwd_f_userbase_visit_info v WHERE v.date >= " + aTime.Format(time.DateTime)
|
|
|
+ sql = fmt.Sprintf("SELECT v.userid, b.uid, v.date, v.contentnum FROM dwd_f_userbase_visit_info v LEFT JOIN dwd_f_userbase_baseinfo b ON v.userid = b.userid WHERE v.date >= '%s' ORDER BY v.date ASC", aTime.Format(time.DateTime))
|
|
|
+ countSql = fmt.Sprintf("SELECT COUNT(v.id) FROM dwd_f_userbase_visit_info v WHERE v.date >= '%s'", aTime.Format(time.DateTime))
|
|
|
}
|
|
|
total = config.JianyuSubjectdb.CountBySql(countSql)
|
|
|
log.Println("Count3DaysDetail total---", total)
|
|
@@ -445,6 +450,7 @@ func Count3DaysDetail() {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+ mDetailMap = make(map[string]int)
|
|
|
}
|
|
|
|
|
|
func VipExpire() {
|
|
@@ -460,8 +466,8 @@ func VipExpire() {
|
|
|
config.JianyuSubjectdb.ExecBySql("update dwd_f_crm_attribute_label set supersub = 0 where supersub = 1")
|
|
|
config.JianyuSubjectdb.ExecBySql("update dwd_f_crm_attribute_label set areasubpkg = 0 where areasubpkg = 1")
|
|
|
|
|
|
- sql = fmt.Sprintf("select uid, product_type from dwd_f_data_equity_info WHERE product_type = '省份订阅包' or product_type = '超级订阅' AND endtime > %s", now.Format(date.Date_Short_Layout))
|
|
|
- countSql = fmt.Sprintf("select count(id) from dwd_f_data_equity_info WHERE product_type = '省份订阅包' or product_type = '超级订阅' AND endtime > %s", now.Format(date.Date_Short_Layout))
|
|
|
+ sql = fmt.Sprintf("select uid, product_type from dwd_f_data_equity_info WHERE product_type = '省份订阅包' or product_type = '超级订阅' AND endtime > '%s'", now.Format(date.Date_Short_Layout))
|
|
|
+ countSql = fmt.Sprintf("select count(id) from dwd_f_data_equity_info WHERE product_type = '省份订阅包' or product_type = '超级订阅' AND endtime > '%s'", now.Format(date.Date_Short_Layout))
|
|
|
|
|
|
total = config.JianyuSubjectdb.CountBySql(countSql)
|
|
|
log.Println("VipExpire total---", total)
|
|
@@ -493,7 +499,7 @@ func VipExpire() {
|
|
|
}
|
|
|
}
|
|
|
count++
|
|
|
- if count%2000 == 0 {
|
|
|
+ if count%5000 == 0 {
|
|
|
log.Println("VipExpire current-------", count)
|
|
|
}
|
|
|
|