ZxcZxc123 1 rok pred
rodič
commit
0ff44affb1
1 zmenil súbory, kde vykonal 3 pridanie a 15 odobranie
  1. 3 15
      app/admin/controller/user/User.php

+ 3 - 15
app/admin/controller/user/User.php

@@ -851,11 +851,11 @@ class User extends AuthController
             ->where('type', $type)->where('pm', 1)->where('status', 1))->sum('number');
 
         // 获取当前用户的团队长
-        $captain = getCaptain($uid); // 假设 getCaptain 方法可以获取当前用户的团队长
+        $captain = getLeader($uid); // 假设 getCaptain 方法可以获取当前用户的团队长
 
         if ($captain && $totalBrokerage > 0) {
             // 计算团队长应得佣金
-            $captainBrokerage = $totalBrokerage * 1; // 假设团队长可以获得佣金的100%
+            $captainBrokerage = $totalBrokerage * 1; // 假设团队长可以获得佣金的10%
 
             // 为团队长添加佣金记录
             $captainRecord = [
@@ -869,19 +869,7 @@ class User extends AuthController
                 'note' => '来自下级购买商品返还的佣金',
             ];
 
-            // 在事务中为团队长添加佣金记录并扣除当前用户的佣金
-            self::beginTrans();
-
-            try {
-                self::create($captainRecord);
-                self::where('uid', 'in', $uid)->where('category', $category)
-                    ->where('type', $type)->where('pm', 1)->where('status', 1)
-                    ->update(['status' => 2]);
-                self::commitTrans();
-            } catch (\Exception $e) {
-                self::rollbackTrans();
-                return self::setErrorInfo('佣金返还操作失败:' . $e->getMessage());
-            }
+
         }
 
         return $totalBrokerage;