Config.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\store\shop\controller;
  11. use addon\store\model\Config as ConfigModel;
  12. use app\shop\controller\BaseShop;
  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. 'STORE_IMG' => __ROOT__ . '/addon/store/shop/view/public/img',
  24. 'STORE_JS' => __ROOT__ . '/addon/store/shop/view/public/js',
  25. 'STORE_CSS' => __ROOT__ . '/addon/store/shop/view/public/css',
  26. ];
  27. }
  28. /**
  29. * 门店结算周期配置
  30. */
  31. public function index()
  32. {
  33. $config_model = new ConfigModel();
  34. if (request()->isAjax()) {
  35. //门店结算与提现设置
  36. $withdraw_config = [
  37. 'is_settlement' => input('is_settlement', 0), // 是否进行门店结算
  38. 'period_type' => input('period_type', 4), // 结算方式 1 按天 2. 按周 3. 按月 4. 门店申请结算
  39. 'settlement_rate' => input('settlement_rate', 0), // 结算比率
  40. 'settlement_cost' => input('settlement_cost', ''), // 结算成本控制 coupon,point,balance,fenxiao_commission
  41. 'is_withdraw' => input('is_withdraw', 0), // 是否允许提现
  42. 'is_audit' => input('is_audit', 0), // 是否需要提现审核
  43. 'withdraw_type' => input('withdraw_type', ''), // 可提现账户类型 wechat,alipay, bank
  44. 'withdraw_least' => input('withdraw_least', 0), // 提现最低金额
  45. ];
  46. $config_model->setStoreWithdrawConfig($this->site_id, $withdraw_config);
  47. $business_config = [
  48. 'store_business' => input('store_business', 'shop'), // 门店运营模式 shop:店铺整体运营 store:连锁门店运营模式
  49. 'is_allow_change' => input('is_allow_change', 1), // 是否允许切换门店
  50. 'confirm_popup_control' => input('confirm_popup_control', 0), // 门店确认弹窗
  51. 'store_auth' => input('store_auth', ''), // 门店控制权限
  52. ];
  53. $res = $config_model->setStoreBusinessConfig($this->site_id, $business_config);
  54. return $res;
  55. } else {
  56. $business_config = $config_model->getStoreBusinessConfig($this->site_id)[ 'data' ][ 'value' ];
  57. $this->assign('business_config', $business_config);
  58. $withdraw_config = $config_model->getStoreWithdrawConfig($this->site_id)[ 'data' ][ 'value' ];
  59. $this->assign('withdraw_config', $withdraw_config);
  60. return $this->fetch("config/index", [], $this->replace);
  61. }
  62. }
  63. }