System.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\ApiController;
  4. class System extends ApiController
  5. {
  6. public function getSystemDat()
  7. {
  8. return $this->ApiJson();
  9. }
  10. /**
  11. * 获取公告列表
  12. *
  13. * @author 许祖兴 < zuxing.xu@lettered.cn>
  14. * @date 2020/7/6 11:55
  15. *
  16. * @return \think\response\Json
  17. * @throws \think\db\exception\DataNotFoundException
  18. * @throws \think\db\exception\ModelNotFoundException
  19. * @throws \think\exception\DbException
  20. */
  21. public function getNoticeList()
  22. {
  23. // 分类 1 是公告
  24. $article = model('common/Article')
  25. ->where(['category_id' => 1])
  26. ->select();
  27. return $this->ApiJson(0,'获取列表成功', $article);
  28. }
  29. /**
  30. * 获取详细信息
  31. *
  32. * @author 许祖兴 < zuxing.xu@lettered.cn>
  33. * @date 2020/7/6 11:56
  34. *
  35. * @param $id
  36. * @return \think\response\Json
  37. */
  38. public function getNoticeInfo($id)
  39. {
  40. return $this->ApiJson(0,"OK",model('common/Article')->getBy(['id' => $id]));
  41. }
  42. /**
  43. * 获取商城配置
  44. *
  45. * @author 许祖兴 < zuxing.xu@lettered.cn>
  46. * @date 2020/7/7 15:02
  47. *
  48. * @return \think\response\Json
  49. */
  50. public function getSetting()
  51. {
  52. // 加载用户
  53. $config['user'] = sys_config('','user');
  54. // 加载基础配置
  55. $config['store'] = sys_config('','store');
  56. // 加载条款
  57. $config['clause'] = sys_config('','clause');
  58. $config['agent'] = sys_config('','agent');
  59. $config['driver'] = sys_config('','driver');
  60. return $this->ApiJson(0,"OK", $config);
  61. }
  62. /**
  63. * 获取关于我们
  64. *
  65. * @author 许祖兴 < zuxing.xu@lettered.cn>
  66. * @date 2020/7/7 14:46
  67. *
  68. * @return \think\response\Json
  69. */
  70. public function getAbout()
  71. {
  72. return $this->ApiJson(0,"OK", sys_config('about','store'));
  73. }
  74. /**
  75. * 获取关于我们
  76. *
  77. * @author 许祖兴 < zuxing.xu@lettered.cn>
  78. * @date 2020/7/7 14:46
  79. *
  80. * @return \think\response\Json
  81. */
  82. public function getContact()
  83. {
  84. return $this->ApiJson(0,"OK", sys_config('about','store'));
  85. }
  86. }