Basic.php 1.2 KB

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