Config.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. namespace addons\shopro\service\commission;
  3. class Config
  4. {
  5. protected $config;
  6. public function __construct()
  7. {
  8. $this->config = sheep_config('shop.commission');
  9. }
  10. // 覆盖默认分销设置
  11. public function setConfig($config)
  12. {
  13. foreach ($config as $name => $value) {
  14. $this->config[$name] = $value;
  15. }
  16. }
  17. // 获取绑定推广关系的事件节点
  18. public function getInviteLockEvent()
  19. {
  20. $becomeAgentEvent = $this->getBecomeAgentEvent();
  21. if($becomeAgentEvent === 'user') {
  22. return 'agent';
  23. }
  24. return $this->config['invite_lock'];
  25. }
  26. // 获取成为分销商的条件
  27. public function getBecomeAgentEvent()
  28. {
  29. return $this->config['become_agent'];
  30. }
  31. // 分销商是否需要审核
  32. public function isAgentCheck()
  33. {
  34. return boolval($this->config['agent_check']);
  35. }
  36. // 分销商升级审核
  37. public function isUpgradeCheck()
  38. {
  39. return boolval($this->config['upgrade_check']);
  40. }
  41. // 分销商允许越级升级
  42. public function isUpgradeJump()
  43. {
  44. return boolval($this->config['upgrade_jump']);
  45. }
  46. // 是否需要完善分销商表单信息
  47. public function isAgentApplyForm()
  48. {
  49. return boolval($this->config['agent_form']['status']);
  50. }
  51. // 获取申请资料表单信息
  52. public function getAgentForm()
  53. {
  54. return $this->config['agent_form'];
  55. }
  56. // 申请协议
  57. public function getApplyProtocol()
  58. {
  59. return $this->config['apply_protocol'];
  60. }
  61. // 分销层级
  62. public function getCommissionLevel()
  63. {
  64. return intval($this->config['level']);
  65. }
  66. // 是否允许分销自购
  67. public function isSelfBuy()
  68. {
  69. return boolval($this->config['self_buy']);
  70. }
  71. // 是否显示升级条件
  72. public function isUpgradeDisplay()
  73. {
  74. return boolval($this->config['upgrade_display']);
  75. }
  76. // 佣金结算价格类型 pay_price=支付金额 goods_price=商品价格 (都不含运费 因为运费对于平台和用户没有实际价值)
  77. public function getRewardType()
  78. {
  79. return $this->config['reward_type'];
  80. }
  81. // 佣金结算节点 payed=支付后
  82. public function getRewardEvent()
  83. {
  84. return $this->config['reward_event'];
  85. }
  86. // 退款是否扣除分销业绩
  87. public function getRefundCommissionOrder()
  88. {
  89. return boolval($this->config['refund_commission_order']);
  90. }
  91. // 退款是否扣除佣金
  92. public function getRefundCommissionReward()
  93. {
  94. return boolval($this->config['refund_commission_reward']);
  95. }
  96. }