Config.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. namespace app\common\Service\Commission;
  3. class Config
  4. {
  5. protected $config;
  6. public function __construct()
  7. {
  8. $this->config = shop_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. return boolval("1");
  51. }
  52. // 获取申请资料表单信息
  53. // public function getAgentForm()
  54. // {
  55. // return $this->config['agent_form'];
  56. // }
  57. // 申请协议
  58. public function getApplyProtocol()
  59. {
  60. return $this->config['apply_protocol'];
  61. }
  62. // 分销层级
  63. public function getCommissionLevel()
  64. {
  65. return intval($this->config['level']);
  66. }
  67. // 是否允许分销自购
  68. public function isSelfBuy()
  69. {
  70. return boolval($this->config['self_buy']);
  71. }
  72. // 是否显示升级条件
  73. public function isUpgradeDisplay()
  74. {
  75. return boolval($this->config['upgrade_display']);
  76. }
  77. // 佣金结算价格类型 pay_price=支付金额 goods_price=商品价格 (都不含运费 因为运费对于平台和用户没有实际价值)
  78. public function getRewardType()
  79. {
  80. return $this->config['reward_type'];
  81. }
  82. // 佣金结算节点 payed=支付后
  83. public function getRewardEvent()
  84. {
  85. return $this->config['reward_event'];
  86. }
  87. // 退款是否扣除分销业绩
  88. public function getRefundCommissionOrder()
  89. {
  90. return boolval($this->config['refund_commission_order']);
  91. }
  92. // 退款是否扣除佣金
  93. public function getRefundCommissionReward()
  94. {
  95. return boolval($this->config['refund_commission_reward']);
  96. }
  97. }