|
|
|
@ -13,10 +13,16 @@ class Passport extends ApiController{ |
|
|
|
/** |
|
|
|
* 登录 |
|
|
|
*/ |
|
|
|
public function login():Json{ |
|
|
|
|
|
|
|
public function login():Json |
|
|
|
{ |
|
|
|
if (!$this->request->isPost()) { |
|
|
|
return $this->renderError('请求方式错误'); |
|
|
|
} |
|
|
|
$data = $this->postData(); |
|
|
|
$model = new UserService; |
|
|
|
if (($userInfo = $model->login($this->postData())) === false) { |
|
|
|
// |
|
|
|
$data = $this->postData(); |
|
|
|
if (($userInfo = $model->login($data['uname'],$data['upass'])) === false) { |
|
|
|
return $this->renderError($model->getError() ?: '登录失败'); |
|
|
|
} |
|
|
|
return $this->renderSuccess([ |
|
|
|
|