Config.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\adminapi\controller\sys;
  12. use app\service\admin\sys\ConfigService;
  13. use core\base\BaseAdminController;
  14. use think\Response;
  15. class Config extends BaseAdminController
  16. {
  17. /**
  18. * 获取网站设置
  19. * @return Response
  20. */
  21. public function getWebsite()
  22. {
  23. return success(( new ConfigService() )->getWebSite());
  24. }
  25. /**
  26. * 网站设置
  27. * @return Response
  28. */
  29. public function setWebsite()
  30. {
  31. $data = $this->request->params([
  32. ['site_name', ''],
  33. ['logo', ''],
  34. ['keywords', ''],
  35. ['desc', ''],
  36. ['latitude', ''],
  37. ['longitude', ''],
  38. ['province_id', 0 ],
  39. ['city_id', 0 ],
  40. ['district_id', 0 ],
  41. ['address', ''],
  42. ['full_address', ''],
  43. ['phone', ''],
  44. ['business_hours', ''],
  45. ['site_name', ''],
  46. ['logo', ''],
  47. ['front_end_name', ''],
  48. ['front_end_logo', ''],
  49. ['icon', '']
  50. ]);
  51. $this->validate($data, 'app\validate\site\Site.admin_set');
  52. ( new ConfigService() )->setWebSite($data);
  53. $service_data = $this->request->params([
  54. ['wechat_code', ''],
  55. ['enterprise_wechat', ''],
  56. ['tel', ''],
  57. ]);
  58. ( new ConfigService() )->setService($service_data);
  59. return success();
  60. }
  61. /**
  62. * 获取版权信息
  63. * @return Response
  64. */
  65. public function getCopyright()
  66. {
  67. return success(( new ConfigService() )->getCopyright());
  68. }
  69. /**设置版权信息
  70. * @return Response
  71. */
  72. public function setCopyright()
  73. {
  74. $data = $this->request->params([
  75. [ 'icp', '' ],
  76. [ 'gov_record', '' ],
  77. [ 'gov_url', '' ],
  78. [ 'market_supervision_url', '' ],
  79. [ 'logo', '' ],
  80. [ 'company_name', '' ],
  81. [ 'copyright_link', '' ],
  82. [ 'copyright_desc', '' ],
  83. ]);
  84. ( new ConfigService() )->setCopyright($data);
  85. return success();
  86. }
  87. /**
  88. * 场景域名
  89. * @return Response
  90. */
  91. public function getSceneDomain()
  92. {
  93. return success(( new ConfigService() )->getSceneDomain());
  94. }
  95. /**
  96. * 获取服务信息
  97. * @return Response
  98. */
  99. public function getServiceInfo()
  100. {
  101. return success(( new ConfigService() )->getService());
  102. }
  103. /**设置版权信息
  104. * @return Response
  105. */
  106. public function setMap()
  107. {
  108. $data = $this->request->params([
  109. [ 'key', '' ],
  110. [ 'is_open', 0 ], // 是否开启定位
  111. [ 'valid_time', 0 ] // 定位有效期/分钟,过期后将重新获取定位信息,0为不过期
  112. ]);
  113. ( new ConfigService() )->setMap($data);
  114. return success();
  115. }
  116. /**
  117. * 获取地图设置
  118. * @return Response
  119. */
  120. public function getMap()
  121. {
  122. return success(( new ConfigService() )->getMap());
  123. }
  124. /**
  125. * 获取站点首页列表(如果正在使用is_use = 1)
  126. */
  127. public function getSiteIndexList()
  128. {
  129. return success(( new ConfigService() )->getSiteIndexList());
  130. }
  131. /**
  132. * 首页配置
  133. */
  134. public function setSiteIndex()
  135. {
  136. $data = $this->request->params([
  137. [ 'view_path', '' ],
  138. ]);
  139. ( new ConfigService() )->setSiteIndexConfig($data);
  140. return success();
  141. }
  142. /**
  143. * 获取站点首页列表(如果正在使用is_use = 1)
  144. */
  145. public function getAdminIndexList()
  146. {
  147. return success(( new ConfigService() )->getAdminIndexList());
  148. }
  149. /**
  150. * 首页配置
  151. */
  152. public function setAdminIndex()
  153. {
  154. $data = $this->request->params([
  155. [ 'view_path', '' ],
  156. ]);
  157. ( new ConfigService() )->setAdminIndexConfig($data);
  158. return success();
  159. }
  160. /**
  161. * 获取手机端首页列表
  162. */
  163. public function getWapIndexList()
  164. {
  165. $data = $this->request->params([
  166. [ 'title', '' ],
  167. [ 'key', '' ] // 多个查询,逗号隔开
  168. ]);
  169. return success(( new ConfigService() )->getWapIndexList($data));
  170. }
  171. /**
  172. * 设置快捷菜单
  173. */
  174. public function setShortcutMenu()
  175. {
  176. $data = $this->request->params([
  177. [ 'menu', [] ],
  178. ]);
  179. ( new ConfigService() )->setShortcutMenu($data[ 'menu' ]);
  180. return success();
  181. }
  182. /**
  183. * 获取站点快捷菜单
  184. */
  185. public function getShortcutMenu()
  186. {
  187. return success(data: ( new ConfigService() )->getShortcutMenu());
  188. }
  189. /**
  190. * 获取开发者key
  191. * @return Response
  192. */
  193. public function getDeveloperToken()
  194. {
  195. return success(data: ( new ConfigService() )->getDeveloperToken());
  196. }
  197. /**
  198. * 设置开发者key
  199. * @return Response
  200. */
  201. public function setDeveloperToken()
  202. {
  203. $data = $this->request->params([
  204. [ 'token', '' ],
  205. ]);
  206. ( new ConfigService() )->setDeveloperToken($data);
  207. return success();
  208. }
  209. }