param; $this->validate($param,[ // 'captcha|验证码'=>'require|captcha', 'username|用户名' => 'require', 'password|密码' => 'require' ]); $admin = Db::name('admin')->where(['username'=>$param['username']])->find(); if(empty($admin)) { return vae_assign(202,'用户名或密码错误'); } if(!password_verify($param['password'],$admin['pwd'])) { return vae_assign(202,'用户名或密码错误'); } if(password_needs_rehash($admin['pwd'],PASSWORD_DEFAULT)) { Db::name('admin')->where(['id'=>$admin['id']])->update(['pwd'=>password_hash($param['password'],PASSWORD_DEFAULT)]); } if($admin['status'] == 0){ return vae_assign(202,'该用户禁止登陆,请于系统所有者联系'); } Session::set('adminToken', [ 'id' => $admin['id'], 'thumb' => $admin['thumb'], 'nickname' => $admin['nickname'] ]); $data = [ 'last_login_time' => time(), 'last_login_ip' => $this->request->ip(), ]; Db::name('admin')->where(['id'=>$admin['id']])->update($data); return vae_assign(200,'登入成功'); } }