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:
mac
2026-03-24 23:27:55 +08:00
parent 451918bc73
commit d0cd7e4667
8 changed files with 73 additions and 27 deletions

View File

@@ -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;
}
/**
* 手动设置会员等级(管理后台使用)
*