\Setting::get('plugin.wechat')['app_id'],// AppID 'secret' => \Setting::get('plugin.wechat')['app_secret'], // AppSecret 'token' => \Setting::get('plugin.wechat.token'),// Token 'aes_key' => \Setting::get('plugin.wechat.aes_key'),// EncodingAESKey,安全模式与兼容模式下请一定要填写!!! ]; } //微擎版 else{ $account = AccountWechats::getAccountByUniacid(\YunShop::app()->uniacid); $default_config = [ 'app_id' => $account['key'], // AppID 'secret' => $account['secret'], // AppSecret 'token' => $account['token'], // Token 'aes_key' => $account['encodingaeskey'], // EncodingAESKey,兼容与安全模式下请一定要填写!!! ]; } $OfficialAccount = new OfficialAccount(array_merge($default_config,$config)); $OfficialAccount->rebind('material',function ($app) { return new Material($app); }); return $OfficialAccount; } /** * @return \EasyWeChat\Work\Application */ public static function work(array $config = []) { $Work = new Work($config); $Work->rebind('external_contact',function ($app) { return new Client($app); }); $Work->rebind('contact_way',function ($app) { return new ContactWayClient($app); }); $Work->rebind('user', function ($app) { return new \app\framework\EasyWechat\Work\User($app); }); $Work->rebind('department', function ($app) { return new \app\framework\EasyWechat\Work\Department($app); }); return $Work; } /** * @return \EasyWeChat\Payment\Application */ public static function payment(array $config = []) { $pay = \Setting::get('shop.pay'); $default_config = [ 'app_id' => $pay['weixin_appid'], 'mch_id' => $pay['weixin_mchid'], 'key' => $pay['weixin_apisecret'], 'cert_path' => $pay['weixin_cert'], 'key_path' => $pay['weixin_key'], 'notify_url' => Url::shopSchemeUrl('payment/wechat/notifyUrl.php'), ]; $Payment = new Payment(array_merge($default_config,$config)); $Payment->rebind('order',function ($app) { return new Order($app); }); $Payment->rebind('transfer_v3',function ($app) { return new TransferV3($app); }); return $Payment; } /** * @return \EasyWeChat\MiniProgram\Application */ public static function miniProgram(array $config = []) { $MiniProgram = new MiniProgram($config); $MiniProgram->rebind('app_code',function ($app) { return new AppCode($app); }); return $MiniProgram; } /** * @return \EasyWeChat\OpenPlatform\Application */ public static function openPlatform(array $config = []) { return new OpenPlatform($config); } }