mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-05-22 06:49:15 +08:00
Update Auth.php
This commit is contained in:
parent
44bbcb2c8a
commit
ae94f2b78d
@ -14,13 +14,13 @@ use think\exception\HttpResponseException;
|
|||||||
abstract class Auth extends Controller
|
abstract class Auth extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 当前请求终端类型
|
* 当前接口请求终端类型
|
||||||
* -- 手机浏览器访问 wap
|
* --- 手机浏览器访问 wap
|
||||||
* -- 电脑浏览器访问 web
|
* --- 电脑浏览器访问 web
|
||||||
* -- 微信小程序访问 wxapp
|
* --- 微信小程序访问 wxapp
|
||||||
* -- 微信服务号访问 wechat
|
* --- 微信服务号访问 wechat
|
||||||
* -- 苹果应用接口访问 isoapp
|
* --- 苹果应用接口访问 isoapp
|
||||||
* -- 安卓应用接口访问 android
|
* --- 安卓应用接口访问 android
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $type;
|
protected $type;
|
||||||
@ -45,14 +45,17 @@ abstract class Auth extends Controller
|
|||||||
// 接口数据类型
|
// 接口数据类型
|
||||||
$this->type = input('api') ?: $this->request->header('api-name');
|
$this->type = input('api') ?: $this->request->header('api-name');
|
||||||
$this->type = $this->type ?: $this->request->header('api-type');
|
$this->type = $this->type ?: $this->request->header('api-type');
|
||||||
$this->type = $this->type ?: UserService::APITYPE_WXAPP;
|
if (empty($this->type) || empty(UserService::TYPES[$this->type])) {
|
||||||
if (empty(UserService::TYPES[$this->type])) {
|
$this->error("接口通道未定义!");
|
||||||
$this->error("接口通道未定义规则!");
|
|
||||||
}
|
}
|
||||||
// 获取用户数据
|
// 获取用户数据
|
||||||
$this->user = $this->getUser();
|
$this->user = $this->getUser();
|
||||||
|
if (empty($this->user) || empty($this->user['id'])) {
|
||||||
|
$this->error('用户登录失败!', '{-null-}', 401);
|
||||||
|
} else {
|
||||||
$this->uuid = $this->user['id'];
|
$this->uuid = $this->user['id'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户数据
|
* 获取用户数据
|
||||||
|
Loading…
x
Reference in New Issue
Block a user