ArticleController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\controller;
  20. use app\adminapi\validate\ArticleValidate;
  21. use app\adminapi\logic\ArticleLogic;
  22. class ArticleController extends BaseAdminController
  23. {
  24. /**
  25. * @notes 查看文章/帮助列表
  26. * @return \think\response\Json
  27. * @author Tab
  28. * @date 2021/7/14 9:33
  29. */
  30. public function lists()
  31. {
  32. return $this->dataLists();
  33. }
  34. /**
  35. * @notes 添加文章/帮助
  36. * @return \think\response\Json
  37. * @author Tab
  38. * @date 2021/7/13 15:49
  39. */
  40. public function add()
  41. {
  42. $params = (new ArticleValidate())->post()->goCheck('add');
  43. ArticleLogic::add($params);
  44. return $this->success('添加成功',[],1,1);
  45. }
  46. /**
  47. * @notes 查看文章/帮助详情
  48. * @return \think\response\Json
  49. * @author Tab
  50. * @date 2021/7/13 16:53
  51. */
  52. public function detail()
  53. {
  54. $params = (new ArticleValidate())->goCheck('detail');
  55. $result = ArticleLogic::detail($params);
  56. return $this->data($result);
  57. }
  58. /** 编辑文章/帮助
  59. * @notes
  60. * @return \think\response\Json
  61. * @author Tab
  62. * @date 2021/7/14 9:20
  63. */
  64. public function edit()
  65. {
  66. $params = (new ArticleValidate())->post()->goCheck('edit');
  67. ArticleLogic::edit($params);
  68. return $this->success('编辑成功',[],1,1);
  69. }
  70. /**
  71. * @notes 删除文章/帮助
  72. * @return \think\response\Json
  73. * @author Tab
  74. * @date 2021/7/14 9:24
  75. */
  76. public function delete()
  77. {
  78. $params = (new ArticleValidate())->post()->goCheck('delete');
  79. ArticleLogic::delete($params);
  80. return $this->success('删除成功',[],1,1);
  81. }
  82. /**
  83. * @notes 修改是否显示状态
  84. * @return \think\response\Json
  85. * @throws \think\db\exception\DataNotFoundException
  86. * @throws \think\db\exception\DbException
  87. * @throws \think\db\exception\ModelNotFoundException
  88. * @author Tab
  89. * @date 2021/7/14 11:36
  90. */
  91. public function isShow()
  92. {
  93. $params = (new ArticleValidate())->post()->goCheck('show');
  94. ArticleLogic::isShow($params);
  95. return $this->success('修改成功',[],1,1);
  96. }
  97. }