check($imgcode)) { return app('json')->fail('验证码错误,请重新输入'); } //获取登录 $adminInfo = Warehouse::login($account,$pwd); if(empty($adminInfo)) { return app('json')->fail(Warehouse::getErrorInfo('用户名错误,请重新输入')); } //生成令牌 $token = Warehouse::createToken($adminInfo, 'warehouse'); if(empty($token)) { return app('json')->fail(Warehouse::getErrorInfo()); } return app('json')->success([ 'token' => $token['token'], 'expires_time' => $token['params']['exp'], 'user_info' => [ 'id' => $adminInfo->getData('id'), 'username' => $adminInfo->getData('username'), 'name' => $adminInfo->getData('name'), 'lx_name' => $adminInfo->getData('lx_name') ], ]); } /** * 用户发生退出 */ public function logut(){ } /** * 验证码 * @return \app\adminapi\controller\Login|\think\Response */ public function captcha() { return (new Captcha())->create(); } }