UserServiceController.php 4.7 KB

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