AccountController.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace App\Http\Controllers\Coach;
  3. use App\Http\Controllers\Controller;
  4. use App\Services\Coach\AccountService;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Support\Facades\Auth;
  7. /**
  8. * @group 技师端
  9. *
  10. * 技师账户相关的API接口
  11. */
  12. class AccountController extends Controller
  13. {
  14. protected AccountService $service;
  15. public function __construct(AccountService $service)
  16. {
  17. $this->service = $service;
  18. }
  19. /**
  20. * [账户]提交基本信息
  21. *
  22. * @description 提交技师的基本个人信息
  23. *
  24. * @authenticated
  25. *
  26. * @bodyParam nickname string required 昵称 Example: 张三
  27. * @bodyParam avatar string required 头像URL Example: http://example.com/avatar.jpg
  28. * @bodyParam gender string required 性别 Example: 1
  29. * @bodyParam mobile string required 手机号 Example: 13800138000
  30. * @bodyParam birthday date required 出生日期 Example: 1990-01-01
  31. * @bodyParam work_years integer required 工作年限 Example: 5
  32. * @bodyParam intention_city string required 意向城市 Example: 北京
  33. * @bodyParam introduction string required 个人简介 Example: 专业按摩师,从业5年
  34. *
  35. * @response {
  36. * "message": "基本信息提交成功"
  37. * }
  38. */
  39. public function submitBaseInfo(Request $request)
  40. {
  41. $data = $request->validate([
  42. 'nickname' => 'required|string|max:255',
  43. 'avatar' => 'required|url|max:255',
  44. 'gender' => 'required|string|max:255',
  45. 'mobile' => 'required|string|max:255',
  46. 'birthday' => 'required|date',
  47. 'work_years' => 'required|integer',
  48. 'intention_city' => 'required|string|max:255',
  49. 'introduction' => 'required|string|max:255',
  50. ]);
  51. return $this->service->submitBaseInfo(Auth::user()->id, $data);
  52. }
  53. /**
  54. * [账户]提交资质信息
  55. *
  56. * @description 提交技师的资质认证信息
  57. *
  58. * @authenticated
  59. *
  60. * @bodyParam qual_type string required 资质类型 Example: 高级按摩师
  61. * @bodyParam qual_no string required 资质证书编号 Example: XZ2024001
  62. * @bodyParam qual_photo string required 资质证书照片 Example: http://example.com/cert.jpg
  63. * @bodyParam valid_start date required 有效期开始日期 Example: 2024-01-01
  64. * @bodyParam valid_end date required 有效期结束日期 Example: 2029-01-01
  65. *
  66. * @response {
  67. * "message": "资质信息提交成功"
  68. * }
  69. */
  70. public function submitQualification(Request $request)
  71. {
  72. $data = $request->validate([
  73. 'qual_type' => 'required|string|max:255',
  74. 'qual_no' => 'required|string|max:255',
  75. 'qual_photo' => 'required|string|max:255|url',
  76. 'valid_start' => 'required|date',
  77. 'valid_end' => 'required|date|after:valid_start',
  78. ]);
  79. return $this->service->submitQualification(Auth::user()->id, $data);
  80. }
  81. /**
  82. * [账户]提交实名认证
  83. *
  84. * @description 提交技师的实名认证信息
  85. *
  86. * @authenticated
  87. *
  88. * @bodyParam real_name string required 姓名 Example: 张三
  89. * @bodyParam id_card string required 身份证号 Example: 370602199001011234
  90. * @bodyParam id_card_front_photo string required 身份证正面照片 Example: http://example.com/front.jpg
  91. * @bodyParam id_card_back_photo string required 身份证反面照片 Example: http://example.com/back.jpg
  92. * @bodyParam id_card_hand_photo string required 手持身份证照片 Example: http://example.com/hold.jpg
  93. *
  94. * @response {
  95. * "message": "实名认证信息提交成功"
  96. * }
  97. */
  98. public function submitRealName(Request $request)
  99. {
  100. $data = $request->validate([
  101. 'real_name' => 'required|string|max:50',
  102. 'id_card' => 'required|string|size:18',
  103. 'id_card_front_photo' => 'required|string|max:255|url',
  104. 'id_card_back_photo' => 'required|string|max:255|url',
  105. 'id_card_hand_photo' => 'required|string|max:255|url',
  106. ]);
  107. return $this->service->submitRealName(Auth::user()->id, $data);
  108. }
  109. }