17 lines
324 B
Go
17 lines
324 B
Go
|
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
|
||
|
}
|