feat(notify): add default area code for mobile

This commit is contained in:
rainzm
2021-01-28 19:31:53 +08:00
parent dffeb37260
commit 70c767c10c
+6 -2
View File
@@ -54,13 +54,17 @@ type SInternationalMobile struct {
AreaCode string `json:"area_code"`
}
var pareser = regexp.MustCompile(`\+(\d*) (.*)`)
var (
defaultAreaCode = "86"
pareser = regexp.MustCompile(`\+(\d*) (.*)`)
)
func ParseInternationalMobile(mobile string) SInternationalMobile {
matchs := pareser.FindStringSubmatch(mobile)
if len(matchs) == 0 {
return SInternationalMobile{
Mobile: mobile,
AreaCode: defaultAreaCode,
Mobile: mobile,
}
}
return SInternationalMobile{