添加用户信息更新接口,掩码敏感信息;修正 ContactQQ 字段命名

This commit is contained in:
2025-04-29 18:48:14 +08:00
parent 2fa8b4d540
commit f2ea7b152a
7 changed files with 169 additions and 20 deletions

View File

@@ -313,7 +313,28 @@ func Introspect(c *fiber.Ctx) error {
return err
}
// 掩码敏感信息
if profile.Phone != "" {
profile.Phone = maskPhone(profile.Phone)
}
if profile.IDNo != "" {
profile.IDNo = maskIdNo(profile.IDNo)
}
return c.JSON(IntrospectResp{*profile})
}
func maskPhone(phone string) string {
if len(phone) < 11 {
return phone
}
return phone[:3] + "****" + phone[7:]
}
func maskIdNo(idNo string) string {
if len(idNo) < 18 {
return idNo
}
return idNo[:3] + "*********" + idNo[14:]
}
// endregion