From 7ddaa22dbeaba276edde9763994fd8c0d0017088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E5=98=89?= <445241500@qq.com> Date: Sat, 1 Jun 2024 10:21:22 +0800 Subject: [PATCH] 1 --- app/api/service/order/PaySuccess.php | 7 ++++--- app/common/model/MerchantPay.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/api/service/order/PaySuccess.php b/app/api/service/order/PaySuccess.php index 22e0da2e..4f65e11c 100644 --- a/app/api/service/order/PaySuccess.php +++ b/app/api/service/order/PaySuccess.php @@ -356,14 +356,15 @@ class PaySuccess extends BaseService //增加商户支付详情 $model = \app\store\model\Merchant::detail($orderInfo['merchant_id']); $precent = 1; + if ($model['commission_ratio']) { $precent = (1 - $model['commission_ratio'] / 1000); } - $orderInfo['pay_price'] = (float)($precent * $orderInfo['pay_price']); - (new merchantPayModel())->addDetail($orderInfo); + $precentPrice = $precent * $orderInfo['pay_price']; + (new merchantPayModel())->addDetail($orderInfo, (float)$precentPrice); //累计商户余额支付金额 - merchantModel::setIncTotal($orderInfo['merchant_id'], (float)$orderInfo['pay_price']); + merchantModel::setIncTotal($orderInfo['merchant_id'], (float)$precentPrice); } // 将第三方交易记录更新为已支付状态 if (in_array($this->method, [PaymentMethodEnum::WECHAT, PaymentMethodEnum::ALIPAY])) { diff --git a/app/common/model/MerchantPay.php b/app/common/model/MerchantPay.php index 3e04a8d0..0725e0ee 100644 --- a/app/common/model/MerchantPay.php +++ b/app/common/model/MerchantPay.php @@ -34,14 +34,14 @@ class MerchantPay extends BaseModel * @param float $money * @return mixed */ - public function addDetail($orderInfo) + public function addDetail($orderInfo, $precentPrice) { if (!empty($orderInfo['merchant_id'])) { $data = [ 'order_id' => $orderInfo['order_id'], //'store_id' => $orderInfo['store_id'], 'merchant_id' => $orderInfo['merchant_id'], - 'total_amount' => (float)$orderInfo['pay_price'], + 'total_amount' => $precentPrice, ]; return $this->save($this->createData($data)); }