1
0

MasterWorkerController.php 5.5 KB

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