| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace app\api\controller\login;
- use app\api\controller\ZskkDefaultController;
- use app\api\validate\login\LoginValidate;
- use app\api\servies\login\LoginService;
- use think\Exception;
- //use app\api\validate\test\LoginValidate;
- class LoginController extends ZskkDefaultController
- {
- protected $needToken = false;
- protected $logName = "LoginController";
- /**
- * 用户登录接口
- * @author liuguiyan LoginService $service
- */
- public function login(LoginService $service)
- {
- $params = $this->getParams();
- LoginValidate::check($params);
- $user = $service->login($params);
- return $this->success($user);
- }
- public function send_message_again(LoginService $service)
- {
- $params = $this->getParams();
- LoginValidate::checkPhone($params);
- $user = $service->send_message_again($params);
- return $this->success($user);
- }
- public function check_code(LoginService $service)
- {
- $params = $this->getParams();
- LoginValidate::checkCode($params);
- $user = $service->check_code($params);
- return $this->success($user);
- }
- public function loginOut(LoginService $service)
- {
- try{
- $user = $service->logout($this->getToken());
- return $this->success($user);
- } catch (Exception $exception){
- $this->throwError('系统异常',0001);
- }
- }
- public function out(LoginService $service)
- {
- try{
- $params = $this->getParams();
- $data = $service->out($params['session']);
- return $this->success($data);
- } catch (Exception $exception){
- $this->throwError('系统异常',0001);
- }
- }
- }
|