MasterWorkerController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace app\workerapi\controller;
  3. use app\workerapi\logic\LoginLogic;
  4. use app\workerapi\logic\MasterWorkerInfoLogic;
  5. use app\workerapi\logic\MasterWorkerLogic;
  6. use app\workerapi\validate\BankAccountValidate;
  7. use app\workerapi\validate\MasterWokerInfoValidate;
  8. use app\workerapi\validate\MasterWokerValidate;
  9. class MasterWorkerController extends BaseApiController
  10. {
  11. /**
  12. * @notes 修改密码
  13. * @return \think\response\Json
  14. * @author 段誉
  15. * @date 2022/9/20 19:16
  16. */
  17. public function changePassword()
  18. {
  19. $params = (new MasterWokerValidate())->post()->goCheck('changePassword');
  20. $result = MasterWorkerLogic::changePassword($params, $this->userId);
  21. if (true === $result) {
  22. return $this->success('操作成功', [], 1, 1);
  23. }
  24. return $this->fail(MasterWorkerLogic::getError());
  25. }
  26. /**
  27. * 更改手机号
  28. * @return void
  29. * @author 林海涛
  30. * @date 2024/7/10 下午2:23
  31. */
  32. public function changeMobile()
  33. {
  34. $params = (new MasterWokerValidate())->post()->goCheck('changeMobile');
  35. $result = MasterWorkerLogic::changeMobile($params, $this->userId);
  36. if (true === $result) {
  37. return $this->success('操作成功', [], 1, 1);
  38. }
  39. return $this->fail(MasterWorkerLogic::getError());
  40. }
  41. /**
  42. * 更改身份证信息
  43. * @return \think\response\Json
  44. * @author 林海涛
  45. * @date 2024/7/10 下午4:46
  46. */
  47. public function changeIdCard()
  48. {
  49. $params = (new MasterWokerInfoValidate())->post()->goCheck('changeIdCard');
  50. $result = MasterWorkerInfoLogic::changeIdCard($params, $this->userId);
  51. if (true === $result) {
  52. return $this->success('操作成功', [], 1, 1);
  53. }
  54. return $this->fail(MasterWorkerInfoLogic::getError());
  55. }
  56. /**
  57. * 注销账号
  58. * @return \think\response\Json
  59. * @author 林海涛
  60. * @date 2024/7/10 下午4:46
  61. */
  62. public function logOff()
  63. {
  64. $result = MasterWorkerLogic::logOff($this->userId);
  65. if (true === $result) {
  66. LoginLogic::logout($this->userInfo);
  67. return $this->success('操作成功', [], 1, 1);
  68. }
  69. return $this->fail(MasterWorkerInfoLogic::getError());
  70. }
  71. /**
  72. * 绑定银行卡
  73. * @return \think\response\Json
  74. * @author 林海涛
  75. * @date 2024/7/11 下午4:27
  76. */
  77. public function bindBankAccount()
  78. {
  79. $params = (new BankAccountValidate())->post()->goCheck('bindBankAccount');
  80. $result = MasterWorkerInfoLogic::bindBankAccount($params, $this->userId);
  81. if (true === $result) {
  82. return $this->success('操作成功', [], 1, 1);
  83. }
  84. return $this->fail(MasterWorkerInfoLogic::getError());
  85. }
  86. public function myInfo()
  87. {
  88. $result = MasterWorkerLogic::detail($this->userId);
  89. return $this->data($result);
  90. }
  91. }