12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- /**
- *
- *User:Administrator
- *Date:2021/10/8
- */
- namespace app\api\controller\v1;
- use app\api\business\LoginBus;
- use app\api\validate\User;
- use app\BaseController;
- use think\exception\ValidateException;
- class Login extends BaseController
- {
- //登录
- public function login()
- {
- if (!$this->request->isPost()) return showError(config('status.illegal_request'));
- //todo validate
- $data = [
- 'username'=>$this->request->param('login_name', '', 'trim'),
- 'password'=>$this->request->param('pwd', '', 'trim'),
- ];
- //todo validate
- // try {
- // $this->validate(User::class)->scene('login')->check($data);
- // } catch (ValidateException $exception) {
- // return show('11', $exception->getError());
- // }
- $res=(new LoginBus())->login($data['username'],$data['password']);
- return showSuccess($res);
- }
- //登出
- public function logout()
- {
- }
- }
|