request->isAjax) { // 获取设置 $service = new SettingService(['mall_id' => $this->mall_id]); $conf = $service->getSetting(); // 等级 $level = UserLevel::getUserLevel([ ['=', 'mall_id', $this->mall_id], ['=', 'status', StatusEnum::ENABLED], ], [], true, 'level, name', 'level asc'); // 订单 $order = Order::getTypes(); return $this->success('ok', compact('conf', 'level', 'order')); } return $this->render('index'); } /** * 保存设置 * * @return void */ public function actionSubmit() { if ($this->request->isPost) { // 数据提交 $post = $this->request->post(); $service = new SettingService(['mall_id' => $this->mall_id]); if ($service->saveSetting($post)) { return $this->success('保存成功'); } return $this->error('保存失败'); } } }