MasterWorkerController.php 3.4 KB

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