Bladeren bron

升级

master
huangjiajun 6 dagen geleden
bovenliggende
commit
734810ae15
2 gewijzigde bestanden met toevoegingen van 22 en 0 verwijderingen
  1. +3
    -0
      enum/user_level_task.go
  2. +19
    -0
      rule/user_upgrade.go

+ 3
- 0
enum/user_level_task.go Bestand weergeven

@@ -7,6 +7,7 @@ const (
DirectPushMembersNum UserLevelTaskType = iota + 1
DirectPushActiveDayNum
DirectPushLevel
DirectPushMembersNumActivity
)

func (kind UserLevelTaskType) String() string {
@@ -17,6 +18,8 @@ func (kind UserLevelTaskType) String() string {
return "直推会员活跃天数"
case DirectPushLevel:
return "直推会员等级"
case DirectPushMembersNumActivity:
return "直推会员有效活跃人数"
default:
return "未知状态"
}


+ 19
- 0
rule/user_upgrade.go Bestand weergeven

@@ -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))

}

Laden…
Annuleren
Opslaan