AgriculturalMachineryCategoryController.php 5.1 KB

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