fix(fsgx): 伞下人数与待释放积分发放链路
- spread/people 增加 umbrellaCount、umbrellaOrderCount;MemberLevelServices 递归统计伞下人数 - 佣金记录页使用新字段展示团队业绩 - 报单积分改由 HjfOrderPayJob 在等级升级后发放,避免 grade=0 时序问题 - PointsRewardServices::reward 按 points_release_log 幂等防重复 - 移除 backOrderBrokerage 内同步 grantFrozenPointsByBrokerage Made-with: Cursor
This commit is contained in:
@@ -111,6 +111,32 @@ class MemberLevelServices extends BaseServices
|
||||
return $this->agentLevelTaskServices->getUmbrellaQueueOrderCount($uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归统计伞下总人数(DFS,最大深度 8 层,不含本人)
|
||||
*/
|
||||
public function getUmbrellaMemberCount(int $uid, int $maxDepth = 8): int
|
||||
{
|
||||
return $this->recursiveUmbrellaMemberCount($uid, $maxDepth);
|
||||
}
|
||||
|
||||
private function recursiveUmbrellaMemberCount(int $uid, int $remainDepth): int
|
||||
{
|
||||
if ($remainDepth <= 0) {
|
||||
return 0;
|
||||
}
|
||||
$children = Db::name('user')
|
||||
->where('spread_uid', $uid)
|
||||
->column('uid');
|
||||
if (empty($children)) {
|
||||
return 0;
|
||||
}
|
||||
$count = count($children);
|
||||
foreach ($children as $childUid) {
|
||||
$count += $this->recursiveUmbrellaMemberCount((int)$childUid, $remainDepth - 1);
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动设置会员等级(管理后台使用)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user