MasterWorkerController.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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\master_worker;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\master_worker\MasterWorkerLists;
  17. use app\adminapi\lists\master_worker\MoneyAnalysis;
  18. use app\adminapi\lists\master_worker\MasterWorkerOnlineLists;
  19. use app\adminapi\logic\master_worker\MasterWorkerLogic;
  20. use app\adminapi\validate\master_worker\MasterWorkerValidate;
  21. /**
  22. * MasterWorker控制器
  23. * Class MasterWorkerController
  24. * @package app\adminapi\controller\master_worker
  25. */
  26. class MasterWorkerController extends BaseAdminController
  27. {
  28. /**
  29. * @notes 获取列表
  30. * @return \think\response\Json
  31. * @author likeadmin
  32. * @date 2024/07/10 18:17
  33. */
  34. public function lists()
  35. {
  36. return $this->dataLists(new MasterWorkerLists());
  37. }
  38. /**
  39. * @notes 在线工程师列表
  40. * @return \think\response\Json
  41. * @author likeadmin
  42. * @date 2024/07/10 18:17
  43. */
  44. public function onlineLists()
  45. {
  46. return $this->dataLists(new MasterWorkerOnlineLists());
  47. }
  48. /**
  49. * @notes 添加
  50. * @return \think\response\Json
  51. * @author likeadmin
  52. * @date 2024/07/10 18:17
  53. */
  54. public function add()
  55. {
  56. $params = (new MasterWorkerValidate())->post()->goCheck('add');
  57. $result = MasterWorkerLogic::add($params);
  58. if (true === $result) {
  59. return $this->success('添加成功', [], 1, 1);
  60. }
  61. return $this->fail(MasterWorkerLogic::getError());
  62. }
  63. /**
  64. * @notes 编辑
  65. * @return \think\response\Json
  66. * @author likeadmin
  67. * @date 2024/07/10 18:17
  68. */
  69. public function edit()
  70. {
  71. $params = (new MasterWorkerValidate())->post()->goCheck('edit');
  72. $result = MasterWorkerLogic::edit($params);
  73. if (true === $result) {
  74. return $this->success('编辑成功', [], 1, 1);
  75. }
  76. return $this->fail(MasterWorkerLogic::getError());
  77. }
  78. /**
  79. * @notes 删除
  80. * @return \think\response\Json
  81. * @author likeadmin
  82. * @date 2024/07/10 18:17
  83. */
  84. public function delete()
  85. {
  86. $params = (new MasterWorkerValidate())->post()->goCheck('delete');
  87. MasterWorkerLogic::delete($params);
  88. return $this->success('删除成功', [], 1, 1);
  89. }
  90. /**
  91. * @notes 获取详情
  92. * @return \think\response\Json
  93. * @author likeadmin
  94. * @date 2024/07/10 18:17
  95. */
  96. public function detail()
  97. {
  98. $params = (new MasterWorkerValidate())->goCheck('detail');
  99. $result = MasterWorkerLogic::detail($params);
  100. return $this->data($result);
  101. }
  102. /**
  103. * 获取加盐密码
  104. * @return \think\response\Json
  105. */
  106. public function saltToPassword()
  107. {
  108. $params = (new MasterWorkerValidate())->get()->goCheck('saltToPassword');
  109. $result = MasterWorkerLogic::saltToPassword($params);
  110. if (false === $result) {
  111. return $this->fail(MasterWorkerLogic::getError());
  112. }
  113. return $this->data($result);
  114. }
  115. /**
  116. * @notes 工程师余额数据分析
  117. * @return \think\response\Json
  118. */
  119. public function moneyAnalysis()
  120. {
  121. return $this->dataLists(new MoneyAnalysis());
  122. }
  123. public function getAllWorkers()
  124. {
  125. $params = (new MasterWorkerValidate())->get();
  126. return $this->data(MasterWorkerLogic::getAllWorkers($params));
  127. }
  128. /**
  129. * @notes 设置备注
  130. * @return \think\response\Json
  131. * @author likeadmin
  132. * @date 2024/07/10 18:17
  133. */
  134. public function setRemark()
  135. {
  136. $params = (new MasterWorkerValidate())->post()->goCheck('remark');
  137. $result = MasterWorkerLogic::setRemark($params);
  138. if (true === $result) {
  139. return $this->success('设置成功', [], 1, 1);
  140. }
  141. return $this->fail(MasterWorkerLogic::getError());
  142. }
  143. }