Config.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\goodscircle\shop\controller;
  11. use app\shop\controller\BaseShop;
  12. use addon\goodscircle\model\Config as ConfigModel;
  13. /**
  14. * 满减控制器
  15. */
  16. class Config extends BaseShop
  17. {
  18. protected $replace = []; //视图输出字符串内容替换 相当于配置文件中的'view_replace_str'
  19. public function __construct()
  20. {
  21. parent::__construct();
  22. $this->replace = [
  23. 'CIRCLE_CSS' => __ROOT__ . '/addon/goodscircle/shop/view/public/css',
  24. 'CIRCLE_JS' => __ROOT__ . '/addon/goodscircle/shop/view/public/js',
  25. 'CIRCLE_IMG' => __ROOT__ . '/addon/goodscircle/shop/view/public/img',
  26. ];
  27. }
  28. public function index()
  29. {
  30. $config_model = new ConfigModel();
  31. if (request()->isAjax()) {
  32. $data = [];
  33. $is_use = input('is_use', 0);
  34. return $config_model->setGoodscircleConfig($data, $is_use, $this->site_id);
  35. } else {
  36. $config = $config_model->getGoodscircleConfig($this->site_id);
  37. $this->assign('config', $config['data']);
  38. return $this->fetch("config/index", [], $this->replace);
  39. }
  40. }
  41. }