添加用户信息更新接口,掩码敏感信息;修正 ContactQQ 字段命名
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user