|
@@ -6,28 +6,6 @@ use Yansongda\Pay\Pay;
|
|
|
|
|
|
class WxpayController
|
|
class WxpayController
|
|
{
|
|
{
|
|
- protected $config = [
|
|
|
|
- 'appid' => 'wx089c26eaf96c3d51', // APP APPID
|
|
|
|
-// 'app_id' => 'wxb3fxxxxxxxxxxx', // 公众号 APPID
|
|
|
|
-// 'miniapp_id' => 'wxb3fxxxxxxxxxxx', // 小程序 APPID
|
|
|
|
- 'mch_id' => '1680393367',
|
|
|
|
- 'key' => 'c451cedbab8058e3502a35c6dacf0919',
|
|
|
|
- 'notify_url' => 'http://yanda.net.cn/notify.php',
|
|
|
|
- 'cert_client' => './cert/apiclient_cert.pem', // optional,退款等情况时用到
|
|
|
|
- 'cert_key' => './cert/apiclient_key.pem',// optional,退款等情况时用到
|
|
|
|
- 'log' => [ // optional
|
|
|
|
- 'file' => './logs/wechat.log',
|
|
|
|
- 'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug
|
|
|
|
- 'type' => 'single', // optional, 可选 daily.
|
|
|
|
- 'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
|
|
|
|
- ],
|
|
|
|
- 'http' => [ // optional
|
|
|
|
- 'timeout' => 5.0,
|
|
|
|
- 'connect_timeout' => 5.0,
|
|
|
|
- // 更多配置项请参考 [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
|
|
|
|
- ],
|
|
|
|
- 'mode' => 'dev', // optional, dev/hk;当为 `hk` 时,为中国香港 gateway。
|
|
|
|
- ];
|
|
|
|
|
|
|
|
public function index()
|
|
public function index()
|
|
{
|
|
{
|
|
@@ -48,7 +26,7 @@ class WxpayController
|
|
|
|
|
|
public function notify()
|
|
public function notify()
|
|
{
|
|
{
|
|
- $pay = Pay::wechat($this->config);
|
|
|
|
|
|
+ $pay = Pay::wechat($this->getConfig());
|
|
|
|
|
|
try {
|
|
try {
|
|
$data = $pay->verify(); // 是的,验签就这么简单!
|
|
$data = $pay->verify(); // 是的,验签就这么简单!
|
|
@@ -72,7 +50,7 @@ class WxpayController
|
|
'cert_key' => config_path('cert/wxpay/apiclient_key.pem'),// optional,退款等情况时用到
|
|
'cert_key' => config_path('cert/wxpay/apiclient_key.pem'),// optional,退款等情况时用到
|
|
'log' => [ // optional
|
|
'log' => [ // optional
|
|
'file' => runtime_path('logs/wechat.log'),
|
|
'file' => runtime_path('logs/wechat.log'),
|
|
- 'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug
|
|
|
|
|
|
+ 'level' => 'debug', // 建议生产环境等级调整为 info,开发环境为 debug
|
|
'type' => 'single', // optional, 可选 daily.
|
|
'type' => 'single', // optional, 可选 daily.
|
|
'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
|
|
'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
|
|
],
|
|
],
|
|
@@ -81,7 +59,7 @@ class WxpayController
|
|
'connect_timeout' => 5.0,
|
|
'connect_timeout' => 5.0,
|
|
// 更多配置项请参考 [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
|
|
// 更多配置项请参考 [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
|
|
],
|
|
],
|
|
- 'mode' => 'dev', // optional, dev/hk;当为 `hk` 时,为中国香港 gateway。
|
|
|
|
|
|
+ 'mode' => 'hk', // optional, dev/hk;当为 `hk` 时,为中国香港 gateway。
|
|
];
|
|
];
|
|
}
|
|
}
|
|
}
|
|
}
|