修正支付回调配置参数

This commit is contained in:
2023-03-06 16:59:51 +08:00
parent d4707488b6
commit fe62ed8614
5 changed files with 73 additions and 15 deletions
+8 -2
View File
@@ -6,6 +6,7 @@ use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use EasyWeChat\OfficialAccount\Message;
use EasyWeChat\Pay\Application;
use Hyperf\Utils\ApplicationContext;
use Psr\SimpleCache\CacheInterface;
@@ -16,6 +17,7 @@ use Psr\SimpleCache\CacheInterface;
class WechatPay
{
protected array $config;// 系统配置
protected array $pay_config;// 支付系统配置
/**
* @param string $user_type
@@ -30,6 +32,8 @@ class WechatPay
$this->config = config("we_chat.applets.pharmacist");
}
$this->pay_config = config("we_chat.applets.pay");
if (empty($this->config)){
throw new BusinessException("系统配置错误", HttpEnumCode::SERVER_ERROR);
}
@@ -91,11 +95,11 @@ class WechatPay
$app = $this->createApp();
$options = [
"mchid" => config("we_chat.pay.mch_id"), // <---- 商户号
"mchid" => $this->pay_config['mch_id'], // <---- 商户号
"out_trade_no" => $out_trade_no, // 商户系统内部订单号
"appid" => $this->config['app_id'],
"description" => "问诊服务",
"notify_url" => "https://dev.hospital.applets.igandanyiyuan.com/callback/pay/wx",
"notify_url" => env('DOMAIN_NAME_DEV') . $this->config['notify_url'],
"amount" => [
"total" => $total,//订单总金额,单位为分。
"currency" => "CNY"
@@ -151,4 +155,6 @@ class WechatPay
throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR);
}
}
}