lyzflash
2025-11-17 91a56a9b83ec23a1580aa586a24b34aba6990ffa
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
<?php
 
namespace app\agent\controller\setting;
 
use app\agent\controller\Controller;
use app\agent\model\settings\Setting as SettingModel;
use app\common\enum\settings\DeliveryTypeEnum;
 
/**
 * 商城设置控制器
 */
class Store extends Controller
{
    /**
     * 商城设置
     */
    public function index()
    {
        if($this->request->isGet()){
            return $this->fetchData();
        }
        $model = new SettingModel;
        $data = $this->request->param();
        $arr = [
            'name' => $data['name'],
            'delivery_type' => $data['checkedCities'],
            'kuaidi100' => ['customer' => $data['customer'], 'key' => $data['key']],
            'supplier_cash' => $data['supplier_cash'],
            'commission_rate' => $data['commission_rate'],
            'add_audit' => $data['add_audit'],
            'edit_audit' => $data['edit_audit'],
            'supplier_image' => $data['supplier_image'],
            'sms_open' => $data['sms_open'],
            'supplier_logo' => $data['supplier_logo'],
            'is_get_log' => $data['is_get_log'],
        ];
        if ($model->edit('store', $arr)) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
 
    /**
     * 获取商城配置
     */
    public function fetchData()
    {
        $vars['values'] = SettingModel::getItem('store');
        $all_type = DeliveryTypeEnum::data();
        return $this->renderSuccess('', compact('vars', 'all_type'));
    }
 
}