AgriculturalMachineryCategoryController.php 4.4 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\agricultural_machinery;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\article\ArticleCateLists;
  17. use app\adminapi\lists\agricultural_machinery\AgriculturalMachineryCategoryLists;
  18. use app\adminapi\logic\agricultural_machinery\AgriculturalMachineryServiceCategoryLogic;
  19. use app\adminapi\validate\agricultural_machinery\AgriculturalMachineryServiceCategoryValidate;
  20. use app\adminapi\logic\article\ArticleCateLogic;
  21. use app\adminapi\validate\article\ArticleCateValidate;
  22. /**
  23. * 农机服务分类管理控制器
  24. * Class ArticleCateController
  25. * @package app\adminapi\controller\article
  26. */
  27. class AgriculturalMachineryCategoryController extends BaseAdminController
  28. {
  29. /**
  30. * @notes 查看农耕分类列表
  31. * @return \think\response\Json
  32. * @author heshihu
  33. * @date 2022/2/21 17:11
  34. */
  35. public function lists()
  36. {
  37. return $this->dataLists(new AgriculturalMachineryCategoryLists());
  38. }
  39. /**
  40. * @notes 添加资讯分类
  41. * @return \think\response\Json
  42. * @author heshihu
  43. * @date 2022/2/21 17:31
  44. */
  45. public function add()
  46. {
  47. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('add');
  48. AgriculturalMachineryServiceCategoryLogic::add($params);
  49. return $this->success('添加成功', [], 1, 1);
  50. }
  51. /**
  52. * @notes 编辑农耕分类
  53. * @return \think\response\Json
  54. * @author heshihu
  55. * @date 2022/2/21 17:49
  56. */
  57. public function edit()
  58. {
  59. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('edit');
  60. $result = AgriculturalMachineryServiceCategoryLogic::edit($params);
  61. if (true === $result) {
  62. return $this->success('编辑成功', [], 1, 1);
  63. }
  64. return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError());
  65. }
  66. /**
  67. * @notes 删除农耕分类
  68. * @return \think\response\Json
  69. * @author heshihu
  70. * @date 2022/2/21 17:52
  71. */
  72. public function delete()
  73. {
  74. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('delete');
  75. AgriculturalMachineryServiceCategoryLogic::delete($params);
  76. return $this->success('删除成功', [], 1, 1);
  77. }
  78. /**
  79. * @notes 农耕分类详情
  80. * @return \think\response\Json
  81. * @author heshihu
  82. * @date 2022/2/21 17:54
  83. */
  84. public function detail()
  85. {
  86. $params = (new AgriculturalMachineryServiceCategoryValidate())->goCheck('detail');
  87. $result = AgriculturalMachineryServiceCategoryLogic::detail($params);
  88. return $this->data($result);
  89. }
  90. /**
  91. * @notes 更改农耕分类状态
  92. * @return \think\response\Json
  93. * @author heshihu
  94. * @date 2022/2/21 10:15
  95. */
  96. public function updateStatus()
  97. {
  98. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('status');
  99. $result = AgriculturalMachineryServiceCategoryLogic::updateStatus($params);
  100. if (true === $result) {
  101. return $this->success('修改成功', [], 1, 1);
  102. }
  103. return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError());
  104. }
  105. /**
  106. * @notes 获取农耕分类
  107. * @return \think\response\Json
  108. * @throws \think\db\exception\DataNotFoundException
  109. * @throws \think\db\exception\DbException
  110. * @throws \think\db\exception\ModelNotFoundException
  111. * @author 段誉
  112. * @date 2022/10/13 10:54
  113. */
  114. public function getValidCate()
  115. {
  116. $result = AgriculturalMachineryServiceCategoryLogic::getValidCateData();
  117. return $this->data($result);
  118. }
  119. }