SupplyDemandController.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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\logic\agricultural_machinery\UserServiceLogic;
  17. use app\adminapi\validate\agricultural_machinery\SupplyDemandValidate;
  18. use app\adminapi\logic\agricultural_machinery\SupplyDemandLogic;
  19. use app\adminapi\lists\agricultural_machinery\SupplyDemandLists;
  20. use app\adminapi\lists\agricultural_machinery\SupplyDemandCateLists;
  21. use app\adminapi\validate\agricultural_machinery\SupplyDemandCateValidate;
  22. /**
  23. * 供需管理控制器
  24. * Class ArticleCateController
  25. * @package app\adminapi\controller\article
  26. */
  27. class SupplyDemandController extends BaseAdminController
  28. {
  29. /**
  30. * @notes 获取供需列表
  31. * @return \think\response\Json
  32. * @throws \think\db\exception\DataNotFoundException
  33. * @throws \think\db\exception\DbException
  34. * @throws \think\db\exception\ModelNotFoundException
  35. * @author 段誉
  36. * @date 2022/10/13 10:54
  37. */
  38. public function getSupplyDemandList()
  39. {
  40. $params = (new SupplyDemandValidate())->get()->goCheck('supplyDemand');
  41. return $this->dataLists(new SupplyDemandLists());
  42. }
  43. /**
  44. * @notes 删除服务商
  45. * @return \think\response\Json
  46. * @author heshihu
  47. * @date 2022/2/21 17:52
  48. */
  49. public function delete()
  50. {
  51. $params = (new SupplyDemandValidate())->post()->goCheck('delete');
  52. SupplyDemandLogic::delete($params);
  53. return $this->success('删除成功', [], 1, 1);
  54. }
  55. /**
  56. * @notes 供应详情
  57. * @return \think\response\Json
  58. * @author heshihu
  59. * @date 2022/2/21 17:54
  60. */
  61. public function detail()
  62. {
  63. $params = (new SupplyDemandValidate())->goCheck('detail');
  64. $result = SupplyDemandLogic::detail($params);
  65. return $this->data($result);
  66. }
  67. /**
  68. * @notes 更改供需状态
  69. * @return \think\response\Json
  70. * @author heshihu
  71. * @date 2022/2/21 10:15
  72. */
  73. public function updateStatus()
  74. {
  75. $params = (new SupplyDemandValidate())->post()->goCheck('status');
  76. $result = SupplyDemandLogic::updateStatus($params);
  77. if (true === $result) {
  78. return $this->success('审核成功', [], 1, 1);
  79. }
  80. return $this->fail(SupplyDemandLogic::getError());
  81. }
  82. /**
  83. * @notes 获取会员列表
  84. * @return \think\response\Json
  85. * @throws \think\db\exception\DataNotFoundException
  86. * @throws \think\db\exception\DbException
  87. * @throws \think\db\exception\ModelNotFoundException
  88. * @author 段誉
  89. * @date 2022/10/13 10:54
  90. */
  91. public function getUserList()
  92. {
  93. $result = UserServiceLogic::getValidUserData();
  94. return $this->data($result);
  95. }
  96. /*
  97. * 供需分类列表
  98. * */
  99. public function supplyDemandCateLists(){
  100. $params = (new SupplyDemandCateValidate())->get()->goCheck('SupplyDemandCate');
  101. return $this->dataLists(new SupplyDemandCateLists());
  102. }
  103. /**
  104. * @notes 添加资讯分类
  105. * @return \think\response\Json
  106. * @author heshihu
  107. * @date 2022/2/21 17:31
  108. */
  109. public function addCate()
  110. {
  111. $params = (new SupplyDemandCateValidate())->post()->goCheck('add');
  112. SupplyDemandLogic::addCate($params);
  113. return $this->success('添加成功', [], 1, 1);
  114. }
  115. public function cateDetail()
  116. {
  117. $params = (new SupplyDemandCateValidate())->goCheck('detail');
  118. $result = SupplyDemandLogic::detailCate($params);
  119. return $this->data($result);
  120. }
  121. public function editCate()
  122. {
  123. $params = (new SupplyDemandCateValidate())->post()->goCheck('edit');
  124. $result = SupplyDemandLogic::editCate($params);
  125. if (true === $result) {
  126. return $this->success('编辑成功', [], 1, 1);
  127. }
  128. return $this->fail(SupplyDemandLogic::getError());
  129. }
  130. /**
  131. * @notes 更改供需状态
  132. * @return \think\response\Json
  133. * @author heshihu
  134. * @date 2022/2/21 10:15
  135. */
  136. public function updateCateStatus()
  137. {
  138. $params = (new SupplyDemandCateValidate())->post()->goCheck('status');
  139. $result = SupplyDemandLogic::updateCateStatus($params);
  140. if (true === $result) {
  141. return $this->success('修改成功', [], 1, 1);
  142. }
  143. return $this->fail(SupplyDemandLogic::getError());
  144. }
  145. public function deleteCate()
  146. {
  147. $params = (new SupplyDemandCateValidate())->post()->goCheck('delete');
  148. SupplyDemandLogic::deleteCate($params);
  149. return $this->success('删除成功', [], 1, 1);
  150. }
  151. }