Basic.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\store\controller\market;
  3. use app\store\controller\Controller;
  4. use app\store\model\Goods;
  5. use app\store\model\Region as RegionModel;
  6. use app\store\model\Setting as SettingModel;
  7. /**
  8. * 营销设置-基本功能
  9. * Class Basic
  10. * @package app\store\controller
  11. */
  12. class Basic extends Controller
  13. {
  14. /**
  15. * 满额包邮设置
  16. * @return array|bool|mixed
  17. * @throws \think\exception\DbException
  18. */
  19. public function full_free()
  20. {
  21. if (!$this->request->isAjax()) {
  22. $values = SettingModel::getItem('full_free');
  23. return $this->fetch('full_free', [
  24. 'goodsList' => (new Goods)->getListByIds($values['notin_goods']),
  25. 'regionData' => RegionModel::getCacheTree(), // 所有地区
  26. 'values' => $values
  27. ]);
  28. }
  29. $model = new SettingModel;
  30. if ($model->edit('full_free', $this->postData('model'))) {
  31. return $this->renderSuccess('操作成功');
  32. }
  33. return $this->renderError($model->getError() ?: '操作失败');
  34. }
  35. }