Merge pull request #10081 from rainzm/notify/imobile_default

feat(notify): add default area code for mobile
This commit is contained in:
Zexi Li
2021-01-30 10:37:26 +08:00
committed by GitHub
+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{