|
|
@@ -5,6 +5,7 @@ namespace App\Http\Middleware\Manager;
|
|
|
use App\Facades\Servers\Encrypts\AccessToken;
|
|
|
use Closure;
|
|
|
use Illuminate\Http\Request;
|
|
|
+use App\Models\Manager\Personnel\Employee as EmployeeModel;
|
|
|
|
|
|
class Login
|
|
|
{
|
|
|
@@ -43,7 +44,7 @@ class Login
|
|
|
* @param \Closure $next
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function handle(Request $request, Closure $next)
|
|
|
+ public function handle(Request $request, Closure $next, EmployeeModel $EmployeeModel)
|
|
|
{
|
|
|
// 当前路径
|
|
|
$path = ltrim($request->getPathInfo(), '/');
|
|
|
@@ -56,6 +57,12 @@ class Login
|
|
|
// 判断登录时效
|
|
|
if (isset($userInfo['error'])) return json_send(['code' => 'no_login', 'msg' => '请您登录', 'data' => $userInfo['error']]);
|
|
|
if ($userInfo['type'] != 'manager' || $userInfo['expire'] < time()) return json_send(['code' => 'no_login', 'msg' => '请您登录', 'data' => '登录失效']);
|
|
|
+ // 获取用户信息
|
|
|
+ if($userInfo['is_admin'] == 1){
|
|
|
+ $Employee = $EmployeeModel->where('id', $userInfo['uid'])->first();
|
|
|
+ if (!$Employee) return json_send(['code' => 'no_login', 'msg' => '记录不存在','data'=>'']);
|
|
|
+ if ($Employee->status == 1) return json_send(['code' => 'no_login', 'msg' => '账号已被禁用','data'=>'']);
|
|
|
+ }
|
|
|
// 是否是超管
|
|
|
$userInfo['is_super'] = is_super($userInfo['uid'],$userInfo['is_admin'], 'manager') ? 1 : 0;
|
|
|
// 追加入
|