@@ -65,9 +65,9 @@ func ExtendCount(engine *xorm.Engine, uid interface{}, task map[string]string, t | |||||
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | ||||
etime := t.Format("2006-1-02 15:04:05") | etime := t.Format("2006-1-02 15:04:05") | ||||
sqlTpl := `SELECT count(*) as count | sqlTpl := `SELECT count(*) as count | ||||
FROM user_profile as up | |||||
FROM user_relate as up | |||||
LEFT JOIN user as u ON u.uid=up.uid | LEFT JOIN user as u ON u.uid=up.uid | ||||
WHERE %s;` | |||||
WHERE %s and up.level=1;` | |||||
condStr := fmt.Sprintf("up.parent_uid=%s AND u.create_at>'%s' AND u.create_at<'%s'", zhios_condition_statistics_utils.AnyToString(uid), stime, etime) | condStr := fmt.Sprintf("up.parent_uid=%s AND u.create_at>'%s' AND u.create_at<'%s'", zhios_condition_statistics_utils.AnyToString(uid), stime, etime) | ||||
sql := fmt.Sprintf(sqlTpl, condStr) | sql := fmt.Sprintf(sqlTpl, condStr) | ||||
results, err := db.QueryNativeString(engine, sql) | results, err := db.QueryNativeString(engine, sql) | ||||
@@ -87,10 +87,11 @@ func TeamCount(engine *xorm.Engine, uid interface{}, task map[string]string, t t | |||||
stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | stime := time.Date(t.Year(), t.Month(), t.Day()-zhios_condition_statistics_utils.StrToInt(task["within_days"]), t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | ||||
etime := t.Format("2006-1-02 15:04:05") | etime := t.Format("2006-1-02 15:04:05") | ||||
sqlTpl := `SELECT count(*) as count | sqlTpl := `SELECT count(*) as count | ||||
FROM user_profile as up | |||||
FROM user_relate as up | |||||
LEFT JOIN user as u ON u.uid=up.uid | LEFT JOIN user as u ON u.uid=up.uid | ||||
WHERE %s;` | |||||
condStr := fmt.Sprintf("up.parent_uid=%s AND u.create_at>'%s' AND u.create_at<'%s' and up.is_verify=%d", zhios_condition_statistics_utils.AnyToString(uid), stime, etime, 1) | |||||
LEFT JOIN user_profile as ups ON up.uid=ups.uid | |||||
WHERE %s and up.level=1;` | |||||
condStr := fmt.Sprintf("up.parent_uid=%s AND u.create_at>'%s' AND u.create_at<'%s' and ups.is_verify=%d", zhios_condition_statistics_utils.AnyToString(uid), stime, etime, 1) | |||||
sql := fmt.Sprintf(sqlTpl, condStr) | sql := fmt.Sprintf(sqlTpl, condStr) | ||||
results, err := db.QueryNativeString(engine, sql) | results, err := db.QueryNativeString(engine, sql) | ||||
if err != nil { | if err != nil { | ||||
@@ -457,9 +457,9 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | ||||
etime := t.Format("2006-1-02 15:04:05") | etime := t.Format("2006-1-02 15:04:05") | ||||
sqlTpl := `SELECT count(*) as count | sqlTpl := `SELECT count(*) as count | ||||
FROM user_profile as up | |||||
FROM user_relate as up | |||||
LEFT JOIN user as u ON u.uid=up.uid | LEFT JOIN user as u ON u.uid=up.uid | ||||
WHERE %s;` | |||||
WHERE %s and up.level=1;` | |||||
var condStr string | var condStr string | ||||
if task.WithinDays <= 0 { | if task.WithinDays <= 0 { | ||||
condStr = fmt.Sprintf("up.parent_uid=%s ", zhios_condition_statistics_utils.AnyToString(uid)) | condStr = fmt.Sprintf("up.parent_uid=%s ", zhios_condition_statistics_utils.AnyToString(uid)) | ||||
@@ -481,15 +481,16 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, | |||||
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()).Format("2006-1-02 15:04:05") | ||||
etime := t.Format("2006-1-02 15:04:05") | etime := t.Format("2006-1-02 15:04:05") | ||||
sqlTpl := `SELECT count(*) as count | sqlTpl := `SELECT count(*) as count | ||||
FROM user_profile as up | |||||
FROM user_relate as up | |||||
LEFT JOIN user as u ON u.uid=up.uid | LEFT JOIN user as u ON u.uid=up.uid | ||||
WHERE %s;` | |||||
LEFT JOIN user_profile as ups ON up.uid=ups.uid | |||||
WHERE %s and up.level=1;` | |||||
var condStr string | var condStr string | ||||
if task.WithinDays <= 0 { | if task.WithinDays <= 0 { | ||||
condStr = fmt.Sprintf("up.parent_uid=%s and up.is_verify=%d", zhios_condition_statistics_utils.AnyToString(uid), 1) | |||||
condStr = fmt.Sprintf("up.parent_uid=%s and ups.is_verify=%d", zhios_condition_statistics_utils.AnyToString(uid), 1) | |||||
} else { | } else { | ||||
condStr = fmt.Sprintf("up.parent_uid=%s AND u.create_at>'%s' AND u.create_at<'%s' and up.is_verify=%d", zhios_condition_statistics_utils.AnyToString(uid), stime, etime, 1) | |||||
condStr = fmt.Sprintf("up.parent_uid=%s AND u.create_at>'%s' AND u.create_at<'%s' and ups.is_verify=%d", zhios_condition_statistics_utils.AnyToString(uid), stime, etime, 1) | |||||
} | } | ||||
sql := fmt.Sprintf(sqlTpl, condStr) | sql := fmt.Sprintf(sqlTpl, condStr) | ||||
results, err := db.QueryNativeString(engine, sql) | results, err := db.QueryNativeString(engine, sql) | ||||