diff --git a/app/api/controller/ShopCallController.php b/app/api/controller/ShopCallController.php index 108a5136..bdbb52cb 100644 --- a/app/api/controller/ShopCallController.php +++ b/app/api/controller/ShopCallController.php @@ -51,13 +51,7 @@ class ShopCallController extends BaseApiController if ($userSelf->isEmpty()) { return $this->fail('推广人不存在'); } - $proportion = 0.03; - // 计算分润 - UserLogic::userProfit($userSelf, $orderMoney, $proportion, $orderNo); - - // 首单金额记录 - UserLogic::firstOrderLog($userSelf['id'], $orderMoney, $orderNo); - + $type = 0; if (in_array($userSelf['group_id'] , [2, 18])) { $type = 1; } @@ -67,6 +61,17 @@ class ShopCallController extends BaseApiController if ($userSelf['group_id'] == 15) { $type = 3; } + if($type === 0) { + return $this->fail('推广人不属于分佣角色'); + } + + $proportion = 0.03; + // 计算分润 + UserLogic::userProfit($userSelf, $orderMoney, $proportion, $orderNo); + + // 首单金额记录 + UserLogic::firstOrderLog($userSelf['id'], $orderMoney, $orderNo); + // 通知商城 $request['user'] = [ ['type' => $type, 'account' => $userSelf['account'], 'user_profit' => bcmul($orderMoney, 0.03)]