huangsijun
2025-09-22 a78c011de350b188afb03beb2f26a73f35f71986
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?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('自动登录失败,请手动输入');
    }
}