修改微信支付回调地址

This commit is contained in:
wucongxing 2023-05-13 17:16:45 +08:00
parent 3a07b79c4a
commit 8695a48d51
2 changed files with 23 additions and 4 deletions

View File

@ -24,9 +24,20 @@ if ($appEnv == 'dev') {
], ],
]; ];
}else{ }else{
// $formatter = [
// 'class' => Monolog\Formatter\JsonFormatter::class,
// 'constructor' => [],
// ];
// 暂时修改为正式
$formatter = [ $formatter = [
'class' => Monolog\Formatter\JsonFormatter::class, 'class' => Monolog\Formatter\LineFormatter::class,
'constructor' => [], 'constructor' => [
'format' => null,
'dateFormat' => 'Y-m-d H:i:s',
'allowInlineLineBreaks' => true,
'includeStacktraces' => true,
],
]; ];
} }
return [ return [

View File

@ -23,6 +23,7 @@ class WechatPay
protected array $pay_config;// 支付系统配置 protected array $pay_config;// 支付系统配置
protected string $pay_notify_url;// 支付回调地址 protected string $pay_notify_url;// 支付回调地址
protected string $refund_notify_url;// 退款回调地址 protected string $refund_notify_url;// 退款回调地址
protected string $domain_name;// 退款网址
/** /**
* @param string $user_type 用户类型1患者端 2:专家端 3:药师端) * @param string $user_type 用户类型1患者端 2:专家端 3:药师端)
@ -57,6 +58,13 @@ class WechatPay
$this->pay_notify_url = $this->config['product_pay_notify_url']; $this->pay_notify_url = $this->config['product_pay_notify_url'];
$this->refund_notify_url = $this->config['product_refund_notify_url']; $this->refund_notify_url = $this->config['product_refund_notify_url'];
} }
$app_env = config('app_env','dev');
if ($app_env == "prod"){
$this->domain_name = env('DOMAIN_NAME_DEV','https://dev.hospital.applets.igandanyiyuan.com/');
}else{
$this->domain_name = env('DOMAIN_NAME_PROD','https://prod.hospital.applets.igandanyiyuan.com/');
}
} }
/** /**
@ -126,7 +134,7 @@ class WechatPay
"out_trade_no" => $out_trade_no, // 商户系统内部订单号 "out_trade_no" => $out_trade_no, // 商户系统内部订单号
"appid" => $this->config['app_id'], "appid" => $this->config['app_id'],
"description" => "问诊服务", "description" => "问诊服务",
"notify_url" => env('DOMAIN_NAME_DEV') . $this->pay_notify_url, "notify_url" => $this->domain_name . $this->pay_notify_url,
"amount" => [ "amount" => [
"total" => $total,//订单总金额,单位为分。 "total" => $total,//订单总金额,单位为分。
"currency" => "CNY" "currency" => "CNY"
@ -195,7 +203,7 @@ class WechatPay
try { try {
$app = $this->createApp(); $app = $this->createApp();
$options['notify_url'] = env('DOMAIN_NAME_DEV') . $this->refund_notify_url; $options['notify_url'] = $this->domain_name . $this->refund_notify_url;
$response = $app->getClient()->postJson("v3/refund/domestic/refunds", $options); $response = $app->getClient()->postJson("v3/refund/domestic/refunds", $options);
if ($response->isFailed()) { if ($response->isFailed()) {