Account.php 777 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\BaseController;
  4. use app\mobile\logic\AccountLogic;
  5. use think\exception\ValidateException;
  6. use think\facade\Config;
  7. use think\facade\Validate;
  8. //账户
  9. class Account extends BaseController
  10. {
  11. //登录
  12. public function login()
  13. {
  14. $param = $this->request->only(['username', 'password'], 'post');
  15. $val = Validate::rule(Config::get('validate_rules.login'));
  16. if (!$val->check($param)) throw new ValidateException($val->getError());
  17. return AccountLogic::login($param);
  18. }
  19. //登出
  20. public function logout()
  21. {
  22. return AccountLogic::logout($this->request->post('token', ''));
  23. }
  24. //详情
  25. public function info(){
  26. return AccountLogic::info();
  27. }
  28. }