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,'用户名或密码错误'); } $param['pwd'] = vae_set_password($param['password'],$admin['salt']); if($admin['pwd'] !== $param['pwd']) { return vae_assign(202,'用户名或密码错误'); } 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,'登入成功'); } }