|
@@ -7,6 +7,7 @@ import (
|
|
IC "jyBXSubscribe/rpc/init"
|
|
IC "jyBXSubscribe/rpc/init"
|
|
"jyBXSubscribe/rpc/type/bxsubscribe"
|
|
"jyBXSubscribe/rpc/type/bxsubscribe"
|
|
"jyBXSubscribe/rpc/util"
|
|
"jyBXSubscribe/rpc/util"
|
|
|
|
+ "regexp"
|
|
)
|
|
)
|
|
|
|
|
|
type PushSetService struct {
|
|
type PushSetService struct {
|
|
@@ -214,7 +215,11 @@ func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp) (bool,
|
|
return true, returnData
|
|
return true, returnData
|
|
|
|
|
|
}
|
|
}
|
|
-func (this *PushSetService) SetUser(mail string) bool {
|
|
|
|
|
|
+func (this *PushSetService) SetUser(mail string) (bool, string) {
|
|
|
|
+ var emailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
|
|
|
|
+ if !emailPattern.MatchString(mail) {
|
|
|
|
+ return false, "邮箱格式不正确"
|
|
|
|
+ }
|
|
set := map[string]interface{}{
|
|
set := map[string]interface{}{
|
|
"o_pushset.s_email": mail,
|
|
"o_pushset.s_email": mail,
|
|
}
|
|
}
|
|
@@ -228,5 +233,5 @@ func (this *PushSetService) SetUser(mail string) bool {
|
|
"$set": set,
|
|
"$set": set,
|
|
}, true, false)
|
|
}, true, false)
|
|
}
|
|
}
|
|
- return update
|
|
|
|
|
|
+ return update, ""
|
|
}
|
|
}
|