quanwei
2025-12-25 a47b138c7455dee981af9b4fac431a16c0eee675
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
 
namespace app\openapi\controller\app;
 
use app\openapi\controller\Controller;
use app\openapi\model\app\App as AppModel;
use app\shop\model\app\AppWx as AppWxModel;
 
/**
 * 控制器
 */
class App extends Controller
{
    /**
     * 列表
     */
    public function index()
    {
        $model = new AppModel;
        $list = $model->getList($this->postData());
        return $this->renderSuccess('', compact('list'));
    }
 
    /**
     * 添加商城
     */
    public function add()
    {
        $model = new AppModel;
        // 新增记录
        if ($model->add($this->postData)) {
            return $this->renderSuccess('添加成功');
        }
        return $this->renderError($model->getError() ?: '添加失败');
    }
 
    /**
     * 编辑商城
     */
    public function edit()
    {
        $model = AppModel::detail($this->postData["app_id"]);
        // 新增记录
        if ($model->edit($this->postData)) {
            return $this->renderSuccess('修改成功');
        }
        return $this->renderError($model->getError() ?: '修改失败');
    }
 
    /**
     * 重置商城账号密码
     */
    public function editUser()
    {
        $model = AppModel::detail($this->postData["app_id"]);
        // 新增记录
        if ($model->editUser($this->postData)) {
            return $this->renderSuccess('修改成功');
        }
        return $this->renderError($model->getError() ?: '修改失败');
    }
 
    /**
     * 删除
     */
    public function delete()
    {
        //详情
        $model = AppModel::detail($this->postData["app_id"]);
        if (!$model->setDelete()) {
            return $this->renderError('操作失败');
        }
        return $this->renderSuccess('操作成功');
    }
 
    /*
    *启用禁用
   */
    public function updateStatus()
    {
        $model = AppModel::detail($this->postData["app_id"]);
        if (!$model->updateStatus()) {
            return $this->renderError('操作失败');
        }
        return $this->renderSuccess('操作成功');
    }
 
    /*
     *启用服务商支付
    */
    public function updateWxStatus()
    {
        $model = AppModel::detail($this->postData["app_id"]);
        if (!$model->updateWxStatus()) {
            return $this->renderError('操作失败');
        }
        return $this->renderSuccess('操作成功');
    }
 
    /**
     * 设置小程序付呗支付信息
     */
    public function setPay()
    {
        $model = new AppWxModel;
        $data = $this->postData;
        if ($model->syncEdit($data)) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '修改失败');
    }
    /**
     * 总后台获取付呗支付配置
     */
    public function getPay()
    {
        $model = new AppWxModel;
        $postData = $this->postData;
        $data = $model->syncGet($postData);
        return $this->renderSuccess('', compact('data'));
    }
}