diff --git a/app/Service/PaymentService.php b/app/Service/PaymentService.php index e9dd773..0314c91 100644 --- a/app/Service/PaymentService.php +++ b/app/Service/PaymentService.php @@ -134,6 +134,9 @@ class PaymentService extends AbstractService } public function createOrder(App $app, array $params, User $user, string $payMethod) { + if ($params['amount'] < 10) { + throw new BusinessException('金额不能小于10'); + } $expiresIn = $params['expiresIn'] ?? 10 * 60; $order = new Order(); $order->app_id = $app->app_id; @@ -159,6 +162,9 @@ class PaymentService extends AbstractService $platformAccount = User::getPlatformAccount(); $fee = $platformAccount ? floor($order->amount * 0.007) : 0; + if ($fee <= 0) { + $fee = 1; + } $orderSplitInfos = []; $splitUserIds = array_column($params['splitInfoList'], 'splitUserId'); $users = User::where('app_id', $app->app_id)->whereIn('user_id', $splitUserIds)->get()->keyBy('user_id');