Explorar el Código

feat: 增加注册时间

zhangxinlei1996 hace 2 años
padre
commit
86c294a87b
Se han modificado 5 ficheros con 41 adiciones y 8 borrados
  1. 1 0
      entity/power.go
  2. 9 0
      rpc/internal/logic/checklogic.go
  3. 22 2
      rpc/pb/powerCheck.pb.go
  4. 2 0
      rpc/powerCheck.proto
  5. 7 6
      service/power.go

+ 1 - 0
entity/power.go

@@ -22,6 +22,7 @@ type Free struct {
 	FreeBuyerPort int64 //免费用户可查看采购单位画像次数
 	FreeFile      int64 //免费用户可以进行附件下载次数
 	IsUpgrade     bool  //是否是新免费用户
+	Registedate   int64 //注册时间
 }
 
 //超级订阅相关

+ 9 - 0
rpc/internal/logic/checklogic.go

@@ -89,6 +89,15 @@ func (l *CheckLogic) Check(in *pb.CheckReq) (*pb.CheckResp, error) {
 			IsEntPower:  data.Entniche.IsEntPower,
 			IsNew:       data.Entniche.IsNew,
 		}
+		resp.Free = &pb.Free{
+			IsFree:        data.Free.IsFree,
+			FreeHasKey:    data.Free.FreeHasKey,
+			FreeEntPort:   data.Free.FreeEntPort,
+			FreeBuyerPort: data.Free.FreeBuyerPort,
+			FreeFile:      data.Free.FreeFile,
+			Registedate:   data.Free.Registedate,
+			IsUpgrade:     data.Free.IsUpgrade,
+		}
 	}
 	return &pb.CheckResp{}, nil
 }

+ 22 - 2
rpc/pb/powerCheck.pb.go

@@ -773,6 +773,8 @@ type Free struct {
 	FreeEntPort   int64 `protobuf:"varint,3,opt,name=freeEntPort,proto3" json:"freeEntPort,omitempty"`     //免费用户可查看企业画像次数
 	FreeBuyerPort int64 `protobuf:"varint,4,opt,name=freeBuyerPort,proto3" json:"freeBuyerPort,omitempty"` //免费用户可查看采购单位画像次数
 	FreeFile      int64 `protobuf:"varint,5,opt,name=freeFile,proto3" json:"freeFile,omitempty"`           //免费用户可以进行附件下载次数
+	Registedate   int64 `protobuf:"varint,6,opt,name=registedate,proto3" json:"registedate,omitempty"`     //注册时间
+	IsUpgrade     bool  `protobuf:"varint,7,opt,name=isUpgrade,proto3" json:"isUpgrade,omitempty"`         //是否是新免费用户
 }
 
 func (x *Free) Reset() {
@@ -842,6 +844,20 @@ func (x *Free) GetFreeFile() int64 {
 	return 0
 }
 
+func (x *Free) GetRegistedate() int64 {
+	if x != nil {
+		return x.Registedate
+	}
+	return 0
+}
+
+func (x *Free) GetIsUpgrade() bool {
+	if x != nil {
+		return x.IsUpgrade
+	}
+	return false
+}
+
 var File_powerCheck_proto protoreflect.FileDescriptor
 
 var file_powerCheck_proto_rawDesc = []byte{
@@ -958,7 +974,7 @@ var file_powerCheck_proto_rawDesc = []byte{
 	0x47, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, 0x56, 0x69, 0x70, 0x18, 0x0a, 0x20, 0x01,
 	0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x79, 0x56, 0x69, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x75,
 	0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x62,
-	0x75, 0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xa2, 0x01, 0x0a, 0x04, 0x46, 0x72, 0x65,
+	0x75, 0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xe2, 0x01, 0x0a, 0x04, 0x46, 0x72, 0x65,
 	0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x46, 0x72, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
 	0x08, 0x52, 0x06, 0x69, 0x73, 0x46, 0x72, 0x65, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x72, 0x65,
 	0x65, 0x48, 0x61, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66,
@@ -968,7 +984,11 @@ var file_powerCheck_proto_rawDesc = []byte{
 	0x72, 0x65, 0x65, 0x42, 0x75, 0x79, 0x65, 0x72, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01,
 	0x28, 0x03, 0x52, 0x0d, 0x66, 0x72, 0x65, 0x65, 0x42, 0x75, 0x79, 0x65, 0x72, 0x50, 0x6f, 0x72,
 	0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x65, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x05, 0x20,
-	0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x65, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x32, 0x2c, 0x0a,
+	0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x72, 0x65, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x20, 0x0a,
+	0x0b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x64, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x0b, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x64, 0x61, 0x74, 0x65, 0x12,
+	0x1c, 0x0a, 0x09, 0x69, 0x73, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01,
+	0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x32, 0x2c, 0x0a,
 	0x0a, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1e, 0x0a, 0x05, 0x43,
 	0x68, 0x65, 0x63, 0x6b, 0x12, 0x09, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a,
 	0x0a, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e,

+ 2 - 0
rpc/powerCheck.proto

@@ -94,6 +94,8 @@ message Free {
     int64 freeEntPort = 3; //免费用户可查看企业画像次数
     int64 freeBuyerPort = 4; //免费用户可查看采购单位画像次数
     int64 freeFile = 5; //免费用户可以进行附件下载次数
+    int64 registedate = 6;//注册时间
+    bool isUpgrade = 7;//是否是新免费用户
 }
 
 service powerCheck {

+ 7 - 6
service/power.go

@@ -35,7 +35,9 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId int6
 		entniche := &entity.Entniche{}
 		vip := &entity.Vip{}
 		member := &entity.Member{}
+		free := &entity.Free{}
 		registeDate := common.Int64All((*data)["l_registedate"]) //注册时间
+		free.Registedate = registeDate
 		//VIP
 		vipStatus := common.Int64All((*data)["i_vip_status"])
 		vipStartTime := common.Int64All((*data)["l_vip_starttime"])
@@ -57,7 +59,6 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId int6
 			//TODO 附件下载次数
 		}
 		//免费相关
-		free := &entity.Free{}
 		o_jy, _ := (*data)["o_jy"].(map[string]interface{})
 		a_key, _ := o_jy["a_key"].([]interface{})
 		free.FreeHasKey = len(a_key) > 0
@@ -196,11 +197,11 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId int6
 				ent.PrivateGD = this.Conn.Mysql.CountBySql(`select count(1) from privatedata where phone = ?`, phone) > 0
 			}
 		}
-		log.Println("vip:", vip)
-		log.Println("member:", member)
-		log.Println("free:", free)
-		log.Println("ent:", ent)
-		log.Println("entniche:", entniche)
+		if vip.Status <= 0 && member.Status <= 0 && entniche.Status <= 0 {
+			free.IsFree = true
+		} else {
+			free.IsFree = false
+		}
 		return &entity.Power{
 			Vip:      vip,
 			Member:   member,