From 02af08f7d88681b5be110c710b05ec0ee2208710 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 20 Nov 2023 12:07:06 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=B5=B7=E4=B9=8B=E5=86=9C=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E5=85=9C=E5=BA=95=E5=AD=90=E5=95=86=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/WechatPayServiceMerchantPayController.php | 3 +++ app/common/logic/WechatPayServiceMerchantPaymentLogic.php | 3 +++ app/common/service/pay/WeChatPayMerchantService.php | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/api/controller/WechatPayServiceMerchantPayController.php b/app/api/controller/WechatPayServiceMerchantPayController.php index db84695..05dbe4f 100644 --- a/app/api/controller/WechatPayServiceMerchantPayController.php +++ b/app/api/controller/WechatPayServiceMerchantPayController.php @@ -7,6 +7,7 @@ use app\common\logic\PaymentLogic; use app\common\logic\WechatPayServiceMerchantPaymentLogic; use app\common\service\pay\WeChatPayMerchantService; use app\common\service\pay\WeChatPayService; +use think\Log; class WechatPayServiceMerchantPayController extends BaseApiController { @@ -18,6 +19,7 @@ class WechatPayServiceMerchantPayController extends BaseApiController public function appPrePay() { $params = $this->request->param(); + \think\facade\Log::info(['微信服务商APP支付接收参数', $params]); //订单信息 $order = WechatPayServiceMerchantPaymentLogic::createPayOrder($params); if (false === $order) { @@ -25,6 +27,7 @@ class WechatPayServiceMerchantPayController extends BaseApiController } //支付流程 $result = (new WeChatPayMerchantService())->wechatPayServiceMerchantAppPay($order); + if (false === $result) { return $this->fail((new WeChatPayMerchantService())->getError(), $params); } diff --git a/app/common/logic/WechatPayServiceMerchantPaymentLogic.php b/app/common/logic/WechatPayServiceMerchantPaymentLogic.php index c5e32d2..85fc19f 100644 --- a/app/common/logic/WechatPayServiceMerchantPaymentLogic.php +++ b/app/common/logic/WechatPayServiceMerchantPaymentLogic.php @@ -40,6 +40,9 @@ class WechatPayServiceMerchantPaymentLogic extends BaseLogic { // 收款账户 $subMerchant = SubMerchant::where(['street' => $params['street']])->find(); + if (empty($subMerchant)){ + $subMerchant = SubMerchant::where(['sub_merchant_name' => '泸州市海之农科技有限公司'])->find(); + } $data = [ 'order_from' => $params['order_from'], 'order_type' => $params['order_type'], diff --git a/app/common/service/pay/WeChatPayMerchantService.php b/app/common/service/pay/WeChatPayMerchantService.php index 9e8360f..f75c180 100644 --- a/app/common/service/pay/WeChatPayMerchantService.php +++ b/app/common/service/pay/WeChatPayMerchantService.php @@ -87,13 +87,14 @@ class WeChatPayMerchantService extends BasePayService 'out_trade_no' => $order['order_no'], 'notify_url' => $this->config['notify_url'], 'amount' => [ - 'total' => intval($order['total_fee']), + 'total' => intval(bcmul($order['total_fee'], 100,2 )), 'currency' => 'CNY' ], 'attach' => $order['order_no'], ]); $result = $response->toArray(false); + \think\facade\Log::info(['微信服务商APP支付api-微信支付返回值', $result]); $this->checkResultFail($result); $re = $this->app->getUtils()->buildAppConfig($result['prepay_id'], $pay['config']['app_id']); $re['partnerid'] = $order['collection_account'];