This commit is contained in:
wangjinlei
2021-04-15 09:35:03 +08:00
parent 11da1a782b
commit 15de0ec6e6
4 changed files with 202 additions and 98 deletions

View File

@@ -54,9 +54,14 @@ class User extends Controller {
return json(['code'=>0,'userinfo'=>$admin_info]);
}
} else {//用户登录
$where['account'] = $data['username'];
$where['password'] = md5($data['password']);
$user_info = $this->user_obj->where($where)->find();
// $where['account'] = $data['username'];
// $where['password'] = md5($data['password']);
// $user_info = $this->user_obj->where($where)->find();
$user_info = $this->user_obj
->where('account|email',$data['username'])
->where('password', md5($data['password']))
->find();
if ($user_info == null) {//登陆失败
return json(['code' => 1]);
} else {//登陆成功
@@ -185,8 +190,9 @@ class User extends Controller {
if (!$this->my_checkcaptcha($data['code'], $data['random_num'])) {
return json(['code' => 1, 'msg' => '验证码错误']);
}
$where['account'] = $data['username'];
$res = $this->user_obj->where($where)->find();
$res = $this->user_obj
->where('account|email',$data['username'])
->find();
if ($res == null) {
return json(['code' => 1, 'msg' => '查无此人']);
} else {