Lee-WineList/utils/desensitization.go

17 lines
324 B
Go
Raw Normal View History

2023-04-24 17:19:41 +08:00
package utils
type desensitization struct{}
// Desensitization 暴露接口 - 脱敏相关
func Desensitization() *desensitization {
return &desensitization{}
}
// Phone 脱敏手机号
func (desensitization) Phone(phone string) string {
if len(phone) == 11 {
return phone[:3] + "****" + phone[7:]
}
return phone
}