Account.php 1.1 KB

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