WxPublic.php 898 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\common\library;
  3. use EasyWeChat\Factory;
  4. use fast\Random;
  5. use think\Hook;
  6. /**
  7. * 短信验证码类
  8. */
  9. class WxPublic
  10. {
  11. /** @var \EasyWeChat\OfficialAccount\Application $app */
  12. protected $app;
  13. /**
  14. * WxpLogin constructor.
  15. */
  16. public function __construct()
  17. {
  18. $this->app=Factory::officialAccount([
  19. 'app_id'=>config('site.user_appid'),
  20. 'secret'=>config('site.user_appsecret'),
  21. 'log' => [
  22. 'level' => 'debug',
  23. 'file' => RUNTIME_PATH.'/wxp/wechat.log',
  24. ],
  25. 'oauth' => [
  26. 'scopes' => ['snsapi_userinfo'],
  27. 'callback' => '/index/user/wxp_handle',
  28. ],
  29. ]);
  30. }
  31. /**
  32. * @return \EasyWeChat\OfficialAccount\Application
  33. */
  34. public function getApp()
  35. {
  36. return $this->app;
  37. }
  38. }