// +---------------------------------------------------------------------- declare (strict_types = 1); namespace app\store\controller; use app\store\model\ConfigPercent; use think\facade\Log; /** * 分佣设置 * Class Setting * @package app\store\controller */ class ConfigSetting extends Controller { /** * 获取设置项 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function detail() { $model = new ConfigPercent(); $values = $model->detail(); return $this->renderSuccess($values); } /** * 更新系统设置 * @param string $key * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function update() { //{"form":{"staff_percent":"15","manager_percent":"35","boss_percent":"50"}} // 保存分佣设置 $model = new ConfigPercent(); if ($model->edit($this->postForm())) { return $this->renderSuccess('操作成功'); } return $this->renderError($model->getError() ?: '操作失败'); } public function updatePlat(){ //{"form":{"ticket_rate":"15","platform_rate":"35"}} $model = new ConfigPercent(); Log::error("plat::".json_encode($this->postForm())); if ($model->editPlat($this->postForm())) { return $this->renderSuccess('操作成功'); } return $this->renderError($model->getError() ?: '操作失败'); } }