MasterWorkerController.php 3.8 KB

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