feat(notify): add default area code for mobile

This commit is contained in:
rainzm
2021-01-29 16:43:27 +08:00
parent f5f02b5e09
commit 5f9cee49b0
+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{