BankAccountController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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\tenantapi\controller\master_worker;
  15. use app\tenantapi\controller\BaseAdminController;
  16. use app\tenantapi\lists\master_worker\BankAccountLists;
  17. use app\tenantapi\logic\master_worker\BankAccountLogic;
  18. use app\tenantapi\validate\master_worker\BankAccountValidate;
  19. use app\common\logic\MasterWorkerExamineLogic;
  20. /**
  21. * BankAccount控制器
  22. * Class BankAccountController
  23. * @package app\tenantapi\controller\master_worker
  24. */
  25. class BankAccountController extends BaseAdminController
  26. {
  27. /**
  28. * @notes 获取列表
  29. * @return \think\response\Json
  30. * @author likeadmin
  31. * @date 2024/10/08 09:41
  32. */
  33. public function lists()
  34. {
  35. return $this->dataLists(new BankAccountLists());
  36. }
  37. /**
  38. * @notes 添加
  39. * @return \think\response\Json
  40. * @author likeadmin
  41. * @date 2024/10/08 09:41
  42. */
  43. public function add()
  44. {
  45. $params = (new BankAccountValidate())->post()->goCheck('add');
  46. $result = BankAccountLogic::add($params);
  47. if (true === $result) {
  48. MasterWorkerExamineLogic::updateEngineerInformation($params['worker_id']);
  49. return $this->success('添加成功', [], 1, 1);
  50. }
  51. return $this->fail(BankAccountLogic::getError());
  52. }
  53. /**
  54. * @notes 编辑
  55. * @return \think\response\Json
  56. * @author likeadmin
  57. * @date 2024/10/08 09:41
  58. */
  59. public function edit()
  60. {
  61. $params = (new BankAccountValidate())->post()->goCheck('edit');
  62. $result = BankAccountLogic::edit($params);
  63. if (true === $result) {
  64. MasterWorkerExamineLogic::updateEngineerInformation($params['worker_id']);
  65. return $this->success('编辑成功', [], 1, 1);
  66. }
  67. return $this->fail(BankAccountLogic::getError());
  68. }
  69. /**
  70. * @notes 删除
  71. * @return \think\response\Json
  72. * @author likeadmin
  73. * @date 2024/10/08 09:41
  74. */
  75. public function delete()
  76. {
  77. $params = (new BankAccountValidate())->post()->goCheck('delete');
  78. try {
  79. $worker_ids = BankAccountLogic::getWorkerIds($params);
  80. BankAccountLogic::delete($params);
  81. foreach ($worker_ids as $worker_id) {
  82. MasterWorkerExamineLogic::updateEngineerInformation($worker_id);
  83. }
  84. return $this->success('删除成功', [], 1, 1);
  85. } catch (\Exception $e) {
  86. return $this->fail('删除失败-'.$e->getMessage());
  87. }
  88. }
  89. /**
  90. * @notes 获取详情
  91. * @return \think\response\Json
  92. * @author likeadmin
  93. * @date 2024/10/08 09:41
  94. */
  95. public function detail()
  96. {
  97. $params = (new BankAccountValidate())->goCheck('detail');
  98. $result = BankAccountLogic::detail($params);
  99. return $this->data($result);
  100. }
  101. }