update 海之农作为兜底子商户

This commit is contained in:
chenbo 2023-11-20 12:07:06 +08:00
parent 93a43d24a6
commit 02af08f7d8
3 changed files with 8 additions and 1 deletions

View File

@ -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);
}

View File

@ -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'],

View File

@ -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'];