瀏覽代碼

feat:修改协议文件

wangchuanjin 3 年之前
父節點
當前提交
2eae7b8a26
共有 1 個文件被更改,包括 10 次插入9 次删除
  1. 10 9
      rpc/internal/logic/powerhandlelogic.go

+ 10 - 9
rpc/internal/logic/powerhandlelogic.go

@@ -36,17 +36,15 @@ func (l *PowerHandleLogic) PowerHandle(in *pb.PowerReq) (*pb.Resp, error) {
 	} else if in.UserId == 0 && in.EntId == 0 {
 		l.Error(fmt.Sprintf("%+v", in), "无效的参数user_id、ent_id")
 		return resp, nil
-	} else if in.StartTime == "" {
-		l.Error(fmt.Sprintf("%+v", in), "无效的参数start_time")
-		return resp, nil
-	} else if in.EndTime == "" {
-		l.Error(fmt.Sprintf("%+v", in), "无效的参数end_time")
-		return resp, nil
-	} else if in.Type != 1 && in.Type != -1 {
-		l.Error(fmt.Sprintf("%+v", in), "无效的参数type")
-		return resp, nil
 	}
 	if in.Type == 1 { //开通
+		if in.StartTime == "" {
+			l.Error(fmt.Sprintf("%+v", in), "无效的参数start_time")
+			return resp, nil
+		} else if in.EndTime == "" {
+			l.Error(fmt.Sprintf("%+v", in), "无效的参数end_time")
+			return resp, nil
+		}
 		list := Base_goods_function.FindByGoodsCode(in.Appid, in.GoodsCode)
 		if list != nil {
 			if Base_power.OpenPower(in.Appid, in.GoodsCode, in.UserId, in.EntId, in.StartTime, in.EndTime, in.UseCount, list) {
@@ -57,6 +55,9 @@ func (l *PowerHandleLogic) PowerHandle(in *pb.PowerReq) (*pb.Resp, error) {
 		if Base_power.CancelPower(in.Appid, in.GoodsCode, in.UserId, in.EntId) {
 			return &pb.Resp{Status: 1}, nil
 		}
+	} else {
+		l.Error(fmt.Sprintf("%+v", in), "无效的参数type")
+		return resp, nil
 	}
 	return &pb.Resp{}, nil
 }