WH01243 2 жил өмнө
parent
commit
6e403311b8

+ 1 - 1
jyBXSubscribe/api/internal/logic/setPushSetLogic.go

@@ -49,6 +49,6 @@ func (l *SetPushSetLogic) SetPushSet(req *types.SetPushSetReq) (*types.CommonRes
 	return &types.CommonResp{
 		Err_code: res.ErrorCode,
 		Err_msg:  res.ErrorMsg,
-		Data:     res,
+		Data:     nil,
 	}, nil
 }

+ 1 - 1
jyBXSubscribe/api/internal/logic/setUserLogic.go

@@ -44,6 +44,6 @@ func (l *SetUserLogic) SetUser(req *types.SetUserReq) (*types.CommonResp, error)
 	return &types.CommonResp{
 		Err_code: res.ErrorCode,
 		Err_msg:  res.ErrorMsg,
-		Data:     res,
+		Data:     nil,
 	}, nil
 }

+ 2 - 2
jyBXSubscribe/rpc/internal/logic/setpushsetlogic.go

@@ -36,11 +36,11 @@ func (l *SetPushSetLogic) SetPushSet(in *bxsubscribe.SetPushSetReq) (*bxsubscrib
 	fool := subService.Update(in.Item, in.SetType, in.PushType, in.Ratemode, in.PushValue, in.Interested, in.Times)
 	if fool {
 		return &bxsubscribe.StatusResp{
-			Status: 1,
+			ErrorCode: 1,
 		}, nil
 	} else {
 		return &bxsubscribe.StatusResp{
-			Status: 0,
+			ErrorCode: 0,
 		}, nil
 	}
 

+ 4 - 3
jyBXSubscribe/rpc/internal/logic/setuserlogic.go

@@ -32,14 +32,15 @@ func (l *SetUserLogic) SetUser(in *bxsubscribe.SetUserInfoReq) (*bxsubscribe.Sta
 		EntUserId:    in.EntUserId,
 		EntId:        in.EntId,
 	}
-	fool := subService.SetUser(in.Mail)
+	fool, msg := subService.SetUser(in.Mail)
 	if fool {
 		return &bxsubscribe.StatusResp{
-			Status: 1,
+			ErrorCode: 1,
 		}, nil
 	} else {
 		return &bxsubscribe.StatusResp{
-			Status: 0,
+			ErrorCode: 0,
+			ErrorMsg:  msg,
 		}, nil
 	}
 }

+ 7 - 2
jyBXSubscribe/rpc/model/service/pushSet.go

@@ -7,6 +7,7 @@ import (
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/type/bxsubscribe"
 	"jyBXSubscribe/rpc/util"
+	"regexp"
 )
 
 type PushSetService struct {
@@ -214,7 +215,11 @@ func pushSetMontage(in interface{}, name string, powerData *pb.CheckResp) (bool,
 	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{}{
 		"o_pushset.s_email": mail,
 	}
@@ -228,5 +233,5 @@ func (this *PushSetService) SetUser(mail string) bool {
 			"$set": set,
 		}, true, false)
 	}
-	return update
+	return update, ""
 }