ljl 1 year ago
parent 7d8765e977
commit 5374b01c8c

@ -108,17 +108,17 @@ class PaymentService extends AbstractService
$platformAccount = User::getPlatformAccount(); $platformAccount = User::getPlatformAccount();
$fee = $platformAccount ? floor($order->amount * 0.01) : 0; $fee = $platformAccount ? floor($order->amount * 0.01) : 0;
$orderSplitInfos = []; $orderSplitInfos = [];
$splitUserIds = array_column($params['splitInfoList'], 'userId'); $splitUserIds = array_column($params['splitInfoList'], 'splitUserId');
$users = User::where('app_id', $app->app_id)->whereIn('user_id', $splitUserIds)->get()->keyBy('user_id'); $users = User::where('app_id', $app->app_id)->whereIn('user_id', $splitUserIds)->get()->keyBy('user_id');
foreach ($params['splitInfoList'] as $splitInfo) { foreach ($params['splitInfoList'] as $splitInfo) {
$splitUser = $users[$splitInfo['userId']]; $splitUser = $users[$splitInfo['splitUserId']];
$splitAmount = $splitInfo['sellerFlag'] == 1 ? ($splitInfo['amount'] - $fee): $splitInfo['amount']; $splitAmount = $splitInfo['sellerFlag'] == 1 ? ($splitInfo['splitAmount'] - $fee): $splitInfo['splitAmount'];
$orderSplitInfos[] = [ $orderSplitInfos[] = [
'app_id' => $app->app_id, 'app_id' => $app->app_id,
'user_id' => $user->user_id, 'user_id' => $user->user_id,
'member_id' => $user->member_id, 'member_id' => $user->member_id,
'split_member_id' => $splitUser->member_id, 'split_member_id' => $splitUser->member_id,
'split_user_id' => $splitInfo['userId'], 'split_user_id' => $splitInfo['splitUserId'],
'split_user_type' => $splitUser->user_type, 'split_user_type' => $splitUser->user_type,
'order_no' => $order->order_no, 'order_no' => $order->order_no,
'out_order_no' => $order->out_order_no, 'out_order_no' => $order->out_order_no,

Loading…
Cancel
Save