Setting.php 821 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\shop\controller\plus\bargain;
  3. use app\shop\controller\Controller;
  4. use app\shop\model\settings\Setting as SettingModel;
  5. /**
  6. * 砍价设置
  7. */
  8. class Setting extends Controller
  9. {
  10. /**
  11. * 拼团设置
  12. */
  13. public function index()
  14. {
  15. if($this->request->isGet()){
  16. return $this->getSetting();
  17. }
  18. $model = new SettingModel;
  19. if ($model->edit('bargain', $this->postData())) {
  20. return $this->renderSuccess('操作成功');
  21. }
  22. return $this->renderError('操作失败');
  23. }
  24. /**
  25. * 设置开启砍价
  26. */
  27. public function getSetting()
  28. {
  29. $vars['values'] = SettingModel::getItem('bargain');
  30. return $this->renderSuccess('', compact('vars'));
  31. }
  32. }