|
|
@@ -386,16 +386,19 @@ class AgentLevelTaskServices extends BaseServices
|
|
|
if ($levels) {
|
|
|
/** @var UserServices $userServices */
|
|
|
$userServices = app()->make(UserServices::class);
|
|
|
- $spread_uids = $userServices->getColumn(['spread_uid' => $uid], 'uid');
|
|
|
- if ($spread_uids) {
|
|
|
- // 递归获取所有下级用户的uid
|
|
|
- $allSpreadUids = [];
|
|
|
- $this->getAllSpreadUids($spread_uids, $allSpreadUids);
|
|
|
- if ($allSpreadUids) {
|
|
|
- $userNumber = $userServices->count([['uid', 'in', $allSpreadUids], ['agent_level', 'in', $levels]]);
|
|
|
- @file_put_contents("quanju.txt", $userNumber . "下级达到V2等级的人数\r\n", 8);
|
|
|
-
|
|
|
+ // 获取直推下级的分销等级ID
|
|
|
+ $directSpreadInfo = $userServices->getColumn(['spread_uid' => $uid], 'uid,agent_level');
|
|
|
+ if ($directSpreadInfo) {
|
|
|
+ $count = 0;
|
|
|
+ foreach ($directSpreadInfo as $info) {
|
|
|
+ // 判断直推下级的分销等级ID是否在V2等级列表中
|
|
|
+ if ($info['agent_level'] && in_array($info['agent_level'], $levels)) {
|
|
|
+ $count++;
|
|
|
+ }
|
|
|
}
|
|
|
+ $userNumber = $count;
|
|
|
+ @file_put_contents("quanju.txt", $userNumber . "直推下级达到V2等级的人数\r\n", 8);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
break;
|