1
0

MasterWorkerController.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 approvalStopWork()
  59. {
  60. $result = MasterWorkerLogic::stopWork($this->userId);
  61. if (true === $result) {
  62. return $this->success('操作成功', [], 1, 1);
  63. }
  64. return $this->fail(MasterWorkerLogic::getError());
  65. }
  66. /**
  67. * 注销账号
  68. * @return \think\response\Json
  69. * @author 林海涛
  70. * @date 2024/7/10 下午4:46
  71. */
  72. public function logOff()
  73. {
  74. $result = MasterWorkerLogic::logOff($this->userId);
  75. if (true === $result) {
  76. LoginLogic::logout($this->userInfo);
  77. return $this->success('操作成功', [], 1, 1);
  78. }
  79. return $this->fail(MasterWorkerInfoLogic::getError());
  80. }
  81. /**
  82. * 绑定银行卡
  83. * @return \think\response\Json
  84. * @author 林海涛
  85. * @date 2024/7/11 下午4:27
  86. */
  87. public function bindBankAccount()
  88. {
  89. $params = (new BankAccountValidate())->post()->goCheck('bindBankAccount');
  90. $result = MasterWorkerInfoLogic::bindBankAccount($params, $this->userId);
  91. if (true === $result) {
  92. return $this->success('操作成功', [], 1, 1);
  93. }
  94. return $this->fail(MasterWorkerInfoLogic::getError());
  95. }
  96. public function myInfo()
  97. {
  98. $result = MasterWorkerLogic::detail($this->userId);
  99. return $this->data($result);
  100. }
  101. public function bankAccountInfo()
  102. {
  103. $result = MasterWorkerInfoLogic::bankAccountInfo($this->userId);
  104. return $this->data($result);
  105. }
  106. /**
  107. * 客服电话
  108. * @return \think\response\Json
  109. */
  110. public function customerPhone()
  111. {
  112. $result = DictData::where(['type_value' => 'customer_support'])->column('value', 'name');
  113. return $this->data($result);
  114. }
  115. public function setInfo()
  116. {
  117. $params = (new MasterWokerValidate())->post()->goCheck('setInfo');
  118. $result = MasterWorkerLogic::setInfo($this->userId, $params);
  119. if (false === $result) {
  120. return $this->fail(MasterWorkerLogic::getError(),['code'=>MasterWorkerLogic::getReturnCode(),'msg'=>MasterWorkerLogic::getError()]);
  121. }
  122. return $this->success('操作成功', [], 1, 1);
  123. }
  124. }