WebSettingController.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\setting\web;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\logic\setting\web\WebSettingLogic;
  17. use app\adminapi\validate\setting\WebSettingValidate;
  18. /**
  19. * 网站设置
  20. * Class WebSettingController
  21. * @package app\adminapi\controller\setting
  22. */
  23. class WebSettingController extends BaseAdminController
  24. {
  25. /**
  26. * @notes 获取网站信息
  27. * @return \think\response\Json
  28. * @author 段誉
  29. * @date 2021/12/28 15:44
  30. */
  31. public function getWebsite()
  32. {
  33. $result = WebSettingLogic::getWebsiteInfo();
  34. return $this->data($result);
  35. }
  36. /**
  37. * @notes 设置网站信息
  38. * @return \think\response\Json
  39. * @author 段誉
  40. * @date 2021/12/28 15:45
  41. */
  42. public function setWebsite()
  43. {
  44. $params = (new WebSettingValidate())->post()->goCheck('website');
  45. WebSettingLogic::setWebsiteInfo($params);
  46. return $this->success('设置成功', [], 1, 1);
  47. }
  48. /**
  49. * @notes 获取备案信息
  50. * @return \think\response\Json
  51. * @author 段誉
  52. * @date 2021/12/28 16:10
  53. */
  54. public function getCopyright()
  55. {
  56. $result = WebSettingLogic::getCopyright();
  57. return $this->data($result);
  58. }
  59. /**
  60. * @notes 设置备案信息
  61. * @return \think\response\Json
  62. * @author 段誉
  63. * @date 2021/12/28 16:10
  64. */
  65. public function setCopyright()
  66. {
  67. $params = $this->request->post();
  68. $result = WebSettingLogic::setCopyright($params);
  69. if (false === $result) {
  70. return $this->fail(WebSettingLogic::getError() ?: '操作失败');
  71. }
  72. return $this->success('设置成功', [], 1, 1);
  73. }
  74. /**
  75. * @notes 设置政策协议
  76. * @return \think\response\Json
  77. * @author ljj
  78. * @date 2022/2/15 11:00 上午
  79. */
  80. public function setAgreement()
  81. {
  82. $params = $this->request->post();
  83. WebSettingLogic::setAgreement($params);
  84. return $this->success('设置成功', [], 1, 1);
  85. }
  86. /**
  87. * @notes 获取政策协议
  88. * @return \think\response\Json
  89. * @author ljj
  90. * @date 2022/2/15 11:16 上午
  91. */
  92. public function getAgreement()
  93. {
  94. $result = WebSettingLogic::getAgreement();
  95. return $this->data($result);
  96. }
  97. /**
  98. * @notes 获取站点统计配置
  99. * @return \think\response\Json
  100. * @author yfdong
  101. * @date 2024/09/20 22:24
  102. */
  103. public function getSiteStatistics()
  104. {
  105. $result = WebSettingLogic::getSiteStatistics();
  106. return $this->data($result);
  107. }
  108. /**
  109. * @notes 获取站点统计配置
  110. * @return \think\response\Json
  111. * @author yfdong
  112. * @date 2024/09/20 22:51
  113. */
  114. public function setSiteStatistics()
  115. {
  116. $params = (new WebSettingValidate())->post()->goCheck('siteStatistics');
  117. WebSettingLogic::setSiteStatistics($params);
  118. return $this->success('设置成功', [], 1, 1);
  119. }
  120. }