Account.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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', 'callback_url' => ''], '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. {
  33. $param = $this->request->only(['old_password', 'new_password'], 'post');
  34. $val = Validate::rule(Config::get('validate_rules.changePassword'));
  35. if (!$val->check($param)) throw new ValidateException($val->getError());
  36. return AccountLogic::updatePassword($param);
  37. }
  38. //通过微信端code绑定账户
  39. // public function bindAccountByCode()
  40. // {
  41. //
  42. // $code = $this->request->param('code', '');
  43. //
  44. // $val = Validate::rule(['code|微信端code' => 'require']);
  45. // if (!$val->check(['code' => $code])) throw new ValidateException($val->getError());
  46. //
  47. // return AccountLogic::bindAccountByCode($code);
  48. //
  49. // }
  50. }