|
@@ -58,7 +58,7 @@ class Base extends Controller
|
|
|
$this->page_num = $page_num ? $page_num : 20;
|
|
|
$this->off_set = ($this->page * $this->page_num) - $this->page_num;
|
|
|
$path = explode('/', $this->request->path());
|
|
|
- if (!empty($this->need_login) && in_array(end($path), $this->need_login)){
|
|
|
+ if (!empty($this->need_login) && in_array(end($path), $this->need_login)) {
|
|
|
$this->checkLogin();
|
|
|
}
|
|
|
}
|
|
@@ -72,20 +72,20 @@ class Base extends Controller
|
|
|
try {
|
|
|
$key = md5(config('app.jwt'));
|
|
|
$check_authorization = JWT::decode($authorization, $key, array('HS256'));
|
|
|
- if ($check_authorization['code'] != 200){
|
|
|
+ if ($check_authorization['code'] != 200) {
|
|
|
$this->exception($check_authorization['msg']);
|
|
|
}
|
|
|
$authInfo = json_decode(json_encode($check_authorization['data']), true);
|
|
|
- if(!$authInfo){
|
|
|
+ if (!$authInfo) {
|
|
|
$this->error('Token验证不通过,账号不存在', null, 0, -1);
|
|
|
}
|
|
|
- $member = User::field('is_deleted',true)
|
|
|
- ->where('is_deleted',CommonConstant::IS_DELETED_0)
|
|
|
+ $member = User::field('is_deleted', true)
|
|
|
+ ->where('is_deleted', CommonConstant::IS_DELETED_0)
|
|
|
->find($authInfo['uid']);
|
|
|
- if (!$member){
|
|
|
- $this->error('账号不存在', null, 0,-1);
|
|
|
+ if (!$member) {
|
|
|
+ $this->error('账号不存在', null, 0, -1);
|
|
|
}
|
|
|
- if(!$member['status']){
|
|
|
+ if (!$member['status']) {
|
|
|
$this->error('账号已经被禁用', null, 0, -1);
|
|
|
}
|
|
|
$this->user_id = $authInfo['uid'];
|
|
@@ -111,7 +111,7 @@ class Base extends Controller
|
|
|
"iat" => $time,
|
|
|
"nbf" => $time,
|
|
|
"exp" => $expire,
|
|
|
- "facility_code" => $facility_code,
|
|
|
+// "facility_code" => $facility_code,
|
|
|
);
|
|
|
$jwt = JWT::encode($token, $key);
|
|
|
return $jwt;
|