request->post('account', ''); $password = $this->request->post('password', ''); if (!$account){ return app('json')->fail('请输入账号'); } $user = Db::name('dataview_account')->where('account', $account)->find(); if (!$user) { throw new ValidateException("账号不存在"); } if (!md5($password) === $user['password']) { $msg = '账号或密码错误'; throw new ValidateException($msg); } $expire = time()+ 3600 * 24; $token = md5($expire); return app('json')->success(compact('user','token', 'expire')); } }