MasterWorkerController.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. namespace app\workerapi\controller;
  3. use app\common\model\dict\DictData;
  4. use app\workerapi\logic\LoginLogic;
  5. use app\workerapi\logic\MasterWorkerInfoLogic;
  6. use app\workerapi\logic\MasterWorkerLogic;
  7. use app\workerapi\validate\BankAccountValidate;
  8. use app\workerapi\validate\MasterWokerInfoValidate;
  9. use app\workerapi\validate\MasterWokerValidate;
  10. class MasterWorkerController extends BaseApiController
  11. {
  12. public array $notNeedLogin = ['customerPhone'];
  13. /**
  14. * @notes 修改密码
  15. * @return \think\response\Json
  16. * @author 段誉
  17. * @date 2022/9/20 19:16
  18. */
  19. public function changePassword()
  20. {
  21. $params = (new MasterWokerValidate())->post()->goCheck('changePassword');
  22. $result = MasterWorkerLogic::changePassword($params, $this->userId);
  23. if (true === $result) {
  24. return $this->success('操作成功', [], 1, 1);
  25. }
  26. return $this->fail(MasterWorkerLogic::getError());
  27. }
  28. /**
  29. * 更改手机号
  30. * @return \think\response\Json
  31. * @author 林海涛
  32. * @date 2024/7/10 下午2:23
  33. */
  34. public function changeMobile()
  35. {
  36. $params = (new MasterWokerValidate())->post()->goCheck('changeMobile');
  37. $result = MasterWorkerLogic::changeMobile($params, $this->userId);
  38. if (true === $result) {
  39. return $this->success('操作成功', [], 1, 1);
  40. }
  41. return $this->fail(MasterWorkerLogic::getError());
  42. }
  43. /**
  44. * 更改身份证信息
  45. * @return \think\response\Json
  46. * @author 林海涛
  47. * @date 2024/7/10 下午4:46
  48. */
  49. public function changeIdCard()
  50. {
  51. $params = (new MasterWokerInfoValidate())->post()->goCheck('changeIdCard');
  52. $result = MasterWorkerInfoLogic::changeIdCard($params, $this->userId);
  53. if (true === $result) {
  54. return $this->success('操作成功', [], 1, 1);
  55. }
  56. return $this->fail(MasterWorkerInfoLogic::getError());
  57. }
  58. public function getIdCard()
  59. {
  60. $result = MasterWorkerInfoLogic::getIdCard($this->userId);
  61. return $this->data($result);
  62. }
  63. public function approvalStopWork()
  64. {
  65. $result = MasterWorkerLogic::stopWork($this->userId);
  66. if (true === $result) {
  67. return $this->success('操作成功', [], 1, 1);
  68. }
  69. return $this->fail(MasterWorkerLogic::getError());
  70. }
  71. /**
  72. * 注销账号
  73. * @return \think\response\Json
  74. * @author 林海涛
  75. * @date 2024/7/10 下午4:46
  76. */
  77. public function logOff()
  78. {
  79. $result = MasterWorkerLogic::logOff($this->userId);
  80. if (true === $result) {
  81. LoginLogic::logout($this->userInfo);
  82. return $this->success('操作成功', [], 1, 1);
  83. }
  84. return $this->fail(MasterWorkerInfoLogic::getError());
  85. }
  86. /**
  87. * 绑定银行卡
  88. * @return \think\response\Json
  89. * @author 林海涛
  90. * @date 2024/7/11 下午4:27
  91. */
  92. public function bindBankAccount()
  93. {
  94. $params = (new BankAccountValidate())->post()->goCheck('bindBankAccount');
  95. $result = MasterWorkerInfoLogic::bindBankAccount($params, $this->userId);
  96. if (true === $result) {
  97. return $this->success('操作成功', [], 1, 1);
  98. }
  99. return $this->fail(MasterWorkerInfoLogic::getError());
  100. }
  101. public function myInfo()
  102. {
  103. $result = MasterWorkerLogic::detail($this->userId);
  104. return $this->data($result);
  105. }
  106. public function bankAccountInfo()
  107. {
  108. $result = MasterWorkerInfoLogic::bankAccountInfo($this->userId);
  109. return $this->data($result);
  110. }
  111. /**
  112. * 客服电话
  113. * @return \think\response\Json
  114. */
  115. public function customerPhone()
  116. {
  117. $result = DictData::where(['type_value' => 'customer_support'])->column('value', 'name');
  118. return $this->data($result);
  119. }
  120. public function setInfo()
  121. {
  122. $params = (new MasterWokerValidate())->post()->goCheck('setInfo');
  123. $result = MasterWorkerLogic::setInfo($this->userId, $params);
  124. if (false === $result) {
  125. return $this->fail(MasterWorkerLogic::getError());
  126. }
  127. return $this->success('操作成功', $result, 1, 1);
  128. }
  129. }