AuthController.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. namespace App\Http\Controllers\Coach;
  3. use App\Http\Controllers\Controller;
  4. use App\Http\Requests\Coach\Auth\BasicInfoRequest;
  5. use App\Http\Requests\Coach\Auth\QualAuthRequest;
  6. use App\Http\Requests\Coach\Auth\RealAuthRequest;
  7. use App\Services\Coach\AuthService;
  8. class AuthController extends Controller
  9. {
  10. protected AuthService $service;
  11. public function __construct(AuthService $service)
  12. {
  13. $this->service = $service;
  14. }
  15. /**
  16. * 技师认证-提交基本信息认证
  17. *
  18. * @group 技师认证
  19. *
  20. * @bodyParam nickname string required 昵称
  21. * @bodyParam avatar string 头像地址
  22. * @bodyParam gender integer required 性别(1:男,2:女)
  23. * @bodyParam mobile string required 手机号
  24. * @bodyParam age integer required 年龄(18-60岁)
  25. * @bodyParam birthday date 出生日期 Example: 1990-01-01
  26. * @bodyParam work_years integer 工作年限(0-50年)
  27. * @bodyParam intention_city string required 意向城市
  28. * @bodyParam introduction string 个人简介(最多1000字)
  29. * @bodyParam portrait_images array required 形象照片(1-6张)
  30. * @bodyParam portrait_images.* string required 形象照片地址
  31. *
  32. * @response {
  33. * "code": 0,
  34. * "message": "操作成功",
  35. * "data": {
  36. * "id": 1,
  37. * "state": 1,
  38. * "state_text": "审核中"
  39. * }
  40. * }
  41. */
  42. public function submitBasicInfo(BasicInfoRequest $request): array
  43. {
  44. $data = $request->validated();
  45. return $this->success($this->service->submitBasicInfo($data));
  46. }
  47. /**
  48. * 技师认证-提交实名认证
  49. *
  50. * @group 技师认证
  51. *
  52. * @bodyParam real_name string required 真实姓名
  53. * @bodyParam id_card string required 身份证号(18位)
  54. * @bodyParam id_card_front_photo string required 身份证正面照片
  55. * @bodyParam id_card_back_photo string required 身份���反面照片
  56. * @bodyParam id_card_hand_photo string required 手持身份证照片
  57. *
  58. * @response {
  59. * "code": 0,
  60. * "message": "操作成功",
  61. * "data": {
  62. * "record": {
  63. * "id": 1,
  64. * "state": 1,
  65. * "state_text": "审核中"
  66. * },
  67. * "can_proceed": true,
  68. * "message": "实名认证提交成功,系统正在审核,您可以继续提交资质认证"
  69. * }
  70. * }
  71. */
  72. public function submitRealAuth(RealAuthRequest $request): array
  73. {
  74. $data = $request->validated();
  75. return $this->success($this->service->submitRealAuth($data));
  76. }
  77. /**
  78. * 技师认证-提交资质认证
  79. *
  80. * @group 技师认证
  81. *
  82. * @bodyParam qual_type string required 资质类型
  83. * @bodyParam qual_no string 资质证书编号
  84. * @bodyParam qual_photo string required 资质证书照片
  85. * @bodyParam valid_start date 有效期开始日期 Example: 2024-01-01
  86. * @bodyParam valid_end date 有效期结束日期 Example: 2025-01-01
  87. *
  88. * @response {
  89. * "code": 0,
  90. * "message": "操作成功",
  91. * "data": {
  92. * "record": {
  93. * "id": 1,
  94. * "state": 1,
  95. * "state_text": "审核中"
  96. * },
  97. * "warning": "实名认证正在审核中,如审核失败可能需要重新提交资质认证"
  98. * }
  99. * }
  100. */
  101. public function submitQualAuth(QualAuthRequest $request): array
  102. {
  103. $data = $request->validated();
  104. return $this->success($this->service->submitQualAuth($data));
  105. }
  106. /**
  107. * 技师认证-获取认证状态
  108. *
  109. * @group 技师认证
  110. *
  111. * @response {
  112. * "code": 0,
  113. * "message": "操作成功",
  114. * "data": {
  115. * "basic_info": {
  116. * "state": 1,
  117. * "state_text": "审核中"
  118. * },
  119. * "real_auth": {
  120. * "state": 1,
  121. * "state_text": "审核中"
  122. * },
  123. * "qual_auth": {
  124. * "state": 1,
  125. * "state_text": "审核中"
  126. * }
  127. * }
  128. * }
  129. */
  130. public function getAuthStatus(): array
  131. {
  132. return $this->success($this->service->checkAuthStatus());
  133. }
  134. }