截流自动化的商城平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Help.php 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. namespace app\admin\controller\content;
  3. use app\admin\logic\content\HelpCategoryLogic;
  4. use app\admin\logic\content\HelpLogic;
  5. use app\admin\validate\content\HelpValidate;
  6. use app\common\basics\AdminBase;
  7. use app\common\server\JsonServer;
  8. class Help extends AdminBase
  9. {
  10. /**
  11. * @NOTES: 帮助分类列表
  12. * @author: 张无忌
  13. */
  14. public function lists()
  15. {
  16. if ($this->request->isAjax()) {
  17. $get = $this->request->get();
  18. $lists = HelpLogic::lists($get);
  19. return JsonServer::success("获取成功", $lists);
  20. }
  21. return view('', [
  22. 'category' => HelpCategoryLogic::getCategory()
  23. ]);
  24. }
  25. /**
  26. * @NOTES: 添加帮助类
  27. * @author: 张无忌
  28. */
  29. public function add()
  30. {
  31. if ($this->request->isAjax()) {
  32. (new HelpValidate())->goCheck('add');
  33. $post = $this->request->post();
  34. $res = HelpLogic::add($post);
  35. if ($res === false) {
  36. $error = HelpLogic::getError() ?: '新增失败';
  37. return JsonServer::error($error);
  38. }
  39. return JsonServer::success('新增成功');
  40. }
  41. return view('', [
  42. 'category' => HelpCategoryLogic::getCategory()
  43. ]);
  44. }
  45. /**
  46. * @NOTES: 编辑帮助分类
  47. * @author: 张无忌
  48. */
  49. public function edit()
  50. {
  51. if ($this->request->isAjax()) {
  52. (new HelpValidate())->goCheck('edit');
  53. $post = $this->request->post();
  54. $res = HelpLogic::edit($post);
  55. if ($res === false) {
  56. $error = HelpLogic::getError() ?: '编辑失败';
  57. return JsonServer::error($error);
  58. }
  59. return JsonServer::success('编辑成功');
  60. }
  61. $id = $this->request->get('id');
  62. return view('', [
  63. 'detail' => HelpLogic::detail($id),
  64. 'category' => HelpCategoryLogic::getCategory()
  65. ]);
  66. }
  67. /**
  68. * @NOTES: 删除帮助分类
  69. * @author: 张无忌
  70. */
  71. public function del()
  72. {
  73. if ($this->request->isAjax()) {
  74. (new HelpValidate())->goCheck('id');
  75. $id = $this->request->post('id');
  76. $res = HelpLogic::del($id);
  77. if ($res === false) {
  78. $error = HelpLogic::getError() ?: '删除失败';
  79. return JsonServer::error($error);
  80. }
  81. return JsonServer::success('删除成功');
  82. }
  83. return JsonServer::error('异常');
  84. }
  85. /**
  86. * @Notes: 隐藏帮助分类
  87. * @Author: 张无忌
  88. */
  89. public function hide()
  90. {
  91. if ($this->request->isAjax()) {
  92. (new HelpValidate())->goCheck('id');
  93. $id = $this->request->post('id');
  94. $res = HelpLogic::hide($id);
  95. if ($res === false) {
  96. $error = HelpLogic::getError() ?: '操作失败';
  97. return JsonServer::error($error);
  98. }
  99. return JsonServer::success('操作成功');
  100. }
  101. return JsonServer::success('异常');
  102. }
  103. }