| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace app\shop\controller;
- use app\shop\model\shop\User;
- /**
- * 商户认证
- */
- class Passport extends Controller
- {
- /**
- * 商户后台登录
- */
- public function login()
- {
- //登录前清空session
- session('jjjshop_store', null);
- $user = $this->postData();
- $user['password'] = salt_hash($user['password']);
- $model = new User();
- if ($model->checkLogin($user)) {
- return $this->renderSuccess('登录成功', $user['username']);
- }
- return $this->renderError($model->getError()?:'登录失败');
- }
- /**
- * 退出登录
- */
- public function logout()
- {
- session('jjjshop_store', null);
- return $this->renderSuccess('退出成功');
- }
- /*
- * 修改密码
- */
- public function editPass()
- {
- $model = new User();
- if ($model->editPass($this->postData(), $this->store['user'])) {
- return $this->renderSuccess('修改成功');
- }
- return $this->renderError($model->getError()?:'修改失败');
- }
- /**
- * 商户后台登录
- */
- public function saasLogin()
- {
- //登录前清空session
- $store = session('jjjshop_store');
- if($store != null){
- return $this->renderSuccess('登录成功', $store['user']['user_name']);
- }
- return $this->renderError('自动登录失败,请手动输入');
- }
- }
|