JM-WechatMini/utils/desensitization.go

17 lines
324 B
Go
Raw Permalink Normal View History

2023-11-02 04:34:46 +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
}