|
|
@@ -4,6 +4,7 @@
|
|
|
namespace app\api\service;
|
|
|
|
|
|
|
|
|
+use think\Env;
|
|
|
use WeChatPay\Builder;
|
|
|
use WeChatPay\Crypto\Rsa;
|
|
|
use WeChatPay\Formatter;
|
|
|
@@ -15,33 +16,33 @@ class WxService extends BaseService
|
|
|
private static function wxAppConfig()
|
|
|
{
|
|
|
return array_merge([
|
|
|
- "appid" => config("site.wx_app_appid") ?? "",
|
|
|
- "app_secret" => config("site.wx_app_secret") ?? "",
|
|
|
+ "appid" => Env::get("wxpay.wx_app_appid") ?? "",
|
|
|
+ "app_secret" => Env::get("wxpay.wx_app_secret") ?? "",
|
|
|
], WxService::wxMchConfig());
|
|
|
}
|
|
|
|
|
|
private static function wxWebConfig()
|
|
|
{
|
|
|
return array_merge([
|
|
|
- "appid" => config("site.wx_h5_appid") ?? "",
|
|
|
- "app_secret" => config("site.wx_h5_secret") ?? "",
|
|
|
+ "appid" => Env::get("wxpay.wx_h5_appid") ?? "",
|
|
|
+ "app_secret" => Env::get("wxpay.wx_h5_secret") ?? "",
|
|
|
], WxService::wxMchConfig());
|
|
|
}
|
|
|
|
|
|
private static function wxAppletConfig()
|
|
|
{
|
|
|
return array_merge([
|
|
|
- "appid" => config("site.wx_applet_appid") ?? "",
|
|
|
- "app_secret" => config("site.wx_applet_secret") ?? "",
|
|
|
+ "appid" => Env::get("wxpay.wx_applet_appid") ?? "",
|
|
|
+ "app_secret" => Env::get("wxpay.wx_applet_secret") ?? "",
|
|
|
], WxService::wxMchConfig());
|
|
|
}
|
|
|
|
|
|
private static function wxMchConfig()
|
|
|
{
|
|
|
return [
|
|
|
- "mch_id" => config("site.wx_mch_id") ?? "",
|
|
|
- "mch_v3_api" => config("site.wx_mch_v3_api") ?? "",
|
|
|
- "mch_certificate_serial" => config("site.wx_mch_certificate_serial") ?? "",
|
|
|
+ "mch_id" => Env::get("wxpay.wx_mch_id") ?? "",
|
|
|
+ "mch_v3_api" => Env::get("wxpay.wx_mch_v3_api") ?? "",
|
|
|
+ "mch_certificate_serial" => Env::get("site.wx_mch_certificate_serial") ?? "",
|
|
|
"mch_private_key_file_path" => ROOT_PATH . "certificate" . DS . "wx" . DS . "apiclient_key.pem",
|
|
|
"platform_certificate_file_path" => ROOT_PATH . "certificate" . DS . "wx" . DS . "apiclient_cert.pem"
|
|
|
];
|
|
|
@@ -210,7 +211,7 @@ class WxService extends BaseService
|
|
|
'notify_url' => "https://pbbaby.xunsoftware.com/api.php/api/callback/wxrefund",
|
|
|
'amount' => [
|
|
|
'refund' => fixed2Float($refund_amount * 100),
|
|
|
- "total" => fixed2Float($total_amount * 100),
|
|
|
+ 'total' => fixed2Float($total_amount * 100),
|
|
|
'currency' => 'CNY'
|
|
|
],
|
|
|
];
|