|
@@ -845,37 +845,6 @@ class User extends AuthController
|
|
|
|
|
|
|
|
|
|
|
|
- public static function getBrokerage($uid, $category = 'now_money', $type = 'brokerage', $where)
|
|
|
- {
|
|
|
- $totalBrokerage = self::getModelTime($where, self::where('uid', 'in', $uid)->where('category', $category)
|
|
|
- ->where('type', $type)->where('pm', 1)->where('status', 1))->sum('number');
|
|
|
-
|
|
|
- // 获取当前用户的团队长
|
|
|
- $captain = getLeader($uid); // 假设 getCaptain 方法可以获取当前用户的团队长
|
|
|
-
|
|
|
- if ($captain && $totalBrokerage > 0) {
|
|
|
- // 计算团队长应得佣金
|
|
|
- $captainBrokerage = $totalBrokerage * 1; // 假设团队长可以获得佣金的10%
|
|
|
-
|
|
|
- // 为团队长添加佣金记录
|
|
|
- $captainRecord = [
|
|
|
- 'uid' => $captain,
|
|
|
- 'type' => $type,
|
|
|
- 'category' => $category,
|
|
|
- 'pm' => 1,
|
|
|
- 'status' => 1,
|
|
|
- 'number' => $captainBrokerage,
|
|
|
- 'balance' => $captainBrokerage,
|
|
|
- 'note' => '来自下级购买商品返还的佣金',
|
|
|
- ];
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return $totalBrokerage;
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|