代码更新
This commit is contained in:
@@ -31,11 +31,31 @@ class Index extends Admin{
|
||||
/**
|
||||
* @title 后台登录
|
||||
*/
|
||||
public function login(){
|
||||
public function login(\app\model\Member $member){
|
||||
if ($this->request->isAjax()) {
|
||||
Session::set('user', ['uid'=>1,'username'=>'admin']);
|
||||
$username = $this->request->param('username', '');
|
||||
$password = $this->request->param('password', '');
|
||||
$user = $member->login($username, $password);
|
||||
if ($user) {
|
||||
Session::set('user', $user);
|
||||
$this->data['url'] = "/admin/index/index.html";
|
||||
$this->data['msg'] = "登录成功!";
|
||||
}else{
|
||||
Session::set('user', null);
|
||||
$this->data['code'] = 1;
|
||||
$this->data['msg'] = "登录失败!";
|
||||
}
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 后台登出
|
||||
*/
|
||||
public function logout(){
|
||||
Session::set('user', null);
|
||||
$this->data['code'] = 0;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user