Config.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\pointcash\shop\controller;
  11. use app\shop\controller\BaseShop;
  12. use addon\pointcash\model\Config as ConfigModel;
  13. /**
  14. * 积分抵现
  15. * @author Administrator
  16. *
  17. */
  18. class Config extends BaseShop
  19. {
  20. public function index()
  21. {
  22. $config = new ConfigModel();
  23. if (request()->isAjax()) {
  24. $data = [
  25. 'is_enable' => input('is_enable', 0), // 是否开启
  26. 'cash_rate' => input('cash_rate', 0), // 抵现比率
  27. 'is_limit' => input('is_limit', 0), // 是否限制订单金额门槛
  28. 'limit' => input('limit', 0.00), // 订单金额门槛
  29. 'is_limit_use' => input('is_limit_use', 0), // 是否限制使用上限
  30. 'type' => input('type', 0), // 限制类型 0:固定金额 1:订单百分比
  31. 'max_use' => input('max_use', 0) // 最大可用
  32. ];
  33. $res = $config->setPointCashConfig($data, $this->site_id);
  34. return $res;
  35. } else {
  36. $info = $config->getPointCashConfig($this->site_id);
  37. $this->assign('config', $info[ 'data' ][ 'value' ]);
  38. return $this->fetch("config/index");
  39. }
  40. }
  41. }