AgriculturalMachineryCategoryController.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. $params = (new AgriculturalMachineryServiceCategoryValidate())->get()->goCheck('list');
  38. return $this->dataLists(new AgriculturalMachineryCategoryLists());
  39. }
  40. /**
  41. * @notes 添加资讯分类
  42. * @return \think\response\Json
  43. * @author heshihu
  44. * @date 2022/2/21 17:31
  45. */
  46. public function add()
  47. {
  48. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('add');
  49. AgriculturalMachineryServiceCategoryLogic::add($params);
  50. return $this->success('添加成功', [], 1, 1);
  51. }
  52. /**
  53. * @notes 编辑农耕分类
  54. * @return \think\response\Json
  55. * @author heshihu
  56. * @date 2022/2/21 17:49
  57. */
  58. public function edit()
  59. {
  60. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('edit');
  61. $result = AgriculturalMachineryServiceCategoryLogic::edit($params);
  62. if (true === $result) {
  63. return $this->success('编辑成功', [], 1, 1);
  64. }
  65. return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError());
  66. }
  67. /**
  68. * @notes 删除农耕分类
  69. * @return \think\response\Json
  70. * @author heshihu
  71. * @date 2022/2/21 17:52
  72. */
  73. public function delete()
  74. {
  75. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('delete');
  76. AgriculturalMachineryServiceCategoryLogic::delete($params);
  77. return $this->success('删除成功', [], 1, 1);
  78. }
  79. /**
  80. * @notes 农耕分类详情
  81. * @return \think\response\Json
  82. * @author heshihu
  83. * @date 2022/2/21 17:54
  84. */
  85. public function detail()
  86. {
  87. $params = (new AgriculturalMachineryServiceCategoryValidate())->goCheck('detail');
  88. $result = AgriculturalMachineryServiceCategoryLogic::detail($params);
  89. return $this->data($result);
  90. }
  91. /**
  92. * @notes 更改农耕分类状态
  93. * @return \think\response\Json
  94. * @author heshihu
  95. * @date 2022/2/21 10:15
  96. */
  97. public function updateStatus()
  98. {
  99. $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('status');
  100. $result = AgriculturalMachineryServiceCategoryLogic::updateStatus($params);
  101. if (true === $result) {
  102. return $this->success('修改成功', [], 1, 1);
  103. }
  104. return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError());
  105. }
  106. /**
  107. * @notes 获取农耕分类
  108. * @return \think\response\Json
  109. * @throws \think\db\exception\DataNotFoundException
  110. * @throws \think\db\exception\DbException
  111. * @throws \think\db\exception\ModelNotFoundException
  112. * @author 段誉
  113. * @date 2022/10/13 10:54
  114. */
  115. public function getValidCate()
  116. {
  117. $params = (new AgriculturalMachineryServiceCategoryValidate())->get()->goCheck('list');
  118. $result = AgriculturalMachineryServiceCategoryLogic::getValidCateData($params);
  119. return $this->data($result);
  120. }
  121. }