quanwei
2025-10-31 f226d5fe6327e31bb471a96b7370cf94689c6608
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
<?php
 
namespace app\shop\controller\plus\work;
 
use app\shop\controller\Controller;
use app\shop\model\plus\work\Setting as SettingModel;
 
/**
 * 企业微信设置控制器
 */
class Setting extends Controller
{
    /**
     * 基础设置
     */
    public function index()
    {
        if ($this->request->isGet()) {
            return $this->fetchData();
        }
        $model = new SettingModel;
        $data = $this->request->param();
        $arr = [
            'background' => $data['background'],
        ];
        if ($model->edit('basic', $arr)) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
 
    /**
     * 获取基础配置
     */
    public function fetchData()
    {
        $vars = SettingModel::getItem('basic');
        return $this->renderSuccess('', compact('vars'));
    }
 
}