assign([ 'configs' => parent::getConfigs(array_keys($strategy)), 'strategy' => $strategy ]); } public function index() { if ($this->request->isPost()) { Db::startTrans(); try { $data = $this->request->post(); foreach ($data as $key => $value) { Config::where('name', $key)->setField('value', trim($value)); } Db::commit(); } catch (Exception $e) { Db::rollback(); $this->error($e->getMessage()); } $this->success('保存成功'); } return $this->fetch(); } }