Setting.php 851 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\store\controller\apps\sharp;
  3. use app\store\controller\Controller;
  4. use app\store\model\sharp\Setting as SettingModel;
  5. /**
  6. * 整点秒杀设置
  7. * Class Setting
  8. * @package app\store\controller\apps\sharp
  9. */
  10. class Setting extends Controller
  11. {
  12. /**
  13. * 拼团设置
  14. * @return array|mixed
  15. * @throws \think\exception\DbException
  16. */
  17. public function index()
  18. {
  19. if (!$this->request->isAjax()) {
  20. $values = SettingModel::getItem('basic');
  21. return $this->fetch('index', compact('values'));
  22. }
  23. $model = new SettingModel;
  24. if ($model->edit('basic', $this->postData('basic'))) {
  25. return $this->renderSuccess('更新成功');
  26. }
  27. return $this->renderError($model->getError() ?: '更新失败');
  28. }
  29. }