123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace app\mobile\controller;
- use app\admin\logic\CommonLogic;
- use app\BaseController;
- use app\mobile\logic\AccountLogic;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- //账户
- class Account extends BaseController
- {
- //登录
- public function login()
- {
- $param = $this->request->only(['username', 'password', 'callback_url' => ''], 'post');
- $val = Validate::rule(Config::get('validate_rules.login'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return AccountLogic::login($param);
- }
- //登出
- public function logout()
- {
- return AccountLogic::logout();
- }
- //详情
- public function info()
- {
- return AccountLogic::info();
- }
- //更改密码
- public function updatePassword()
- {
- $param = $this->request->only(['old_password', 'new_password'], 'post');
- $val = Validate::rule(Config::get('validate_rules.changePassword'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return AccountLogic::updatePassword($param);
- }
- //通过微信端code绑定账户
- // public function bindAccountByCode()
- // {
- //
- // $code = $this->request->param('code', '');
- //
- // $val = Validate::rule(['code|微信端code' => 'require']);
- // if (!$val->check(['code' => $code])) throw new ValidateException($val->getError());
- //
- // return AccountLogic::bindAccountByCode($code);
- //
- // }
- }
|