|
|
@@ -99,6 +99,12 @@ func UserUpgradeTask(eg *xorm.Engine, uid, lv int) ([]map[string]string, error) |
|
|
|
isSuccess = 1 |
|
|
|
} |
|
|
|
break |
|
|
|
case 4: //直推会员活跃 |
|
|
|
count = ExtendUserCountActivity(eg, uid, v.WithinDays, v.ActiveDays, v.FinishCount) |
|
|
|
if count >= int64(v.FinishCount) { |
|
|
|
isSuccess = 1 |
|
|
|
} |
|
|
|
break |
|
|
|
} |
|
|
|
tmp := map[string]string{ |
|
|
|
"id": utils.IntToStr(v.Id), |
|
|
@@ -161,3 +167,16 @@ func ExtendUserCountWithDay(eg *xorm.Engine, uid, day, activityDay int) int64 { |
|
|
|
} |
|
|
|
return num |
|
|
|
} |
|
|
|
|
|
|
|
// 直推人数 |
|
|
|
func ExtendUserCountActivity(eg *xorm.Engine, uid, day, activityNum, finishCount int) int64 { |
|
|
|
today := utils.GetTimeRange("today") |
|
|
|
times := today["start"] - int64(day*86400) |
|
|
|
sql := `SELECT COUNT(*) as count,u.id FROM user u |
|
|
|
LEFT JOIN egg_sign_in esi on esi.uid=u.id |
|
|
|
WHERE esi.start_time>='%s' and u.parent_uid=%d GROUP BY u.id HAVING count>=%d LIMIT %d` |
|
|
|
sql = fmt.Sprintf(sql, time.Unix(times, 0).Format("2006-01-02 15:04:05"), uid, activityNum, finishCount) |
|
|
|
nativeString, _ := db.QueryNativeString(eg, sql) |
|
|
|
return int64(len(nativeString)) |
|
|
|
|
|
|
|
} |