123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\common\library;
- use EasyWeChat\Factory;
- use fast\Random;
- use think\Hook;
- /**
- * 短信验证码类
- */
- class WxPublic
- {
- /** @var \EasyWeChat\OfficialAccount\Application $app */
- protected $app;
- /**
- * WxpLogin constructor.
- */
- public function __construct()
- {
- $this->app=Factory::officialAccount([
- 'app_id'=>config('site.wx_open_appid'),
- 'secret'=>config('site.wx_open_secret'),
- 'log' => [
- 'level' => 'debug',
- 'file' => RUNTIME_PATH.'/wxp/wechat.log',
- ],
- 'oauth' => [
- 'scopes' => ['snsapi_base'],
- 'callback' => '/index/user/wxp_handle',
- ],
- ]);
- }
- /**
- * @return \EasyWeChat\OfficialAccount\Application
- */
- public function getApp()
- {
- return $this->app;
- }
- public function qr(){
- return $this->getApp()
- ->qrcode
- ->temporary(session_create_id(),3600);
- }
- }
|