diff --git a/app/Controller/Payment/AccountController.php b/app/Controller/Payment/AccountController.php index 50304a7..fb69ea0 100644 --- a/app/Controller/Payment/AccountController.php +++ b/app/Controller/Payment/AccountController.php @@ -162,13 +162,8 @@ class AccountController extends AbstractController 'remark' => 'test', ], 'splitInfoList' => [ - [ - 'splitUserId' => 'RLX1990', - 'sellerFlag' => 1, - 'splitAmount' => 1, - 'subOutOrderNo' => time() . rand(1000, 9999), - ] - ] + ], + 'isAccountPay' => true ]); $acsNo = $this->paymentService->transferPay($requestLog->getData(), $requestLog->app, $requestLog->request_token); return $this->success(['acsNo' => $acsNo, 'outOrderNo' => $outOrderNo]); diff --git a/app/Model/User.php b/app/Model/User.php index 13248f4..8dbd5da 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -8,7 +8,10 @@ class User extends Model { protected $table = 'users'; - public static function getPlatformAccount() { + public static function getPlatformAccount($isAccountPay) { + if ($isAccountPay) { + return self::where('user_id', 'CWX1989')->first(); + } return self::where('is_platform_account', 1)->first(); } } \ No newline at end of file diff --git a/app/Service/PaymentService.php b/app/Service/PaymentService.php index a1f0684..1d80805 100644 --- a/app/Service/PaymentService.php +++ b/app/Service/PaymentService.php @@ -211,9 +211,9 @@ class PaymentService extends AbstractService $order->remark = $params['remark'] ?? ''; $order->save(); - $platformAccount = User::getPlatformAccount(); + $platformAccount = User::getPlatformAccount($params['isAccountPay']); $feeRate = 0.007; - if ($user->source == 1) { + if ($params['isAccountPay']) { $feeRate = 0.0023; } $fee = $platformAccount ? floor($order->amount * $feeRate) : 0; @@ -263,6 +263,25 @@ class PaymentService extends AbstractService 'seller_flag' => 0, ]; } + if ($params['isAccountPay']) { + $feeSubOrderNo = StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_PAY_SPLIT); + $mainAccount = User::where('user_id', 'RLX1990')->first(); + $orderSplitInfos[] = [ + 'app_id' => $app->app_id, + 'user_id' => $user->user_id, + 'member_id' => $user->member_id, + 'split_member_id' => $mainAccount->member_id, + 'split_user_id' => $mainAccount->user_id, + 'split_user_type' => $mainAccount->user_type, + 'order_no' => $order->order_no, + 'out_order_no' => $order->out_order_no, + 'sub_order_no' => $feeSubOrderNo, + 'sub_out_order_no' => $feeSubOrderNo, + 'split_amount' => $order->amount - $fee, + 'contract_no' => $platformAccount->contract_no, + 'seller_flag' => 0, + ]; + } OrderSplitInfo::insert($orderSplitInfos); return [$order, $orderSplitInfos]; }