// +---------------------------------------------------------------------- declare (strict_types = 1); namespace app\store\controller; use app\store\model\ExploreSet as SettingModel; /** * 探索/体验 * Class Setting * @package app\store\controller */ class ExploreSet extends Controller { /** * 探索、体验详情 * @param string $key * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function detail(string $type) { $values = SettingModel::getItem($type); return $this->renderSuccess(compact('values')); } /** * 更新设置 * @param string $key * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function update(string $type) { // 保存商城设置 $model = new SettingModel; if ($model->edit($type, $this->postForm())) { return $this->renderSuccess('操作成功'); } return $this->renderError($model->getError() ?: '操作失败'); } }