MasterWokerController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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\MasterWokerInfoValidate;
  7. use app\workerapi\validate\MasterWokerValidate;
  8. class MasterWokerController extends BaseApiController
  9. {
  10. /**
  11. * @notes 修改密码
  12. * @return \think\response\Json
  13. * @author 段誉
  14. * @date 2022/9/20 19:16
  15. */
  16. public function changePassword()
  17. {
  18. $params = (new MasterWokerValidate())->post()->goCheck('changePassword');
  19. $result = MasterWorkerLogic::changePassword($params, $this->userId);
  20. if (true === $result) {
  21. return $this->success('操作成功', [], 1, 1);
  22. }
  23. return $this->fail(MasterWorkerLogic::getError());
  24. }
  25. /**
  26. * 更改手机号
  27. * @return void
  28. * @author 林海涛
  29. * @date 2024/7/10 下午2:23
  30. */
  31. public function changeMobile()
  32. {
  33. $params = (new MasterWokerValidate())->post()->goCheck('changeMobile');
  34. $result = MasterWorkerLogic::changeMobile($params, $this->userId);
  35. if (true === $result) {
  36. return $this->success('操作成功', [], 1, 1);
  37. }
  38. return $this->fail(MasterWorkerLogic::getError());
  39. }
  40. /**
  41. * 更改身份证信息
  42. * @return \think\response\Json
  43. * @author 林海涛
  44. * @date 2024/7/10 下午4:46
  45. */
  46. public function changeIdCard()
  47. {
  48. $params = (new MasterWokerInfoValidate())->post()->goCheck('changeIdCard');
  49. $result = MasterWorkerInfoLogic::changeIdCard($params, $this->userId);
  50. if (true === $result) {
  51. return $this->success('操作成功', [], 1, 1);
  52. }
  53. return $this->fail(MasterWorkerInfoLogic::getError());
  54. }
  55. /**
  56. * 注销账号
  57. * @return \think\response\Json
  58. * @author 林海涛
  59. * @date 2024/7/10 下午4:46
  60. */
  61. public function logOff()
  62. {
  63. $result = MasterWorkerLogic::logOff($this->userId);
  64. if (true === $result) {
  65. LoginLogic::logout($this->userInfo);
  66. return $this->success('操作成功', [], 1, 1);
  67. }
  68. return $this->fail(MasterWorkerInfoLogic::getError());
  69. }
  70. }