| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | 
							- <?php
 
- namespace app\api\controller\pay;
 
- use Yansongda\Pay\Pay;
 
- class WxpayController
 
- {
 
-     public function index()
 
-     {
 
-         $order = [
 
-             'out_trade_no' => time(),
 
-             'body' => 'subject-测试',
 
-             'total_fee' => '1',
 
-         ];
 
-         return Pay::wechat($this->getConfig())->app($order);
 
-         // $pay->appId
 
-         // $pay->timeStamp
 
-         // $pay->nonceStr
 
-         // $pay->package
 
-         // $pay->signType
 
-     }
 
-     public function notify()
 
-     {
 
-         $pay = Pay::wechat($this->getConfig());
 
-         try {
 
-             $data = $pay->verify(); // 是的,验签就这么简单!
 
-             Log::debug('Wechat notify', $data->all());
 
-         } catch (\Exception $e) {
 
-             // $e->getMessage();
 
-         }
 
-         return $pay->success()->send();// laravel 框架中请直接 `return $pay->success()`
 
-     }
 
-     private function getConfig()
 
-     {
 
-         return [
 
-             'appid' => 'wx089c26eaf96c3d51', // APP APPID
 
-             'mch_id' => '1680393367',
 
-             'key' => 'c451cedbab8058e3502a35c6dacf0919',
 
-             'notify_url' => 'http://yanda.net.cn/notify.php',
 
-             'cert_client' => config_path('cert/wxpay/apiclient_cert.pem'), // optional,退款等情况时用到
 
-             'cert_key' => config_path('cert/wxpay/apiclient_key.pem'),// optional,退款等情况时用到
 
-             'log' => [ // optional
 
-                 'file' => runtime_path('logs/wechat.log'),
 
-                 'level' => 'debug', // 建议生产环境等级调整为 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' => 'optional', // optional, dev/hk;当为 `hk` 时,为中国香港 gateway。
 
-         ];
 
-     }
 
- }
 
 
  |