master
dian.chen 1 year ago
parent 7eb91b27bd
commit d0a3f92c58

@ -56,6 +56,7 @@ message Report
message ReportResult message ReportResult
{ {
ERROR_CODE Result = 1; ERROR_CODE Result = 1;
repeated AudienceInfo Info = 2;
} }
message GetRank message GetRank
@ -66,7 +67,7 @@ message GetRank
message GetRankResult message GetRankResult
{ {
ERROR_CODE Result = 1; ERROR_CODE Result = 1;
repeated ReportInfo Info = 2; repeated Audience Info = 2;
} }
// //
@ -77,7 +78,7 @@ message NotifyNewAudience
// //
message NotifyAudienceAction message NotifyAudienceAction
{ {
string OpenId = 1; string OpenId = 1; //ID
string Content = 2; // string Content = 2; //
int32 LikeNum = 3; // int32 LikeNum = 3; //
string GiftId = 4; //ID string GiftId = 4; //ID
@ -86,27 +87,35 @@ message NotifyAudienceAction
//======================== //========================
// //
message ReportInfo message ReportInfo
{ {
string OpenId = 1; string OpenId = 1;
int32 Score = 2; int32 Score = 2;
bool IsWin = 3;
} }
// //
message Audience message Audience
{ {
string OpenId = 1; AudienceBasic AudienceBasic = 1; //
string NickName = 2; AudienceInfo AudienceInfo = 2; //
string AvatarUrl = 3;
int32 Rank = 4; //
int32 WinningStreak = 5; //
} }
// //
message RankInfo message AudienceBasic
{ {
Audience Audience = 1; // string OpenId = 1; //ID
int32 Rank = 2; // string NickName = 2; //
int32 Score = 3; // string AvatarUrl = 3; //url
}
//
message AudienceInfo
{
string OpenId = 1; //ID
int32 Score = 2; //
int32 Rank = 3; //
int32 LastRank = 4; //
int32 WinningStreak = 5; //
} }

@ -1,8 +1,8 @@
@ echo off @ echo off
cd ./protoc/bin cd ./protoc/bin
set protoPath="../../" set protoPath="../../"
set clientPath="D:/white_snake/douyin_prj/Assets/Script/GameLogic/Proto" set clientPath="/"
set serverPath="D:/dy_server/service/main/message" set serverPath="../../../service/main/message"
protoc.exe -I=%protoPath% --csharp_out=%clientPath% --go_out=%serverPath% %protoPath%/*.proto protoc.exe -I=%protoPath% --csharp_out=%clientPath% --go_out=%serverPath% %protoPath%/*.proto
clang-format.exe -i -style="{AlignConsecutiveAssignments: true,AlignConsecutiveDeclarations: true,AllowShortFunctionsOnASingleLine: None,BreakBeforeBraces: GNU,ColumnLimit: 0,IndentWidth: 4,Language: Proto}" %protoPath%/*.proto clang-format.exe -i -style="{AlignConsecutiveAssignments: true,AlignConsecutiveDeclarations: true,AllowShortFunctionsOnASingleLine: None,BreakBeforeBraces: GNU,ColumnLimit: 0,IndentWidth: 4,Language: Proto}" %protoPath%/*.proto
pause pause

@ -54,7 +54,7 @@ func OnDataPush(c *gin.Context) {
return return
} }
var audienceData []*pb.Audience var audienceData []*pb.AudienceBasic
var notifyData []*pb.NotifyAudienceAction var notifyData []*pb.NotifyAudienceAction
switch msgType { switch msgType {
@ -73,7 +73,7 @@ func OnDataPush(c *gin.Context) {
return return
} }
for _, data := range rawData { for _, data := range rawData {
audienceData = append(audienceData, &pb.Audience{ audienceData = append(audienceData, &pb.AudienceBasic{
OpenId: data.SecOpenid, OpenId: data.SecOpenid,
NickName: data.NickName, NickName: data.NickName,
AvatarUrl: data.AvatarUrl, AvatarUrl: data.AvatarUrl,
@ -102,7 +102,7 @@ func OnDataPush(c *gin.Context) {
return return
} }
for _, data := range rawData { for _, data := range rawData {
audienceData = append(audienceData, &pb.Audience{ audienceData = append(audienceData, &pb.AudienceBasic{
OpenId: data.SecOpenid, OpenId: data.SecOpenid,
NickName: data.NickName, NickName: data.NickName,
AvatarUrl: data.AvatarUrl, AvatarUrl: data.AvatarUrl,
@ -127,7 +127,7 @@ func OnDataPush(c *gin.Context) {
return return
} }
for _, data := range rawData { for _, data := range rawData {
audienceData = append(audienceData, &pb.Audience{ audienceData = append(audienceData, &pb.AudienceBasic{
OpenId: data.SecOpenid, OpenId: data.SecOpenid,
NickName: data.NickName, NickName: data.NickName,
AvatarUrl: data.AvatarUrl, AvatarUrl: data.AvatarUrl,
@ -140,11 +140,10 @@ func OnDataPush(c *gin.Context) {
} }
for _, audience := range audienceData { for _, audience := range audienceData {
redis.SetAudience(appId, audience) redis.SetAudienceBasic(appId, audience)
} }
for _, notify := range notifyData { for _, notify := range notifyData {
redis.Publish(appId, roomId, notify) redis.Publish(appId, roomId, notify)
fmt.Println("[Publish]", appId, roomId)
} }
} }

@ -625,6 +625,7 @@ type ReportResult struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Result ERROR_CODE `protobuf:"varint,1,opt,name=Result,json=result,proto3,enum=message.ERROR_CODE" json:"Result,omitempty"` Result ERROR_CODE `protobuf:"varint,1,opt,name=Result,json=result,proto3,enum=message.ERROR_CODE" json:"Result,omitempty"`
Info []*AudienceInfo `protobuf:"bytes,2,rep,name=Info,json=info,proto3" json:"Info,omitempty"`
} }
func (x *ReportResult) Reset() { func (x *ReportResult) Reset() {
@ -674,11 +675,23 @@ func (x *ReportResult) GetResult() ERROR_CODE {
return ERROR_CODE_SUCCESS return ERROR_CODE_SUCCESS
} }
func (x *ReportResult) GetInfo() []*AudienceInfo {
if x != nil {
return x.Info
}
return nil
}
func (x *ReportResult) SetResult(val ERROR_CODE) { func (x *ReportResult) SetResult(val ERROR_CODE) {
if x != nil { if x != nil {
x.Result = val x.Result = val
} }
} }
func (x *ReportResult) SetInfo(val []*AudienceInfo) {
if x != nil {
x.Info = val
}
}
type GetRank struct { type GetRank struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -747,7 +760,7 @@ type GetRankResult struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Result ERROR_CODE `protobuf:"varint,1,opt,name=Result,json=result,proto3,enum=message.ERROR_CODE" json:"Result,omitempty"` Result ERROR_CODE `protobuf:"varint,1,opt,name=Result,json=result,proto3,enum=message.ERROR_CODE" json:"Result,omitempty"`
Info []*ReportInfo `protobuf:"bytes,2,rep,name=Info,json=info,proto3" json:"Info,omitempty"` Info []*Audience `protobuf:"bytes,2,rep,name=Info,json=info,proto3" json:"Info,omitempty"`
} }
func (x *GetRankResult) Reset() { func (x *GetRankResult) Reset() {
@ -797,7 +810,7 @@ func (x *GetRankResult) GetResult() ERROR_CODE {
return ERROR_CODE_SUCCESS return ERROR_CODE_SUCCESS
} }
func (x *GetRankResult) GetInfo() []*ReportInfo { func (x *GetRankResult) GetInfo() []*Audience {
if x != nil { if x != nil {
return x.Info return x.Info
} }
@ -809,7 +822,7 @@ func (x *GetRankResult) SetResult(val ERROR_CODE) {
x.Result = val x.Result = val
} }
} }
func (x *GetRankResult) SetInfo(val []*ReportInfo) { func (x *GetRankResult) SetInfo(val []*Audience) {
if x != nil { if x != nil {
x.Info = val x.Info = val
} }
@ -883,7 +896,7 @@ type NotifyAudienceAction struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
OpenId string `protobuf:"bytes,1,opt,name=OpenId,json=openId,proto3" json:"OpenId,omitempty"` OpenId string `protobuf:"bytes,1,opt,name=OpenId,json=openId,proto3" json:"OpenId,omitempty"` //ID
Content string `protobuf:"bytes,2,opt,name=Content,json=content,proto3" json:"Content,omitempty"` //评论 Content string `protobuf:"bytes,2,opt,name=Content,json=content,proto3" json:"Content,omitempty"` //评论
LikeNum int32 `protobuf:"varint,3,opt,name=LikeNum,json=likeNum,proto3" json:"LikeNum,omitempty"` //点赞数量 LikeNum int32 `protobuf:"varint,3,opt,name=LikeNum,json=likeNum,proto3" json:"LikeNum,omitempty"` //点赞数量
GiftId string `protobuf:"bytes,4,opt,name=GiftId,json=giftId,proto3" json:"GiftId,omitempty"` //礼物ID GiftId string `protobuf:"bytes,4,opt,name=GiftId,json=giftId,proto3" json:"GiftId,omitempty"` //礼物ID
@ -991,7 +1004,7 @@ func (x *NotifyAudienceAction) SetGiftNum(val int32) {
} }
} }
//分数信息 //上报分数信息
type ReportInfo struct { type ReportInfo struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -999,6 +1012,7 @@ type ReportInfo struct {
OpenId string `protobuf:"bytes,1,opt,name=OpenId,json=openId,proto3" json:"OpenId,omitempty"` OpenId string `protobuf:"bytes,1,opt,name=OpenId,json=openId,proto3" json:"OpenId,omitempty"`
Score int32 `protobuf:"varint,2,opt,name=Score,json=score,proto3" json:"Score,omitempty"` Score int32 `protobuf:"varint,2,opt,name=Score,json=score,proto3" json:"Score,omitempty"`
IsWin bool `protobuf:"varint,3,opt,name=IsWin,json=isWin,proto3" json:"IsWin,omitempty"`
} }
func (x *ReportInfo) Reset() { func (x *ReportInfo) Reset() {
@ -1055,6 +1069,13 @@ func (x *ReportInfo) GetScore() int32 {
return 0 return 0
} }
func (x *ReportInfo) GetIsWin() bool {
if x != nil {
return x.IsWin
}
return false
}
func (x *ReportInfo) SetOpenId(val string) { func (x *ReportInfo) SetOpenId(val string) {
if x != nil { if x != nil {
x.OpenId = val x.OpenId = val
@ -1065,6 +1086,11 @@ func (x *ReportInfo) SetScore(val int32) {
x.Score = val x.Score = val
} }
} }
func (x *ReportInfo) SetIsWin(val bool) {
if x != nil {
x.IsWin = val
}
}
//观众信息 //观众信息
type Audience struct { type Audience struct {
@ -1072,11 +1098,8 @@ type Audience struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
OpenId string `protobuf:"bytes,1,opt,name=OpenId,json=openId,proto3" json:"OpenId,omitempty"` AudienceBasic *AudienceBasic `protobuf:"bytes,1,opt,name=AudienceBasic,json=audienceBasic,proto3" json:"AudienceBasic,omitempty"` //观众基本信息
NickName string `protobuf:"bytes,2,opt,name=NickName,json=nickName,proto3" json:"NickName,omitempty"` AudienceInfo *AudienceInfo `protobuf:"bytes,2,opt,name=AudienceInfo,json=audienceInfo,proto3" json:"AudienceInfo,omitempty"` //观众详细信息
AvatarUrl string `protobuf:"bytes,3,opt,name=AvatarUrl,json=avatarUrl,proto3" json:"AvatarUrl,omitempty"`
Rank int32 `protobuf:"varint,4,opt,name=Rank,json=rank,proto3" json:"Rank,omitempty"` //排名
WinningStreak int32 `protobuf:"varint,5,opt,name=WinningStreak,json=winningStreak,proto3" json:"WinningStreak,omitempty"` //连胜
} }
func (x *Audience) Reset() { func (x *Audience) Reset() {
@ -1119,103 +1142,157 @@ func (*Audience) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{15} return file_common_proto_rawDescGZIP(), []int{15}
} }
func (x *Audience) GetOpenId() string { func (x *Audience) GetAudienceBasic() *AudienceBasic {
if x != nil { if x != nil {
return x.OpenId return x.AudienceBasic
} }
return "" return nil
} }
func (x *Audience) GetNickName() string { func (x *Audience) GetAudienceInfo() *AudienceInfo {
if x != nil { if x != nil {
return x.NickName return x.AudienceInfo
} }
return "" return nil
} }
func (x *Audience) GetAvatarUrl() string { func (x *Audience) SetAudienceBasic(val *AudienceBasic) {
if x != nil { if x != nil {
return x.AvatarUrl x.AudienceBasic = val
} }
return ""
} }
func (x *Audience) SetAudienceInfo(val *AudienceInfo) {
func (x *Audience) GetRank() int32 {
if x != nil { if x != nil {
return x.Rank x.AudienceInfo = val
} }
return 0
} }
func (x *Audience) GetWinningStreak() int32 { //观众基本信息
type AudienceBasic struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OpenId string `protobuf:"bytes,1,opt,name=OpenId,json=openId,proto3" json:"OpenId,omitempty"` //ID
NickName string `protobuf:"bytes,2,opt,name=NickName,json=nickName,proto3" json:"NickName,omitempty"` //昵称
AvatarUrl string `protobuf:"bytes,3,opt,name=AvatarUrl,json=avatarUrl,proto3" json:"AvatarUrl,omitempty"` //头像url
}
func (x *AudienceBasic) Reset() {
*x = AudienceBasic{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AudienceBasic) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (x *AudienceBasic) FromDB(data []byte) error {
return proto.Unmarshal(data, x)
}
func (x *AudienceBasic) ToDB() ([]byte, error) {
return proto.Marshal(x)
}
func (*AudienceBasic) ProtoMessage() {}
func (x *AudienceBasic) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AudienceBasic.ProtoReflect.Descriptor instead.
func (*AudienceBasic) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{16}
}
func (x *AudienceBasic) GetOpenId() string {
if x != nil { if x != nil {
return x.WinningStreak return x.OpenId
} }
return 0 return ""
} }
func (x *Audience) SetOpenId(val string) { func (x *AudienceBasic) GetNickName() string {
if x != nil { if x != nil {
x.OpenId = val return x.NickName
} }
return ""
} }
func (x *Audience) SetNickName(val string) {
func (x *AudienceBasic) GetAvatarUrl() string {
if x != nil { if x != nil {
x.NickName = val return x.AvatarUrl
} }
return ""
} }
func (x *Audience) SetAvatarUrl(val string) {
func (x *AudienceBasic) SetOpenId(val string) {
if x != nil { if x != nil {
x.AvatarUrl = val x.OpenId = val
} }
} }
func (x *Audience) SetRank(val int32) { func (x *AudienceBasic) SetNickName(val string) {
if x != nil { if x != nil {
x.Rank = val x.NickName = val
} }
} }
func (x *Audience) SetWinningStreak(val int32) { func (x *AudienceBasic) SetAvatarUrl(val string) {
if x != nil { if x != nil {
x.WinningStreak = val x.AvatarUrl = val
} }
} }
//排名信息 //观众详细信息
type RankInfo struct { type AudienceInfo struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Audience *Audience `protobuf:"bytes,1,opt,name=Audience,json=audience,proto3" json:"Audience,omitempty"` //观众信息 OpenId string `protobuf:"bytes,1,opt,name=OpenId,json=openId,proto3" json:"OpenId,omitempty"` //ID
Rank int32 `protobuf:"varint,2,opt,name=Rank,json=rank,proto3" json:"Rank,omitempty"` //排名 Score int32 `protobuf:"varint,2,opt,name=Score,json=score,proto3" json:"Score,omitempty"` //总分
Score int32 `protobuf:"varint,3,opt,name=Score,json=score,proto3" json:"Score,omitempty"` //用户分数 Rank int32 `protobuf:"varint,3,opt,name=Rank,json=rank,proto3" json:"Rank,omitempty"` //当前赛季排名
LastRank int32 `protobuf:"varint,4,opt,name=LastRank,json=lastRank,proto3" json:"LastRank,omitempty"` //上赛季排名
WinningStreak int32 `protobuf:"varint,5,opt,name=WinningStreak,json=winningStreak,proto3" json:"WinningStreak,omitempty"` //连胜
} }
func (x *RankInfo) Reset() { func (x *AudienceInfo) Reset() {
*x = RankInfo{} *x = AudienceInfo{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[16] mi := &file_common_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
} }
func (x *RankInfo) String() string { func (x *AudienceInfo) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (x *RankInfo) FromDB(data []byte) error { func (x *AudienceInfo) FromDB(data []byte) error {
return proto.Unmarshal(data, x) return proto.Unmarshal(data, x)
} }
func (x *RankInfo) ToDB() ([]byte, error) { func (x *AudienceInfo) ToDB() ([]byte, error) {
return proto.Marshal(x) return proto.Marshal(x)
} }
func (*RankInfo) ProtoMessage() {} func (*AudienceInfo) ProtoMessage() {}
func (x *RankInfo) ProtoReflect() protoreflect.Message { func (x *AudienceInfo) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[16] mi := &file_common_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1226,47 +1303,71 @@ func (x *RankInfo) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use RankInfo.ProtoReflect.Descriptor instead. // Deprecated: Use AudienceInfo.ProtoReflect.Descriptor instead.
func (*RankInfo) Descriptor() ([]byte, []int) { func (*AudienceInfo) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{16} return file_common_proto_rawDescGZIP(), []int{17}
} }
func (x *RankInfo) GetAudience() *Audience { func (x *AudienceInfo) GetOpenId() string {
if x != nil { if x != nil {
return x.Audience return x.OpenId
} }
return nil return ""
} }
func (x *RankInfo) GetRank() int32 { func (x *AudienceInfo) GetScore() int32 {
if x != nil {
return x.Score
}
return 0
}
func (x *AudienceInfo) GetRank() int32 {
if x != nil { if x != nil {
return x.Rank return x.Rank
} }
return 0 return 0
} }
func (x *RankInfo) GetScore() int32 { func (x *AudienceInfo) GetLastRank() int32 {
if x != nil { if x != nil {
return x.Score return x.LastRank
} }
return 0 return 0
} }
func (x *RankInfo) SetAudience(val *Audience) { func (x *AudienceInfo) GetWinningStreak() int32 {
if x != nil { if x != nil {
x.Audience = val return x.WinningStreak
} }
return 0
} }
func (x *RankInfo) SetRank(val int32) {
func (x *AudienceInfo) SetOpenId(val string) {
if x != nil { if x != nil {
x.Rank = val x.OpenId = val
} }
} }
func (x *RankInfo) SetScore(val int32) { func (x *AudienceInfo) SetScore(val int32) {
if x != nil { if x != nil {
x.Score = val x.Score = val
} }
} }
func (x *AudienceInfo) SetRank(val int32) {
if x != nil {
x.Rank = val
}
}
func (x *AudienceInfo) SetLastRank(val int32) {
if x != nil {
x.LastRank = val
}
}
func (x *AudienceInfo) SetWinningStreak(val int32) {
if x != nil {
x.WinningStreak = val
}
}
var File_common_proto protoreflect.FileDescriptor var File_common_proto protoreflect.FileDescriptor
@ -1306,53 +1407,65 @@ var file_common_proto_rawDesc = []byte{
0x0a, 0x06, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66,
0x6f, 0x22, 0x3b, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x6f, 0x22, 0x66, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x12, 0x2b, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x45, 0x52, 0x52, 0x4f, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x45, 0x52, 0x52, 0x4f,
0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x25, 0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x29,
0x0a, 0x07, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x6f, 0x70, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x6f, 0x70, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x49,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x65, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x25, 0x0a, 0x07, 0x47, 0x65, 0x74,
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x6f, 0x70, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x6f, 0x70, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x2e, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x52, 0x06, 0x72, 0x65, 0x73, 0x22, 0x63, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c,
0x75, 0x6c, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x45, 0x52, 0x52, 0x4f,
0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x42, 0x0a, 0x11, 0x52, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x25,
0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e, 0x65, 0x77, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d,
0x65, 0x12, 0x2d, 0x0a, 0x08, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52,
0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x75, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x42, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x4e,
0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x65, 0x77, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x08, 0x41, 0x75,
0x22, 0x94, 0x01, 0x0a, 0x14, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x41, 0x75, 0x64, 0x69, 0x65, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d,
0x6e, 0x63, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52,
0x08, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x14, 0x4e, 0x6f,
0x74, 0x69, 0x66, 0x79, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x41, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x69, 0x6b, 0x65, 0x4e, 0x75, 0x6d, 0x18,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6b, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x16,
0x0a, 0x06, 0x47, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x69, 0x66, 0x74, 0x4e, 0x75,
0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d,
0x22, 0x50, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16,
0x0a, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x49, 0x73, 0x57, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x57,
0x69, 0x6e, 0x22, 0x83, 0x01, 0x0a, 0x08, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12,
0x3c, 0x0a, 0x0d, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x61, 0x73, 0x69, 0x63,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x61, 0x73, 0x69, 0x63, 0x52, 0x0d,
0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x61, 0x73, 0x69, 0x63, 0x12, 0x39, 0x0a,
0x0c, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x75,
0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x61, 0x75, 0x64, 0x69,
0x65, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x61, 0x0a, 0x0d, 0x41, 0x75, 0x64, 0x69,
0x65, 0x6e, 0x63, 0x65, 0x42, 0x61, 0x73, 0x69, 0x63, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65,
0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49,
0x64, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a,
0x69, 0x6b, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x09, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x6b, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72, 0x6c, 0x22, 0x92, 0x01, 0x0a, 0x0c,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06,
0x07, 0x47, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70,
0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x22, 0x3a, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20,
0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x61,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x1a,
0x05, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x0a, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x6f, 0x72, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x08, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x24, 0x0a, 0x0d, 0x57, 0x69,
0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28,
0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x05, 0x52, 0x0d, 0x77, 0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6b,
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x42, 0x05, 0x5a, 0x03, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55, 0x72,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x55,
0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x61, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x24, 0x0a, 0x0d, 0x57, 0x69, 0x6e, 0x6e, 0x69, 0x6e,
0x67, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x77,
0x69, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x22, 0x63, 0x0a, 0x08,
0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2d, 0x0a, 0x08, 0x41, 0x75, 0x64, 0x69,
0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x61,
0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x61, 0x6e, 0x6b, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x53,
0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72,
0x65, 0x42, 0x05, 0x5a, 0x03, 0x70, 0x62, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1367,7 +1480,7 @@ func file_common_proto_rawDescGZIP() []byte {
return file_common_proto_rawDescData return file_common_proto_rawDescData
} }
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_common_proto_goTypes = []interface{}{ var file_common_proto_goTypes = []interface{}{
(*Ping)(nil), // 0: message.Ping (*Ping)(nil), // 0: message.Ping
(*Pong)(nil), // 1: message.Pong (*Pong)(nil), // 1: message.Pong
@ -1385,24 +1498,27 @@ var file_common_proto_goTypes = []interface{}{
(*NotifyAudienceAction)(nil), // 13: message.NotifyAudienceAction (*NotifyAudienceAction)(nil), // 13: message.NotifyAudienceAction
(*ReportInfo)(nil), // 14: message.ReportInfo (*ReportInfo)(nil), // 14: message.ReportInfo
(*Audience)(nil), // 15: message.Audience (*Audience)(nil), // 15: message.Audience
(*RankInfo)(nil), // 16: message.RankInfo (*AudienceBasic)(nil), // 16: message.AudienceBasic
(ERROR_CODE)(0), // 17: message.ERROR_CODE (*AudienceInfo)(nil), // 17: message.AudienceInfo
(ERROR_CODE)(0), // 18: message.ERROR_CODE
} }
var file_common_proto_depIdxs = []int32{ var file_common_proto_depIdxs = []int32{
17, // 0: message.LoginResult.Result:type_name -> message.ERROR_CODE 18, // 0: message.LoginResult.Result:type_name -> message.ERROR_CODE
17, // 1: message.PlayStartResult.Result:type_name -> message.ERROR_CODE 18, // 1: message.PlayStartResult.Result:type_name -> message.ERROR_CODE
17, // 2: message.PlayEndResult.Result:type_name -> message.ERROR_CODE 18, // 2: message.PlayEndResult.Result:type_name -> message.ERROR_CODE
14, // 3: message.Report.Info:type_name -> message.ReportInfo 14, // 3: message.Report.Info:type_name -> message.ReportInfo
17, // 4: message.ReportResult.Result:type_name -> message.ERROR_CODE 18, // 4: message.ReportResult.Result:type_name -> message.ERROR_CODE
17, // 5: message.GetRankResult.Result:type_name -> message.ERROR_CODE 17, // 5: message.ReportResult.Info:type_name -> message.AudienceInfo
14, // 6: message.GetRankResult.Info:type_name -> message.ReportInfo 18, // 6: message.GetRankResult.Result:type_name -> message.ERROR_CODE
15, // 7: message.NotifyNewAudience.Audience:type_name -> message.Audience 15, // 7: message.GetRankResult.Info:type_name -> message.Audience
15, // 8: message.RankInfo.Audience:type_name -> message.Audience 15, // 8: message.NotifyNewAudience.Audience:type_name -> message.Audience
9, // [9:9] is the sub-list for method output_type 16, // 9: message.Audience.AudienceBasic:type_name -> message.AudienceBasic
9, // [9:9] is the sub-list for method input_type 17, // 10: message.Audience.AudienceInfo:type_name -> message.AudienceInfo
9, // [9:9] is the sub-list for extension type_name 11, // [11:11] is the sub-list for method output_type
9, // [9:9] is the sub-list for extension extendee 11, // [11:11] is the sub-list for method input_type
0, // [0:9] is the sub-list for field type_name 11, // [11:11] is the sub-list for extension type_name
11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
} }
func init() { file_common_proto_init() } func init() { file_common_proto_init() }
@ -1605,7 +1721,19 @@ func file_common_proto_init() {
} }
} }
file_common_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { file_common_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RankInfo); i { switch v := v.(*AudienceBasic); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AudienceInfo); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1623,7 +1751,7 @@ func file_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_proto_rawDesc, RawDescriptor: file_common_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 17, NumMessages: 18,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

@ -4,16 +4,10 @@ import (
"app/service/main/message/pb" "app/service/main/message/pb"
"context" "context"
"encoding/json" "encoding/json"
"fmt"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
"os" "os"
) )
type RankInfo struct {
OpenId string
Score int32
}
var client *redis.Client var client *redis.Client
func init() { func init() {
@ -25,28 +19,30 @@ func init() {
client = redis.NewClient(opts) client = redis.NewClient(opts)
} }
func AddScore(appId string, scoreMap map[string]int32) error { func UpdateReport(appId string, scoreMap map[string]int32) error {
ctx := context.Background() ctx := context.Background()
pip := client.Pipeline() pip := client.Pipeline()
for openId, score := range scoreMap { for openId, score := range scoreMap {
key := fmt.Sprintf("Score_%s", appId) key := ThisWeekScoreKey(appId)
pip.ZIncrBy(ctx, key, float64(score), openId) pip.ZIncrBy(ctx, key, float64(score), openId)
} }
_, err := pip.Exec(ctx) _, err := pip.Exec(ctx)
return err return err
} }
func GetRank(appId string, topCount int32) ([]*RankInfo, error) { func GetRank(appId string, topCount int32) ([]*pb.Audience, error) {
ctx := context.Background() ctx := context.Background()
key := fmt.Sprintf("Score_%s", appId) key := ThisWeekScoreKey(appId)
cmd := client.ZRevRangeWithScores(ctx, key, 0, int64(topCount)) cmd := client.ZRevRangeWithScores(ctx, key, 0, int64(topCount))
result, err := cmd.Result() result, err := cmd.Result()
if err != nil { if err != nil {
return nil, err return nil, err
} }
rankList := make([]*RankInfo, 0) pip := client.Pipeline()
for _, info := range result { for _, info := range result {
rankList = append(rankList, &RankInfo{ key := ThisWeekScoreKey(appId)
ret = append(ret, &RankInfo{
OpenId: info.Member.(string), OpenId: info.Member.(string),
Score: int32(info.Score), Score: int32(info.Score),
}) })
@ -54,9 +50,9 @@ func GetRank(appId string, topCount int32) ([]*RankInfo, error) {
return rankList, nil return rankList, nil
} }
func SetAudience(appId string, data *pb.Audience) { func SetAudienceBasic(appId string, data *pb.AudienceBasic) {
ctx := context.Background() ctx := context.Background()
key := fmt.Sprintf("UserData_%s_%s", appId, data.OpenId) key := UserDataKey(appId, data.OpenId)
exist, err := client.Exists(ctx, key).Result() exist, err := client.Exists(ctx, key).Result()
if err != nil { if err != nil {
return return
@ -73,13 +69,20 @@ func SetAudience(appId string, data *pb.Audience) {
} }
func GetAudience(appId string, openId string) *pb.Audience { func GetAudience(appId string, openId string) *pb.Audience {
return &pb.Audience{
AudienceBasic: GetAudienceBasic(appId, openId),
AudienceInfo: GetAudienceInfo(appId, openId),
}
}
func GetAudienceBasic(appId string, openId string) *pb.AudienceBasic {
ctx := context.Background() ctx := context.Background()
key := fmt.Sprintf("UserData_%s_%s", appId, openId) key := UserDataKey(appId, openId)
result, err := client.Get(ctx, key).Result() result, err := client.Get(ctx, key).Result()
if err != nil { if err != nil {
return nil return nil
} }
data := &pb.Audience{} data := &pb.AudienceBasic{}
err = json.Unmarshal([]byte(result), data) err = json.Unmarshal([]byte(result), data)
if err != nil { if err != nil {
return nil return nil
@ -87,12 +90,70 @@ func GetAudience(appId string, openId string) *pb.Audience {
return data return data
} }
func GetAudienceInfo(appId string, openId string) *pb.AudienceInfo {
ctx := context.Background()
ret := &pb.AudienceInfo{
OpenId: openId,
}
pip := client.Pipeline()
keyScore := ThisWeekScoreKey(appId)
keyScoreLast := LastWeekScoreKey(appId)
var err error
cmdScore := pip.ZScore(ctx, keyScore, openId)
cmdRank := pip.ZRank(ctx, keyScore, openId)
cmdRankLast := pip.ZRank(ctx, keyScoreLast, openId)
result, err := pip.Exec(ctx)
if err != nil {
return ret
}
if len(result) != 3 {
return ret
}
if result, err := cmdScore.Result(); err == nil {
ret.Score = int32(result)
}
if result, err := cmdRank.Result(); err == nil {
ret.Rank = int32(result)
}
if result, err := cmdRankLast.Result(); err == nil {
ret.Score = int32(result)
}
return ret
}
func GetAudienceBasicList(appId string, openIdList []string) (ret []*pb.AudienceBasic) {
ctx := context.Background()
pip := client.Pipeline()
var cmdList []*redis.StringCmd
for _, openId := range openIdList {
key := UserDataKey(appId, openId)
cmdList = append(cmdList, pip.Get(ctx, key))
}
_, err := pip.Exec(ctx)
if err != nil {
return nil
}
for _, cmd := range cmdList {
data := &pb.AudienceBasic{}
if result, err := cmd.Result(); err == nil {
_ = json.Unmarshal([]byte(result), data)
}
ret = append(ret, data)
}
return
}
func GetAudienceInfoList(appId string, openIdList []string) (ret []*pb.AudienceInfo) {
ctx := context.Background()
}
func Subscribe(appId string, roomId string, pushFunc func(string), pushCloseChan chan struct{}) { func Subscribe(appId string, roomId string, pushFunc func(string), pushCloseChan chan struct{}) {
ps := client.Subscribe(context.Background(), PublishKey(appId, roomId)) ps := client.Subscribe(context.Background(), PublishKey(appId, roomId))
go func() { go func() {
for { for {
msg, err := ps.ReceiveMessage(context.Background()) msg, err := ps.ReceiveMessage(context.Background())
fmt.Println("ReceiveMessage", msg, err)
if err != nil { if err != nil {
return return
} }
@ -112,7 +173,3 @@ func Publish(appId string, roomId string, data *pb.NotifyAudienceAction) {
} }
client.Publish(context.Background(), PublishKey(appId, roomId), string(jsonData)) client.Publish(context.Background(), PublishKey(appId, roomId), string(jsonData))
} }
func PublishKey(appId string, roomId string) string {
return fmt.Sprintf("DataPush_%s_%s", appId, roomId)
}

@ -0,0 +1,30 @@
package redis
import (
"fmt"
"time"
)
func PublishKey(appId string, roomId string) string {
return fmt.Sprintf("DataPush_%s_%s", appId, roomId)
}
func UserDataKey(appId string, openId string) string {
return fmt.Sprintf("UserData_%s_%s", appId, openId)
}
func ThisWeekScoreKey(appId string) string {
weekStart := getWeekStart(time.Now())
return fmt.Sprintf("Score_%s_%d", appId, weekStart)
}
func LastWeekScoreKey(appId string) string {
weekStart := getWeekStart(time.Now().Add(-time.Hour * 24 * 7))
return fmt.Sprintf("Score_%s_%d", appId, weekStart)
}
func getWeekStart(now time.Time) int64 {
startOfWeek := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
startOfWeek = startOfWeek.AddDate(0, 0, int(-startOfWeek.Weekday()))
return startOfWeek.Unix()
}

@ -86,7 +86,6 @@ func (s *User) OnRecv(msgId int32, data interface{}) {
} }
func (s *User) OnRecvPush(data string) { func (s *User) OnRecvPush(data string) {
s.Log("OnRecvPush", data)
msg := &pb.NotifyAudienceAction{} msg := &pb.NotifyAudienceAction{}
err := json.Unmarshal([]byte(data), msg) err := json.Unmarshal([]byte(data), msg)
if err != nil { if err != nil {
@ -166,7 +165,7 @@ func (s *User) OnReport(msg *pb.Report) {
for _, info := range msg.Info { for _, info := range msg.Info {
scoreMap[info.OpenId] = info.Score scoreMap[info.OpenId] = info.Score
} }
err := redis.AddScore(s.appId, scoreMap) err := redis.UpdateReport(s.appId, scoreMap)
if err != nil { if err != nil {
s.SendUserMsg(&pb.ReportResult{Result: pb.ERROR_CODE_FAIL}) s.SendUserMsg(&pb.ReportResult{Result: pb.ERROR_CODE_FAIL})
return return

Loading…
Cancel
Save