Files
code-bang/backend/application/extra/common.php
T

30 lines
1.6 KiB
PHP
Raw Normal View History

2026-09-17 16:25:31 +08:00
<?php
use think\Env;
return [
'oss' => [
'access_key_id' => Env::get('oss.ACCESS_ID'),
'access_key_secret' => Env::get('oss.ACCESS_KEY'),
'endpoint' => Env::get('oss.ENDPOINT'),
'bucket' => Env::get('oss.BUCKET'),
'domain' => 'https://' . Env::get('oss.BUCKET') . '.oss-cn-shenzhen.aliyuncs.com/',
],
'wechat' => [
2026-09-21 14:57:50 +08:00
// 小程序
'app_id' => Env::get('wechat.app_id'),
'secret' => Env::get('wechat.app_secret'),
// 微信支付 v3 (EasyWeChat 6.x)
'mch_id' => Env::get('wechat.mch_id'), // 商户号
'secret_key' => Env::get('wechat.mch_secret_key'), // APIv3 密钥(商户平台-账户中心-API安全)
'v2_secret_key' => Env::get('wechat.api_key'), // 旧 v2 API 密钥(兼容 v2 模式回调解密)
// 商户 API 证书(商户平台-账户中心-API安全 下载, v2/v3 共用同一套)
'private_key' => APP_PATH . 'extra/cert/apiclient_key.pem', // 商户证书私钥 绝对路径
'certificate' => APP_PATH . 'extra/cert/apiclient_cert.pem', // 商户API证书 绝对路径
2026-09-22 11:16:56 +08:00
// 微信支付公钥模式(2024Q3+ 推荐): 公钥ID以 PUB_KEY_ID_ 开头, 公钥文件存放于 extra/cert/pub_key.pem
2026-09-21 14:57:50 +08:00
// 两者都配置后无需再下载平台证书
2026-09-22 11:16:56 +08:00
'platform_certs' => (Env::get('wechat.pub_key_id') && is_file(APP_PATH . 'extra/cert/pub_key.pem'))
? [Env::get('wechat.pub_key_id') => APP_PATH . 'extra/cert/pub_key.pem']
2026-09-21 14:57:50 +08:00
: [],
// 支付结果通知地址(也可在下单时单独覆盖)
'notify_url' => Env::get('app.url') . '/api/order/payNotify',
2026-09-17 16:25:31 +08:00
],
];