Config.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\fenxiao\api\controller;
  11. use app\api\controller\BaseApi;
  12. use addon\fenxiao\model\Config as ConfigModel;
  13. use app\model\system\Document;
  14. /**
  15. * 分销相关配置
  16. */
  17. class Config extends BaseApi
  18. {
  19. /**
  20. * 提现配置
  21. */
  22. public function withdraw()
  23. {
  24. $config = new ConfigModel();
  25. $res = $config->getFenxiaoWithdrawConfig($this->site_id);
  26. return $this->response($this->success($res['data']['value']));
  27. }
  28. /**
  29. * 文字设置
  30. * @return false|string
  31. */
  32. public function words()
  33. {
  34. $config = new ConfigModel();
  35. $res = $config->getFenxiaoWordsConfig($this->site_id);
  36. return $this->response($this->success($res['data']['value']));
  37. }
  38. /**
  39. * 申请协议
  40. * @return false|string
  41. */
  42. public function agreement()
  43. {
  44. $config = new ConfigModel();
  45. $agreement = $config->getFenxiaoAgreementConfig($this->site_id);
  46. $res = [];
  47. $res['agreement'] = $agreement['data']['value'];
  48. if ($agreement['data']['value']['is_agreement'] == 1) {
  49. $document_model = new Document();
  50. $document = $document_model->getDocument([['site_id', '=', $this->site_id], ['app_module', '=', 'shop'], ['document_key', '=', "FENXIAO_AGREEMENT"]]);
  51. $res['document'] = $document['data'];
  52. }
  53. return $this->response($this->success($res));
  54. }
  55. /**
  56. * 分销基本设置
  57. * @return false|string
  58. */
  59. public function basics()
  60. {
  61. $config = new ConfigModel();
  62. $res = $config->getFenxiaoBasicsConfig($this->site_id);
  63. return $this->response($this->success($res['data']['value']));
  64. }
  65. /**
  66. * 分销商资格设置
  67. * @return false|string
  68. */
  69. public function fenxiao()
  70. {
  71. $config = new ConfigModel();
  72. $res = $config->getFenxiaoConfig($this->site_id);
  73. return $this->response($this->success($res['data']['value']));
  74. }
  75. /**
  76. * 获取上下级关系设置
  77. * @return false|string
  78. */
  79. public function relation()
  80. {
  81. $config = new ConfigModel();
  82. $res = $config->getFenxiaoRelationConfig($this->site_id);
  83. return $this->response($this->success($res['data']['value']));
  84. }
  85. }