mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #10081 from rainzm/notify/imobile_default
feat(notify): add default area code for mobile
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user