123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace fast;
- use EasyWeChat\Factory;
- /**
- * 版本检测和对比
- */
- class Mini
- {
- public static function mini($client){
- static $app=[];
- if(!isset($app[$client])) {
- if($client==1) {
- $config = [
- 'app_id' => config('site.user_appid'),
- 'secret' => config('site.user_appsecret'),
- // 下面为可选项
- // 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
- 'response_type' => 'array',
- 'log' => [
- 'level' => 'debug',
- 'file' => RUNTIME_PATH . '/wechat_user.log',
- ],
- ];
- }else{
- $config = [
- 'app_id' => config('site.sender_appid'),
- 'secret' => config('site.sender_appserret'),
- // 下面为可选项
- // 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
- 'response_type' => 'array',
- 'log' => [
- 'level' => 'debug',
- 'file' => RUNTIME_PATH . '/wechat_sender.log',
- ],
- ];
- }
- $app[$client]=Factory::miniProgram($config);
- }
- return $app[$client];
- }
- public static function payment($client='user'){
- static $app=[];
- if(!isset($app[$client])) {
- $config = [
- 'app_id' => config('site.user_appid'),
- 'secret' => config('site.user_appsecret'),
- // 下面为可选项
- // 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
- 'response_type' => 'array',
- 'log' => [
- 'level' => 'debug',
- 'file' => RUNTIME_PATH . '/wechat_user.log',
- ],
- ];
- $app[$client]=Factory::payment($config);
- }
- return $app[$client];
- }
- }
|