12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- 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() ?: '操作失败');
- }
- }
|