|
|
@@ -13,11 +13,26 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
13
|
13
|
import org.springframework.web.bind.annotation.RestController;
|
|
14
|
14
|
|
|
15
|
15
|
/**
|
|
16
|
|
- * 小程序通用接口。
|
|
|
16
|
+ * 小程序用户档案接口。
|
|
|
17
|
+ * <p>
|
|
|
18
|
+ * 登录后查询当前用户的登记状态及企业/临时工详情,供前端判断是否跳转登记页。
|
|
|
19
|
+ * 路径 {@code /api/v1/mp/getInfo},需 JWT 鉴权(Header 携带 {@code Authorization: Bearer <token>})。
|
|
|
20
|
+ * </p>
|
|
|
21
|
+ * <p>
|
|
|
22
|
+ * 典型调用时机:
|
|
|
23
|
+ * <ul>
|
|
|
24
|
+ * <li>短信登录成功后,结合 {@code newUser} 或 {@code registered} 决定跳转登记页或首页</li>
|
|
|
25
|
+ * <li>App 冷启动时校验 Token 有效且档案是否已完善</li>
|
|
|
26
|
+ * </ul>
|
|
|
27
|
+ * </p>
|
|
|
28
|
+ * <p>
|
|
|
29
|
+ * 按 {@code userType} 返回不同结构:
|
|
|
30
|
+ * {@code enterprise} 时 {@code enterprise} 有值;{@code worker} 时 {@code worker} 有值;未登记时对应字段为 {@code null}。
|
|
|
31
|
+ * </p>
|
|
17
|
32
|
*/
|
|
18
|
33
|
@RestController
|
|
19
|
34
|
@RequestMapping("/api/v1/mp")
|
|
20
|
|
-@Tag(name = "小程序", description = "用户信息等")
|
|
|
35
|
+@Tag(name = "用户档案", description = "登记状态查询,需 JWT 鉴权")
|
|
21
|
36
|
@SecurityRequirement(name = "Authorization")
|
|
22
|
37
|
public class ProfileController {
|
|
23
|
38
|
|
|
|
@@ -27,6 +42,29 @@ public class ProfileController {
|
|
27
|
42
|
this.profileService = profileService;
|
|
28
|
43
|
}
|
|
29
|
44
|
|
|
|
45
|
+ /**
|
|
|
46
|
+ * 查询当前用户登记状态与档案详情。
|
|
|
47
|
+ * <p>
|
|
|
48
|
+ * 从 JWT 解析 {@code userId}、{@code userType},无需额外请求参数。
|
|
|
49
|
+ * </p>
|
|
|
50
|
+ * <p>
|
|
|
51
|
+ * 响应字段说明:
|
|
|
52
|
+ * <ul>
|
|
|
53
|
+ * <li>{@code userType} — 用户类型:{@code enterprise}(企业主)/ {@code worker}(临时工)</li>
|
|
|
54
|
+ * <li>{@code registered} — 是否已完成档案登记;{@code false} 时应跳转对应登记页</li>
|
|
|
55
|
+ * <li>{@code mobileMask} — 登录账号手机号脱敏,如 {@code 138****8000}</li>
|
|
|
56
|
+ * <li>{@code enterprise} — 企业登记信息(仅 {@code userType=enterprise} 且已登记时有值)</li>
|
|
|
57
|
+ * <li>{@code worker} — 临时工登记信息(仅 {@code userType=worker} 且已登记时有值)</li>
|
|
|
58
|
+ * </ul>
|
|
|
59
|
+ * </p>
|
|
|
60
|
+ * <p>
|
|
|
61
|
+ * 未登记时前端跳转:
|
|
|
62
|
+ * {@code enterprise} → {@code POST /api/v1/mp/enterprise/register};
|
|
|
63
|
+ * {@code worker} → {@code POST /api/v1/mp/worker/register}。
|
|
|
64
|
+ * </p>
|
|
|
65
|
+ *
|
|
|
66
|
+ * @return 用户类型、登记状态及企业/临时工档案(脱敏字段)
|
|
|
67
|
+ */
|
|
30
|
68
|
@GetMapping("/getInfo")
|
|
31
|
69
|
@Operation(summary = "查询当前用户登记状态与详情")
|
|
32
|
70
|
public R<MpUserInfoResponse> getInfo() {
|