feature/main20240421
郭嘉 6 months ago
parent a7340f04d0
commit 7ddaa22dbe
  1. 7
      app/api/service/order/PaySuccess.php
  2. 4
      app/common/model/MerchantPay.php

@ -356,14 +356,15 @@ class PaySuccess extends BaseService
//增加商户支付详情 //增加商户支付详情
$model = \app\store\model\Merchant::detail($orderInfo['merchant_id']); $model = \app\store\model\Merchant::detail($orderInfo['merchant_id']);
$precent = 1; $precent = 1;
if ($model['commission_ratio']) { if ($model['commission_ratio']) {
$precent = (1 - $model['commission_ratio'] / 1000); $precent = (1 - $model['commission_ratio'] / 1000);
} }
$orderInfo['pay_price'] = (float)($precent * $orderInfo['pay_price']); $precentPrice = $precent * $orderInfo['pay_price'];
(new merchantPayModel())->addDetail($orderInfo); (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])) { if (in_array($this->method, [PaymentMethodEnum::WECHAT, PaymentMethodEnum::ALIPAY])) {

@ -34,14 +34,14 @@ class MerchantPay extends BaseModel
* @param float $money * @param float $money
* @return mixed * @return mixed
*/ */
public function addDetail($orderInfo) public function addDetail($orderInfo, $precentPrice)
{ {
if (!empty($orderInfo['merchant_id'])) { if (!empty($orderInfo['merchant_id'])) {
$data = [ $data = [
'order_id' => $orderInfo['order_id'], 'order_id' => $orderInfo['order_id'],
//'store_id' => $orderInfo['store_id'], //'store_id' => $orderInfo['store_id'],
'merchant_id' => $orderInfo['merchant_id'], 'merchant_id' => $orderInfo['merchant_id'],
'total_amount' => (float)$orderInfo['pay_price'], 'total_amount' => $precentPrice,
]; ];
return $this->save($this->createData($data)); return $this->save($this->createData($data));
} }

Loading…
Cancel
Save