Config.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com.cn
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\model\shop;
  13. use app\model\system\Config as ConfigModel;
  14. use app\model\system\Document as DocumentModel;
  15. use app\model\BaseModel;
  16. /**
  17. * 店铺设置信息
  18. */
  19. class Config extends BaseModel
  20. {
  21. /**
  22. * 获取系统银行账户
  23. */
  24. public function getSystemBankAccount()
  25. {
  26. $config = new ConfigModel();
  27. $res = $config->getConfig([ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'config_key', '=', 'SYSTEM_BANK_ACCOUNT' ] ]);
  28. if(empty($res['data']['value']))
  29. {
  30. $res['data']['value'] = [
  31. 'bank_account_name' => '',
  32. 'bank_account_no' => '',
  33. 'bank_name' => '',
  34. 'bank_address' => ''
  35. ];
  36. }
  37. return $res;
  38. }
  39. /**
  40. * 设置系统银行账户
  41. * @param unknown $data
  42. * @return Ambigous <multitype:unknown , multitype:number unknown >
  43. */
  44. public function setSystemBankAccount($data)
  45. {
  46. $config = new ConfigModel();
  47. $res = $config->setConfig($data, '平台银行账户', 1, [ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'config_key', '=', 'SYSTEM_BANK_ACCOUNT' ] ]);
  48. return $res;
  49. }
  50. /**
  51. * 获取商家入驻广告设置
  52. */
  53. public function getShopJoinAdvConfig()
  54. {
  55. $config = new ConfigModel();
  56. $res = $config->getConfig([ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'config_key', '=', 'SHOP_JOIN_ADV_CONFIG' ] ]);
  57. return $res;
  58. }
  59. /**
  60. * 设置商家入驻广告
  61. */
  62. public function setShopJoinAdvConfig($data)
  63. {
  64. $config = new ConfigModel();
  65. $res = $config->setConfig($data, '商家入驻广告设置', 1, [ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'config_key', '=', 'SHOP_JOIN_ADV_CONFIG' ] ]);
  66. return $res;
  67. }
  68. /**
  69. * 获取入驻协议
  70. */
  71. public function getShopApplyAgreement()
  72. {
  73. $document = new DocumentModel();
  74. $info = $document->getDocument([ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'document_key', '=', "SHOP_APPLY_AGREEMENT" ] ]);
  75. return $info;
  76. }
  77. /**
  78. * 设置入驻协议
  79. */
  80. public function setShopApplyAgreement($title, $content)
  81. {
  82. $document = new DocumentModel();
  83. $res = $document->setDocument($title, $content, [ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'document_key', '=', "SHOP_APPLY_AGREEMENT" ] ]);
  84. return $res;
  85. }
  86. /**
  87. * 获取入驻协议
  88. */
  89. public function getENTRYPAGE()
  90. {
  91. $document = new DocumentModel();
  92. $info = $document->getDocument([ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'document_key', '=', "ENTRY_PAGE" ] ]);
  93. return $info;
  94. }
  95. /**
  96. * 设置入驻协议
  97. */
  98. public function setENTRYPAGE($title, $content)
  99. {
  100. $document = new DocumentModel();
  101. $res = $document->setDocument($title, $content, [ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'document_key', '=', "ENTRY_PAGE" ] ]);
  102. return $res;
  103. }
  104. /**
  105. * 设置商家入驻指南
  106. * @param $title
  107. * @param $content
  108. * @param $guide_index
  109. * @return \app\model\system\multitype
  110. */
  111. public function setShopJoinGuideDocument($title, $content, $guide_index)
  112. {
  113. $document = new DocumentModel();
  114. $res = $document->setDocument($title, $content, [ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'document_key', '=', "SHOP_JOIN_GUIDE_{$guide_index}" ] ]);
  115. return $res;
  116. }
  117. /**
  118. * 获取商家入驻指南
  119. * @param $guide_index
  120. * @return array|\multitype
  121. */
  122. public function getShopJoinGuideDocument($guide_index)
  123. {
  124. $document = new DocumentModel();
  125. $info = $document->getDocument([ [ 'site_id', '=', 0 ], [ 'app_module', '=', 'admin' ], [ 'document_key', '=', "SHOP_JOIN_GUIDE_{$guide_index}" ] ]);
  126. return $info;
  127. }
  128. /**
  129. * 获取所有商家入驻指南
  130. * @return array
  131. */
  132. public function getShopJoinGuide()
  133. {
  134. $guide_num = 4;
  135. $guide_list = [];
  136. for ($index = 1; $index <= $guide_num; $index++) {
  137. $guide = $this->getShopJoinGuideDocument($index);
  138. if (empty($guide['data']['title'])) {
  139. $guide['data']['title'] = '入驻指南' . $index;
  140. }
  141. $guide['data']['guide_index'] = $index;
  142. $guide_list[] = $guide['data'];
  143. }
  144. return $this->success($guide_list);
  145. }
  146. }