quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
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
<?php
 
namespace app\operations\controller\setting;
 
use app\operations\controller\Controller;
use app\operations\model\settings\Setting as SettingModel;
use app\common\enum\settings\GetPhoneTypeEnum;
 
/**
 * 商城设置控制器
 */
class GetPhone extends Controller
{
    /**
     * 商城设置
     */
    public function index()
    {
        if($this->request->isGet()){
            return $this->fetchData();
        }
        $model = new SettingModel;
        $data = $this->request->param();
        $arr = [
            'area_type' => $data['checkedCities'],
            'send_day' => $data['send_day'],
        ];
        if ($model->edit('getPhone', $arr)) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
 
    /**
     * 获取商城配置
     */
    public function fetchData()
    {
        $vars['values'] = SettingModel::getItem('getPhone');
        $all_type = GetPhoneTypeEnum::data();
        return $this->renderSuccess('', compact('vars', 'all_type'));
    }
 
}