|
@@ -133,4 +133,71 @@ class CoachInfoRecordController extends AdminController
|
|
|
|
|
|
return $this->autoResponse($result);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * [技师基本信息]修改技师基本信息
|
|
|
+ *
|
|
|
+ * @description 修改技师的基本信息,包括昵称、性别、手机号等基础字段
|
|
|
+ *
|
|
|
+ * @header x-xsrf-token required CSRF令牌 Example: your_csrf_token
|
|
|
+ *
|
|
|
+ * @bodyParam id integer required 记录ID Example: 1
|
|
|
+ * @bodyParam nickname string nullable 昵称(2-20个字符) Example: 张三
|
|
|
+ * @bodyParam avatar string nullable 头像图片 Example: path/to/avatar.jpg
|
|
|
+ * @bodyParam formal_photo string nullable 正装照片 Example: path/to/formal.jpg
|
|
|
+ * @bodyParam gender integer nullable 性别(1:男 2:女) Example: 1
|
|
|
+ * @bodyParam mobile string nullable 手机号 Example: 13800138000
|
|
|
+ * @bodyParam birthday date nullable 出生日期 Example: 1990-01-01
|
|
|
+ * @bodyParam work_years integer nullable 工作年限(0-99) Example: 5
|
|
|
+ * @bodyParam intention_city string nullable 意向城市 Example: 北京
|
|
|
+ * @bodyParam introduction string nullable 个人简介(最多255字符) Example: 专业按摩师,从业5年
|
|
|
+ * @bodyParam life_photos array nullable 生活照片数组
|
|
|
+ * @bodyParam life_photos.* string required 生活照片路径 Example: path/to/photo.jpg
|
|
|
+ *
|
|
|
+ * @response scenario=success {
|
|
|
+ * "code": 200,
|
|
|
+ * "message": "修改成功"
|
|
|
+ * }
|
|
|
+ *
|
|
|
+ * @response status=404 scenario="不存在" {
|
|
|
+ * "message": "记录不存在"
|
|
|
+ * }
|
|
|
+ *
|
|
|
+ * @response status=422 scenario="验证失败" {
|
|
|
+ * "message": "验证错误",
|
|
|
+ * "errors": {
|
|
|
+ * "nickname": ["昵称不能少于2个字符"],
|
|
|
+ * "gender": ["性别只能是1(男)或2(女)"],
|
|
|
+ * "mobile": ["手机号格式不正确"]
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ */
|
|
|
+ public function updateInfo(Request $request)
|
|
|
+ {
|
|
|
+ $validated = $request->validate([
|
|
|
+ 'id' => 'required|integer|exists:coach_info_records,id',
|
|
|
+ 'nickname' => 'nullable|string|min:2|max:20',
|
|
|
+ 'avatar' => 'nullable|string',
|
|
|
+ 'formal_photo' => 'nullable|string',
|
|
|
+ 'gender' => 'nullable|integer|in:1,2',
|
|
|
+ 'mobile' => 'nullable|string|regex:/^1[3-9]\d{9}$/',
|
|
|
+ 'birthday' => 'nullable|date',
|
|
|
+ 'work_years' => 'nullable|integer|min:0|max:99',
|
|
|
+ 'intention_city' => 'nullable|string|max:50',
|
|
|
+ 'introduction' => 'nullable|string|max:255',
|
|
|
+ 'life_photos' => 'nullable|array',
|
|
|
+ 'life_photos.*' => 'required|string',
|
|
|
+ ], [
|
|
|
+ 'nickname.min' => '昵称不能少于2个字符',
|
|
|
+ 'nickname.max' => '昵称不能超过20个字符',
|
|
|
+ 'gender.in' => '性别只能是1(男)或2(女)',
|
|
|
+ 'mobile.regex' => '手机号格式不正确',
|
|
|
+ 'work_years.min' => '工作年限不能小于0年',
|
|
|
+ 'work_years.max' => '工作年限不能超过99年',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $result = $this->service->updateInfo($validated);
|
|
|
+
|
|
|
+ return $this->autoResponse($result);
|
|
|
+ }
|
|
|
}
|