123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- /*
- |--------------------------------------------------------------------------
- | auth.php 用于做权限验证
- |--------------------------------------------------------------------------
- */
- namespace Service\Src;
- use Dever;
- use Main\Lib\Wechat;
- class Auth
- {
- /**
- * wechat
- *
- * @var Wechat
- */
- private $wechat;
-
- /**
- * result
- *
- * @var array
- */
- private $result;
-
- /**
- * output
- *
- * @var string
- */
- private $output;
-
- /**
- * 构造函数 初始化
- *
- * @return mixed
- */
- public function __construct()
- {
- $this->wechat = new Wechat(false, 'service');
- }
- /**
- * 获取签名数据,主要用于jssdk
- *
- * @return mixed
- */
- public function sign()
- {
- $url = Dever::input('url');
- return $this->wechat->sign($url);
- }
- /**
- * 获取ticket
- *
- * @return mixed
- */
- public function ticket()
- {
- return $this->wechat->ticket(false, false, 2000, true);
- }
- /**
- * 获取token 一般为系统token
- *
- * @return mixed
- */
- public function token()
- {
- return $this->wechat->token(false, false, 2000, true);
- }
- }
|