From 4212914057026426306e53ff9fde6b877bbe58b7 Mon Sep 17 00:00:00 2001 From: zerosaturation Date: Mon, 8 Jun 2026 14:28:27 +0800 Subject: [PATCH] feat(statistic): add event.proto and statistic.proto with 7 RPCs + 2 event RPCs --- backend/pkg/proto/event/event.pb.go | 236 +++ backend/pkg/proto/statistic/statistic.pb.go | 1510 +++++++++++++++++ .../pkg/proto/statistic/statistic.triple.go | 339 ++++ backend/proto/event.proto | 25 + backend/proto/statistic.proto | 146 ++ backend/scripts/compile-proto.sh | 73 +- 6 files changed, 2327 insertions(+), 2 deletions(-) create mode 100644 backend/pkg/proto/event/event.pb.go create mode 100644 backend/pkg/proto/statistic/statistic.pb.go create mode 100644 backend/pkg/proto/statistic/statistic.triple.go create mode 100644 backend/proto/event.proto create mode 100644 backend/proto/statistic.proto diff --git a/backend/pkg/proto/event/event.pb.go b/backend/pkg/proto/event/event.pb.go new file mode 100644 index 0000000..d8b087b --- /dev/null +++ b/backend/pkg/proto/event/event.pb.go @@ -0,0 +1,236 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.0 +// source: event.proto + +package event + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// 单条事件 +type Event struct { + state protoimpl.MessageState `protogen:"open.v1"` + EventId string `protobuf:"bytes,1,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"` // 事件 ID(UUID,客户端生成,用于去重) + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 用户 ID + StarId int64 `protobuf:"varint,3,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` // 顶粉星城 ID + EventType string `protobuf:"bytes,4,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` // 事件类型(如 "asset.like", "exhibition.start") + OccurredAt int64 `protobuf:"varint,5,opt,name=occurred_at,json=occurredAt,proto3" json:"occurred_at,omitempty"` // 事件发生时间(ms timestamp) + ReceivedAt int64 `protobuf:"varint,6,opt,name=received_at,json=receivedAt,proto3" json:"received_at,omitempty"` // 服务端接收时间(ms,服务端填充) + Properties map[string]string `protobuf:"bytes,7,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // 自定义属性(扁平 key-value) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Event) Reset() { + *x = Event{} + mi := &file_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event) ProtoMessage() {} + +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_event_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_event_proto_rawDescGZIP(), []int{0} +} + +func (x *Event) GetEventId() string { + if x != nil { + return x.EventId + } + return "" +} + +func (x *Event) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *Event) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +func (x *Event) GetEventType() string { + if x != nil { + return x.EventType + } + return "" +} + +func (x *Event) GetOccurredAt() int64 { + if x != nil { + return x.OccurredAt + } + return 0 +} + +func (x *Event) GetReceivedAt() int64 { + if x != nil { + return x.ReceivedAt + } + return 0 +} + +func (x *Event) GetProperties() map[string]string { + if x != nil { + return x.Properties + } + return nil +} + +// 批量事件请求 +type BatchEventRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BatchEventRequest) Reset() { + *x = BatchEventRequest{} + mi := &file_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BatchEventRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchEventRequest) ProtoMessage() {} + +func (x *BatchEventRequest) ProtoReflect() protoreflect.Message { + mi := &file_event_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchEventRequest.ProtoReflect.Descriptor instead. +func (*BatchEventRequest) Descriptor() ([]byte, []int) { + return file_event_proto_rawDescGZIP(), []int{1} +} + +func (x *BatchEventRequest) GetEvents() []*Event { + if x != nil { + return x.Events + } + return nil +} + +var File_event_proto protoreflect.FileDescriptor + +const file_event_proto_rawDesc = "" + + "\n" + + "\vevent.proto\x12\rtopfans.event\"\xba\x02\n" + + "\x05Event\x12\x19\n" + + "\bevent_id\x18\x01 \x01(\tR\aeventId\x12\x17\n" + + "\auser_id\x18\x02 \x01(\x03R\x06userId\x12\x17\n" + + "\astar_id\x18\x03 \x01(\x03R\x06starId\x12\x1d\n" + + "\n" + + "event_type\x18\x04 \x01(\tR\teventType\x12\x1f\n" + + "\voccurred_at\x18\x05 \x01(\x03R\n" + + "occurredAt\x12\x1f\n" + + "\vreceived_at\x18\x06 \x01(\x03R\n" + + "receivedAt\x12D\n" + + "\n" + + "properties\x18\a \x03(\v2$.topfans.event.Event.PropertiesEntryR\n" + + "properties\x1a=\n" + + "\x0fPropertiesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"A\n" + + "\x11BatchEventRequest\x12,\n" + + "\x06events\x18\x01 \x03(\v2\x14.topfans.event.EventR\x06eventsB2Z0github.com/topfans/backend/pkg/proto/event;eventb\x06proto3" + +var ( + file_event_proto_rawDescOnce sync.Once + file_event_proto_rawDescData []byte +) + +func file_event_proto_rawDescGZIP() []byte { + file_event_proto_rawDescOnce.Do(func() { + file_event_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_event_proto_rawDesc), len(file_event_proto_rawDesc))) + }) + return file_event_proto_rawDescData +} + +var file_event_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_event_proto_goTypes = []any{ + (*Event)(nil), // 0: topfans.event.Event + (*BatchEventRequest)(nil), // 1: topfans.event.BatchEventRequest + nil, // 2: topfans.event.Event.PropertiesEntry +} +var file_event_proto_depIdxs = []int32{ + 2, // 0: topfans.event.Event.properties:type_name -> topfans.event.Event.PropertiesEntry + 0, // 1: topfans.event.BatchEventRequest.events:type_name -> topfans.event.Event + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_event_proto_init() } +func file_event_proto_init() { + if File_event_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_event_proto_rawDesc), len(file_event_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_event_proto_goTypes, + DependencyIndexes: file_event_proto_depIdxs, + MessageInfos: file_event_proto_msgTypes, + }.Build() + File_event_proto = out.File + file_event_proto_goTypes = nil + file_event_proto_depIdxs = nil +} diff --git a/backend/pkg/proto/statistic/statistic.pb.go b/backend/pkg/proto/statistic/statistic.pb.go new file mode 100644 index 0000000..a89138d --- /dev/null +++ b/backend/pkg/proto/statistic/statistic.pb.go @@ -0,0 +1,1510 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.0 +// source: statistic.proto + +package statistic + +import ( + event "github.com/topfans/backend/pkg/proto/event" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ====== 1. 今日概览 ====== +type GetTodayOverviewRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StarId int64 `protobuf:"varint,1,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetTodayOverviewRequest) Reset() { + *x = GetTodayOverviewRequest{} + mi := &file_statistic_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetTodayOverviewRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTodayOverviewRequest) ProtoMessage() {} + +func (x *GetTodayOverviewRequest) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTodayOverviewRequest.ProtoReflect.Descriptor instead. +func (*GetTodayOverviewRequest) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{0} +} + +func (x *GetTodayOverviewRequest) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +type GetTodayOverviewResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + CrystalBalance int64 `protobuf:"varint,1,opt,name=crystal_balance,json=crystalBalance,proto3" json:"crystal_balance,omitempty"` + TodayIncome int64 `protobuf:"varint,2,opt,name=today_income,json=todayIncome,proto3" json:"today_income,omitempty"` + WeekRank int32 `protobuf:"varint,3,opt,name=week_rank,json=weekRank,proto3" json:"week_rank,omitempty"` // 本期完整实现 + WeekTotalUsers int32 `protobuf:"varint,4,opt,name=week_total_users,json=weekTotalUsers,proto3" json:"week_total_users,omitempty"` // 用于"击败 X%"展示 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetTodayOverviewResponse) Reset() { + *x = GetTodayOverviewResponse{} + mi := &file_statistic_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetTodayOverviewResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTodayOverviewResponse) ProtoMessage() {} + +func (x *GetTodayOverviewResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTodayOverviewResponse.ProtoReflect.Descriptor instead. +func (*GetTodayOverviewResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{1} +} + +func (x *GetTodayOverviewResponse) GetCrystalBalance() int64 { + if x != nil { + return x.CrystalBalance + } + return 0 +} + +func (x *GetTodayOverviewResponse) GetTodayIncome() int64 { + if x != nil { + return x.TodayIncome + } + return 0 +} + +func (x *GetTodayOverviewResponse) GetWeekRank() int32 { + if x != nil { + return x.WeekRank + } + return 0 +} + +func (x *GetTodayOverviewResponse) GetWeekTotalUsers() int32 { + if x != nil { + return x.WeekTotalUsers + } + return 0 +} + +// ====== 2. 七日收益曲线 ====== +type Get7DayIncomeCurveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StarId int64 `protobuf:"varint,1,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Get7DayIncomeCurveRequest) Reset() { + *x = Get7DayIncomeCurveRequest{} + mi := &file_statistic_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Get7DayIncomeCurveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Get7DayIncomeCurveRequest) ProtoMessage() {} + +func (x *Get7DayIncomeCurveRequest) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Get7DayIncomeCurveRequest.ProtoReflect.Descriptor instead. +func (*Get7DayIncomeCurveRequest) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{2} +} + +func (x *Get7DayIncomeCurveRequest) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +type DailyIncomePoint struct { + state protoimpl.MessageState `protogen:"open.v1"` + Date string `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"` // "YYYY-MM-DD" + Income int64 `protobuf:"varint,2,opt,name=income,proto3" json:"income,omitempty"` + IsToday bool `protobuf:"varint,3,opt,name=is_today,json=isToday,proto3" json:"is_today,omitempty"` + IsPeak bool `protobuf:"varint,4,opt,name=is_peak,json=isPeak,proto3" json:"is_peak,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DailyIncomePoint) Reset() { + *x = DailyIncomePoint{} + mi := &file_statistic_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DailyIncomePoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DailyIncomePoint) ProtoMessage() {} + +func (x *DailyIncomePoint) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DailyIncomePoint.ProtoReflect.Descriptor instead. +func (*DailyIncomePoint) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{3} +} + +func (x *DailyIncomePoint) GetDate() string { + if x != nil { + return x.Date + } + return "" +} + +func (x *DailyIncomePoint) GetIncome() int64 { + if x != nil { + return x.Income + } + return 0 +} + +func (x *DailyIncomePoint) GetIsToday() bool { + if x != nil { + return x.IsToday + } + return false +} + +func (x *DailyIncomePoint) GetIsPeak() bool { + if x != nil { + return x.IsPeak + } + return false +} + +type Get7DayIncomeCurveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Points []*DailyIncomePoint `protobuf:"bytes,1,rep,name=points,proto3" json:"points,omitempty"` + TotalIncome int64 `protobuf:"varint,2,opt,name=total_income,json=totalIncome,proto3" json:"total_income,omitempty"` + AvgIncome int64 `protobuf:"varint,3,opt,name=avg_income,json=avgIncome,proto3" json:"avg_income,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Get7DayIncomeCurveResponse) Reset() { + *x = Get7DayIncomeCurveResponse{} + mi := &file_statistic_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Get7DayIncomeCurveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Get7DayIncomeCurveResponse) ProtoMessage() {} + +func (x *Get7DayIncomeCurveResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Get7DayIncomeCurveResponse.ProtoReflect.Descriptor instead. +func (*Get7DayIncomeCurveResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{4} +} + +func (x *Get7DayIncomeCurveResponse) GetPoints() []*DailyIncomePoint { + if x != nil { + return x.Points + } + return nil +} + +func (x *Get7DayIncomeCurveResponse) GetTotalIncome() int64 { + if x != nil { + return x.TotalIncome + } + return 0 +} + +func (x *Get7DayIncomeCurveResponse) GetAvgIncome() int64 { + if x != nil { + return x.AvgIncome + } + return 0 +} + +// ====== 3. 展出收益中心 ====== +type GetExhibitionIncomeSummaryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StarId int64 `protobuf:"varint,1,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetExhibitionIncomeSummaryRequest) Reset() { + *x = GetExhibitionIncomeSummaryRequest{} + mi := &file_statistic_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetExhibitionIncomeSummaryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExhibitionIncomeSummaryRequest) ProtoMessage() {} + +func (x *GetExhibitionIncomeSummaryRequest) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetExhibitionIncomeSummaryRequest.ProtoReflect.Descriptor instead. +func (*GetExhibitionIncomeSummaryRequest) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{5} +} + +func (x *GetExhibitionIncomeSummaryRequest) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +type TopExhibitionItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + AssetId int64 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + AssetName string `protobuf:"bytes,2,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"` + AssetThumb string `protobuf:"bytes,3,opt,name=asset_thumb,json=assetThumb,proto3" json:"asset_thumb,omitempty"` + Duration_7D string `protobuf:"bytes,4,opt,name=duration_7d,json=duration7d,proto3" json:"duration_7d,omitempty"` // 7 天累计展示时长("D:HH:MM:SS") + Earnings_7D int64 `protobuf:"varint,5,opt,name=earnings_7d,json=earnings7d,proto3" json:"earnings_7d,omitempty"` + AvgEarnings int32 `protobuf:"varint,6,opt,name=avg_earnings,json=avgEarnings,proto3" json:"avg_earnings,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopExhibitionItem) Reset() { + *x = TopExhibitionItem{} + mi := &file_statistic_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopExhibitionItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopExhibitionItem) ProtoMessage() {} + +func (x *TopExhibitionItem) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopExhibitionItem.ProtoReflect.Descriptor instead. +func (*TopExhibitionItem) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{6} +} + +func (x *TopExhibitionItem) GetAssetId() int64 { + if x != nil { + return x.AssetId + } + return 0 +} + +func (x *TopExhibitionItem) GetAssetName() string { + if x != nil { + return x.AssetName + } + return "" +} + +func (x *TopExhibitionItem) GetAssetThumb() string { + if x != nil { + return x.AssetThumb + } + return "" +} + +func (x *TopExhibitionItem) GetDuration_7D() string { + if x != nil { + return x.Duration_7D + } + return "" +} + +func (x *TopExhibitionItem) GetEarnings_7D() int64 { + if x != nil { + return x.Earnings_7D + } + return 0 +} + +func (x *TopExhibitionItem) GetAvgEarnings() int32 { + if x != nil { + return x.AvgEarnings + } + return 0 +} + +type GetExhibitionIncomeSummaryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ExhibitingCount int32 `protobuf:"varint,1,opt,name=exhibiting_count,json=exhibitingCount,proto3" json:"exhibiting_count,omitempty"` // 当前在展藏品数 + StarbookCount int32 `protobuf:"varint,2,opt,name=starbook_count,json=starbookCount,proto3" json:"starbook_count,omitempty"` // 星图册数 + TotalDuration string `protobuf:"bytes,3,opt,name=total_duration,json=totalDuration,proto3" json:"total_duration,omitempty"` // 累计展示时长 + TotalEarnings int64 `protobuf:"varint,4,opt,name=total_earnings,json=totalEarnings,proto3" json:"total_earnings,omitempty"` // 累计收益 + Top5 []*TopExhibitionItem `protobuf:"bytes,5,rep,name=top5,proto3" json:"top5,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetExhibitionIncomeSummaryResponse) Reset() { + *x = GetExhibitionIncomeSummaryResponse{} + mi := &file_statistic_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetExhibitionIncomeSummaryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetExhibitionIncomeSummaryResponse) ProtoMessage() {} + +func (x *GetExhibitionIncomeSummaryResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetExhibitionIncomeSummaryResponse.ProtoReflect.Descriptor instead. +func (*GetExhibitionIncomeSummaryResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{7} +} + +func (x *GetExhibitionIncomeSummaryResponse) GetExhibitingCount() int32 { + if x != nil { + return x.ExhibitingCount + } + return 0 +} + +func (x *GetExhibitionIncomeSummaryResponse) GetStarbookCount() int32 { + if x != nil { + return x.StarbookCount + } + return 0 +} + +func (x *GetExhibitionIncomeSummaryResponse) GetTotalDuration() string { + if x != nil { + return x.TotalDuration + } + return "" +} + +func (x *GetExhibitionIncomeSummaryResponse) GetTotalEarnings() int64 { + if x != nil { + return x.TotalEarnings + } + return 0 +} + +func (x *GetExhibitionIncomeSummaryResponse) GetTop5() []*TopExhibitionItem { + if x != nil { + return x.Top5 + } + return nil +} + +// ====== 4. 点赞收益按等级 ====== +type GetLikeIncomeByLevelRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StarId int64 `protobuf:"varint,1,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLikeIncomeByLevelRequest) Reset() { + *x = GetLikeIncomeByLevelRequest{} + mi := &file_statistic_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLikeIncomeByLevelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLikeIncomeByLevelRequest) ProtoMessage() {} + +func (x *GetLikeIncomeByLevelRequest) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLikeIncomeByLevelRequest.ProtoReflect.Descriptor instead. +func (*GetLikeIncomeByLevelRequest) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{8} +} + +func (x *GetLikeIncomeByLevelRequest) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +type LikeIncomeLevelItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + Level string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"` // 藏品等级(N/R/SR/SSR/UR) + AssetCount int32 `protobuf:"varint,2,opt,name=asset_count,json=assetCount,proto3" json:"asset_count,omitempty"` + TotalIncome int64 `protobuf:"varint,3,opt,name=total_income,json=totalIncome,proto3" json:"total_income,omitempty"` + Thumb string `protobuf:"bytes,4,opt,name=thumb,proto3" json:"thumb,omitempty"` // 等级代表缩略图 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LikeIncomeLevelItem) Reset() { + *x = LikeIncomeLevelItem{} + mi := &file_statistic_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LikeIncomeLevelItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LikeIncomeLevelItem) ProtoMessage() {} + +func (x *LikeIncomeLevelItem) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LikeIncomeLevelItem.ProtoReflect.Descriptor instead. +func (*LikeIncomeLevelItem) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{9} +} + +func (x *LikeIncomeLevelItem) GetLevel() string { + if x != nil { + return x.Level + } + return "" +} + +func (x *LikeIncomeLevelItem) GetAssetCount() int32 { + if x != nil { + return x.AssetCount + } + return 0 +} + +func (x *LikeIncomeLevelItem) GetTotalIncome() int64 { + if x != nil { + return x.TotalIncome + } + return 0 +} + +func (x *LikeIncomeLevelItem) GetThumb() string { + if x != nil { + return x.Thumb + } + return "" +} + +type GetLikeIncomeByLevelResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + TotalLikeCount int64 `protobuf:"varint,1,opt,name=total_like_count,json=totalLikeCount,proto3" json:"total_like_count,omitempty"` + TotalIncome int64 `protobuf:"varint,2,opt,name=total_income,json=totalIncome,proto3" json:"total_income,omitempty"` + Levels []*LikeIncomeLevelItem `protobuf:"bytes,3,rep,name=levels,proto3" json:"levels,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLikeIncomeByLevelResponse) Reset() { + *x = GetLikeIncomeByLevelResponse{} + mi := &file_statistic_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLikeIncomeByLevelResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLikeIncomeByLevelResponse) ProtoMessage() {} + +func (x *GetLikeIncomeByLevelResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLikeIncomeByLevelResponse.ProtoReflect.Descriptor instead. +func (*GetLikeIncomeByLevelResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{10} +} + +func (x *GetLikeIncomeByLevelResponse) GetTotalLikeCount() int64 { + if x != nil { + return x.TotalLikeCount + } + return 0 +} + +func (x *GetLikeIncomeByLevelResponse) GetTotalIncome() int64 { + if x != nil { + return x.TotalIncome + } + return 0 +} + +func (x *GetLikeIncomeByLevelResponse) GetLevels() []*LikeIncomeLevelItem { + if x != nil { + return x.Levels + } + return nil +} + +// ====== 5. 藏品 TOP5(按收益) ====== +type GetTopAssetsByEarningRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StarId int64 `protobuf:"varint,1,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetTopAssetsByEarningRequest) Reset() { + *x = GetTopAssetsByEarningRequest{} + mi := &file_statistic_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetTopAssetsByEarningRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTopAssetsByEarningRequest) ProtoMessage() {} + +func (x *GetTopAssetsByEarningRequest) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTopAssetsByEarningRequest.ProtoReflect.Descriptor instead. +func (*GetTopAssetsByEarningRequest) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{11} +} + +func (x *GetTopAssetsByEarningRequest) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +type TopAssetItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + AssetId int64 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + AssetName string `protobuf:"bytes,2,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"` + AssetThumb string `protobuf:"bytes,3,opt,name=asset_thumb,json=assetThumb,proto3" json:"asset_thumb,omitempty"` + TotalEarnings int64 `protobuf:"varint,4,opt,name=total_earnings,json=totalEarnings,proto3" json:"total_earnings,omitempty"` + Rank int32 `protobuf:"varint,5,opt,name=rank,proto3" json:"rank,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopAssetItem) Reset() { + *x = TopAssetItem{} + mi := &file_statistic_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopAssetItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopAssetItem) ProtoMessage() {} + +func (x *TopAssetItem) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopAssetItem.ProtoReflect.Descriptor instead. +func (*TopAssetItem) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{12} +} + +func (x *TopAssetItem) GetAssetId() int64 { + if x != nil { + return x.AssetId + } + return 0 +} + +func (x *TopAssetItem) GetAssetName() string { + if x != nil { + return x.AssetName + } + return "" +} + +func (x *TopAssetItem) GetAssetThumb() string { + if x != nil { + return x.AssetThumb + } + return "" +} + +func (x *TopAssetItem) GetTotalEarnings() int64 { + if x != nil { + return x.TotalEarnings + } + return 0 +} + +func (x *TopAssetItem) GetRank() int32 { + if x != nil { + return x.Rank + } + return 0 +} + +type GetTopAssetsByEarningResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Items []*TopAssetItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetTopAssetsByEarningResponse) Reset() { + *x = GetTopAssetsByEarningResponse{} + mi := &file_statistic_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetTopAssetsByEarningResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTopAssetsByEarningResponse) ProtoMessage() {} + +func (x *GetTopAssetsByEarningResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTopAssetsByEarningResponse.ProtoReflect.Descriptor instead. +func (*GetTopAssetsByEarningResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{13} +} + +func (x *GetTopAssetsByEarningResponse) GetItems() []*TopAssetItem { + if x != nil { + return x.Items + } + return nil +} + +// ====== 6. 藏品等级分布 ====== +type GetAssetLevelDistributionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StarId int64 `protobuf:"varint,1,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAssetLevelDistributionRequest) Reset() { + *x = GetAssetLevelDistributionRequest{} + mi := &file_statistic_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAssetLevelDistributionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAssetLevelDistributionRequest) ProtoMessage() {} + +func (x *GetAssetLevelDistributionRequest) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAssetLevelDistributionRequest.ProtoReflect.Descriptor instead. +func (*GetAssetLevelDistributionRequest) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{14} +} + +func (x *GetAssetLevelDistributionRequest) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +type AssetLevelItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + Level string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"` // 藏品等级 + Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` // 当前持有该等级的藏品数 + Total int32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` // 累计(历史)该等级藏品数 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssetLevelItem) Reset() { + *x = AssetLevelItem{} + mi := &file_statistic_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssetLevelItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssetLevelItem) ProtoMessage() {} + +func (x *AssetLevelItem) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AssetLevelItem.ProtoReflect.Descriptor instead. +func (*AssetLevelItem) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{15} +} + +func (x *AssetLevelItem) GetLevel() string { + if x != nil { + return x.Level + } + return "" +} + +func (x *AssetLevelItem) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +func (x *AssetLevelItem) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +type GetAssetLevelDistributionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Items []*AssetLevelItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAssetLevelDistributionResponse) Reset() { + *x = GetAssetLevelDistributionResponse{} + mi := &file_statistic_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAssetLevelDistributionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAssetLevelDistributionResponse) ProtoMessage() {} + +func (x *GetAssetLevelDistributionResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAssetLevelDistributionResponse.ProtoReflect.Descriptor instead. +func (*GetAssetLevelDistributionResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{16} +} + +func (x *GetAssetLevelDistributionResponse) GetItems() []*AssetLevelItem { + if x != nil { + return x.Items + } + return nil +} + +// ====== 7. 升级进度 ====== +type GetAssetUpgradeProgressRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + StarId int64 `protobuf:"varint,1,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAssetUpgradeProgressRequest) Reset() { + *x = GetAssetUpgradeProgressRequest{} + mi := &file_statistic_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAssetUpgradeProgressRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAssetUpgradeProgressRequest) ProtoMessage() {} + +func (x *GetAssetUpgradeProgressRequest) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAssetUpgradeProgressRequest.ProtoReflect.Descriptor instead. +func (*GetAssetUpgradeProgressRequest) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{17} +} + +func (x *GetAssetUpgradeProgressRequest) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +type UpcomingLevelUpItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + AssetId int64 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + AssetName string `protobuf:"bytes,2,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"` + AssetThumb string `protobuf:"bytes,3,opt,name=asset_thumb,json=assetThumb,proto3" json:"asset_thumb,omitempty"` + LikeProgress int32 `protobuf:"varint,4,opt,name=like_progress,json=likeProgress,proto3" json:"like_progress,omitempty"` // 0-100 进度 + DurationProgress int32 `protobuf:"varint,5,opt,name=duration_progress,json=durationProgress,proto3" json:"duration_progress,omitempty"` // 0-100 进度 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpcomingLevelUpItem) Reset() { + *x = UpcomingLevelUpItem{} + mi := &file_statistic_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpcomingLevelUpItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpcomingLevelUpItem) ProtoMessage() {} + +func (x *UpcomingLevelUpItem) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpcomingLevelUpItem.ProtoReflect.Descriptor instead. +func (*UpcomingLevelUpItem) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{18} +} + +func (x *UpcomingLevelUpItem) GetAssetId() int64 { + if x != nil { + return x.AssetId + } + return 0 +} + +func (x *UpcomingLevelUpItem) GetAssetName() string { + if x != nil { + return x.AssetName + } + return "" +} + +func (x *UpcomingLevelUpItem) GetAssetThumb() string { + if x != nil { + return x.AssetThumb + } + return "" +} + +func (x *UpcomingLevelUpItem) GetLikeProgress() int32 { + if x != nil { + return x.LikeProgress + } + return 0 +} + +func (x *UpcomingLevelUpItem) GetDurationProgress() int32 { + if x != nil { + return x.DurationProgress + } + return 0 +} + +type RecentLevelUpItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + AssetId int64 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"` + AssetName string `protobuf:"bytes,2,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"` + AssetThumb string `protobuf:"bytes,3,opt,name=asset_thumb,json=assetThumb,proto3" json:"asset_thumb,omitempty"` + NewLevel string `protobuf:"bytes,4,opt,name=new_level,json=newLevel,proto3" json:"new_level,omitempty"` + UpgradeTime int64 `protobuf:"varint,5,opt,name=upgrade_time,json=upgradeTime,proto3" json:"upgrade_time,omitempty"` // ms timestamp + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RecentLevelUpItem) Reset() { + *x = RecentLevelUpItem{} + mi := &file_statistic_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RecentLevelUpItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecentLevelUpItem) ProtoMessage() {} + +func (x *RecentLevelUpItem) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecentLevelUpItem.ProtoReflect.Descriptor instead. +func (*RecentLevelUpItem) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{19} +} + +func (x *RecentLevelUpItem) GetAssetId() int64 { + if x != nil { + return x.AssetId + } + return 0 +} + +func (x *RecentLevelUpItem) GetAssetName() string { + if x != nil { + return x.AssetName + } + return "" +} + +func (x *RecentLevelUpItem) GetAssetThumb() string { + if x != nil { + return x.AssetThumb + } + return "" +} + +func (x *RecentLevelUpItem) GetNewLevel() string { + if x != nil { + return x.NewLevel + } + return "" +} + +func (x *RecentLevelUpItem) GetUpgradeTime() int64 { + if x != nil { + return x.UpgradeTime + } + return 0 +} + +type GetAssetUpgradeProgressResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Upcoming []*UpcomingLevelUpItem `protobuf:"bytes,1,rep,name=upcoming,proto3" json:"upcoming,omitempty"` + Recent []*RecentLevelUpItem `protobuf:"bytes,2,rep,name=recent,proto3" json:"recent,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAssetUpgradeProgressResponse) Reset() { + *x = GetAssetUpgradeProgressResponse{} + mi := &file_statistic_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAssetUpgradeProgressResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAssetUpgradeProgressResponse) ProtoMessage() {} + +func (x *GetAssetUpgradeProgressResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAssetUpgradeProgressResponse.ProtoReflect.Descriptor instead. +func (*GetAssetUpgradeProgressResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{20} +} + +func (x *GetAssetUpgradeProgressResponse) GetUpcoming() []*UpcomingLevelUpItem { + if x != nil { + return x.Upcoming + } + return nil +} + +func (x *GetAssetUpgradeProgressResponse) GetRecent() []*RecentLevelUpItem { + if x != nil { + return x.Recent + } + return nil +} + +// ====== 事件采集响应 ====== +type TrackEventResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Accepted int32 `protobuf:"varint,1,opt,name=accepted,proto3" json:"accepted,omitempty"` // 成功接收并进入 channel 的事件数 + Rejected int32 `protobuf:"varint,2,opt,name=rejected,proto3" json:"rejected,omitempty"` // 被拒收的事件数(格式错误、限流等) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TrackEventResponse) Reset() { + *x = TrackEventResponse{} + mi := &file_statistic_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TrackEventResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TrackEventResponse) ProtoMessage() {} + +func (x *TrackEventResponse) ProtoReflect() protoreflect.Message { + mi := &file_statistic_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TrackEventResponse.ProtoReflect.Descriptor instead. +func (*TrackEventResponse) Descriptor() ([]byte, []int) { + return file_statistic_proto_rawDescGZIP(), []int{21} +} + +func (x *TrackEventResponse) GetAccepted() int32 { + if x != nil { + return x.Accepted + } + return 0 +} + +func (x *TrackEventResponse) GetRejected() int32 { + if x != nil { + return x.Rejected + } + return 0 +} + +var File_statistic_proto protoreflect.FileDescriptor + +const file_statistic_proto_rawDesc = "" + + "\n" + + "\x0fstatistic.proto\x12\x11topfans.statistic\x1a\x11proto/event.proto\"2\n" + + "\x17GetTodayOverviewRequest\x12\x17\n" + + "\astar_id\x18\x01 \x01(\x03R\x06starId\"\xad\x01\n" + + "\x18GetTodayOverviewResponse\x12'\n" + + "\x0fcrystal_balance\x18\x01 \x01(\x03R\x0ecrystalBalance\x12!\n" + + "\ftoday_income\x18\x02 \x01(\x03R\vtodayIncome\x12\x1b\n" + + "\tweek_rank\x18\x03 \x01(\x05R\bweekRank\x12(\n" + + "\x10week_total_users\x18\x04 \x01(\x05R\x0eweekTotalUsers\"4\n" + + "\x19Get7DayIncomeCurveRequest\x12\x17\n" + + "\astar_id\x18\x01 \x01(\x03R\x06starId\"r\n" + + "\x10DailyIncomePoint\x12\x12\n" + + "\x04date\x18\x01 \x01(\tR\x04date\x12\x16\n" + + "\x06income\x18\x02 \x01(\x03R\x06income\x12\x19\n" + + "\bis_today\x18\x03 \x01(\bR\aisToday\x12\x17\n" + + "\ais_peak\x18\x04 \x01(\bR\x06isPeak\"\x9b\x01\n" + + "\x1aGet7DayIncomeCurveResponse\x12;\n" + + "\x06points\x18\x01 \x03(\v2#.topfans.statistic.DailyIncomePointR\x06points\x12!\n" + + "\ftotal_income\x18\x02 \x01(\x03R\vtotalIncome\x12\x1d\n" + + "\n" + + "avg_income\x18\x03 \x01(\x03R\tavgIncome\"<\n" + + "!GetExhibitionIncomeSummaryRequest\x12\x17\n" + + "\astar_id\x18\x01 \x01(\x03R\x06starId\"\xd3\x01\n" + + "\x11TopExhibitionItem\x12\x19\n" + + "\basset_id\x18\x01 \x01(\x03R\aassetId\x12\x1d\n" + + "\n" + + "asset_name\x18\x02 \x01(\tR\tassetName\x12\x1f\n" + + "\vasset_thumb\x18\x03 \x01(\tR\n" + + "assetThumb\x12\x1f\n" + + "\vduration_7d\x18\x04 \x01(\tR\n" + + "duration7d\x12\x1f\n" + + "\vearnings_7d\x18\x05 \x01(\x03R\n" + + "earnings7d\x12!\n" + + "\favg_earnings\x18\x06 \x01(\x05R\vavgEarnings\"\xfe\x01\n" + + "\"GetExhibitionIncomeSummaryResponse\x12)\n" + + "\x10exhibiting_count\x18\x01 \x01(\x05R\x0fexhibitingCount\x12%\n" + + "\x0estarbook_count\x18\x02 \x01(\x05R\rstarbookCount\x12%\n" + + "\x0etotal_duration\x18\x03 \x01(\tR\rtotalDuration\x12%\n" + + "\x0etotal_earnings\x18\x04 \x01(\x03R\rtotalEarnings\x128\n" + + "\x04top5\x18\x05 \x03(\v2$.topfans.statistic.TopExhibitionItemR\x04top5\"6\n" + + "\x1bGetLikeIncomeByLevelRequest\x12\x17\n" + + "\astar_id\x18\x01 \x01(\x03R\x06starId\"\x85\x01\n" + + "\x13LikeIncomeLevelItem\x12\x14\n" + + "\x05level\x18\x01 \x01(\tR\x05level\x12\x1f\n" + + "\vasset_count\x18\x02 \x01(\x05R\n" + + "assetCount\x12!\n" + + "\ftotal_income\x18\x03 \x01(\x03R\vtotalIncome\x12\x14\n" + + "\x05thumb\x18\x04 \x01(\tR\x05thumb\"\xab\x01\n" + + "\x1cGetLikeIncomeByLevelResponse\x12(\n" + + "\x10total_like_count\x18\x01 \x01(\x03R\x0etotalLikeCount\x12!\n" + + "\ftotal_income\x18\x02 \x01(\x03R\vtotalIncome\x12>\n" + + "\x06levels\x18\x03 \x03(\v2&.topfans.statistic.LikeIncomeLevelItemR\x06levels\"7\n" + + "\x1cGetTopAssetsByEarningRequest\x12\x17\n" + + "\astar_id\x18\x01 \x01(\x03R\x06starId\"\xa4\x01\n" + + "\fTopAssetItem\x12\x19\n" + + "\basset_id\x18\x01 \x01(\x03R\aassetId\x12\x1d\n" + + "\n" + + "asset_name\x18\x02 \x01(\tR\tassetName\x12\x1f\n" + + "\vasset_thumb\x18\x03 \x01(\tR\n" + + "assetThumb\x12%\n" + + "\x0etotal_earnings\x18\x04 \x01(\x03R\rtotalEarnings\x12\x12\n" + + "\x04rank\x18\x05 \x01(\x05R\x04rank\"V\n" + + "\x1dGetTopAssetsByEarningResponse\x125\n" + + "\x05items\x18\x01 \x03(\v2\x1f.topfans.statistic.TopAssetItemR\x05items\";\n" + + " GetAssetLevelDistributionRequest\x12\x17\n" + + "\astar_id\x18\x01 \x01(\x03R\x06starId\"R\n" + + "\x0eAssetLevelItem\x12\x14\n" + + "\x05level\x18\x01 \x01(\tR\x05level\x12\x14\n" + + "\x05count\x18\x02 \x01(\x05R\x05count\x12\x14\n" + + "\x05total\x18\x03 \x01(\x05R\x05total\"\\\n" + + "!GetAssetLevelDistributionResponse\x127\n" + + "\x05items\x18\x01 \x03(\v2!.topfans.statistic.AssetLevelItemR\x05items\"9\n" + + "\x1eGetAssetUpgradeProgressRequest\x12\x17\n" + + "\astar_id\x18\x01 \x01(\x03R\x06starId\"\xc2\x01\n" + + "\x13UpcomingLevelUpItem\x12\x19\n" + + "\basset_id\x18\x01 \x01(\x03R\aassetId\x12\x1d\n" + + "\n" + + "asset_name\x18\x02 \x01(\tR\tassetName\x12\x1f\n" + + "\vasset_thumb\x18\x03 \x01(\tR\n" + + "assetThumb\x12#\n" + + "\rlike_progress\x18\x04 \x01(\x05R\flikeProgress\x12+\n" + + "\x11duration_progress\x18\x05 \x01(\x05R\x10durationProgress\"\xae\x01\n" + + "\x11RecentLevelUpItem\x12\x19\n" + + "\basset_id\x18\x01 \x01(\x03R\aassetId\x12\x1d\n" + + "\n" + + "asset_name\x18\x02 \x01(\tR\tassetName\x12\x1f\n" + + "\vasset_thumb\x18\x03 \x01(\tR\n" + + "assetThumb\x12\x1b\n" + + "\tnew_level\x18\x04 \x01(\tR\bnewLevel\x12!\n" + + "\fupgrade_time\x18\x05 \x01(\x03R\vupgradeTime\"\xa3\x01\n" + + "\x1fGetAssetUpgradeProgressResponse\x12B\n" + + "\bupcoming\x18\x01 \x03(\v2&.topfans.statistic.UpcomingLevelUpItemR\bupcoming\x12<\n" + + "\x06recent\x18\x02 \x03(\v2$.topfans.statistic.RecentLevelUpItemR\x06recent\"L\n" + + "\x12TrackEventResponse\x12\x1a\n" + + "\baccepted\x18\x01 \x01(\x05R\baccepted\x12\x1a\n" + + "\brejected\x18\x02 \x01(\x05R\brejected2\xa6\b\n" + + "\x10StatisticService\x12k\n" + + "\x10GetTodayOverview\x12*.topfans.statistic.GetTodayOverviewRequest\x1a+.topfans.statistic.GetTodayOverviewResponse\x12q\n" + + "\x12Get7DayIncomeCurve\x12,.topfans.statistic.Get7DayIncomeCurveRequest\x1a-.topfans.statistic.Get7DayIncomeCurveResponse\x12\x89\x01\n" + + "\x1aGetExhibitionIncomeSummary\x124.topfans.statistic.GetExhibitionIncomeSummaryRequest\x1a5.topfans.statistic.GetExhibitionIncomeSummaryResponse\x12w\n" + + "\x14GetLikeIncomeByLevel\x12..topfans.statistic.GetLikeIncomeByLevelRequest\x1a/.topfans.statistic.GetLikeIncomeByLevelResponse\x12z\n" + + "\x15GetTopAssetsByEarning\x12/.topfans.statistic.GetTopAssetsByEarningRequest\x1a0.topfans.statistic.GetTopAssetsByEarningResponse\x12\x86\x01\n" + + "\x19GetAssetLevelDistribution\x123.topfans.statistic.GetAssetLevelDistributionRequest\x1a4.topfans.statistic.GetAssetLevelDistributionResponse\x12\x80\x01\n" + + "\x17GetAssetUpgradeProgress\x121.topfans.statistic.GetAssetUpgradeProgressRequest\x1a2.topfans.statistic.GetAssetUpgradeProgressResponse\x12I\n" + + "\n" + + "TrackEvent\x12\x14.topfans.event.Event\x1a%.topfans.statistic.TrackEventResponse\x12Z\n" + + "\x0fBatchTrackEvent\x12 .topfans.event.BatchEventRequest\x1a%.topfans.statistic.TrackEventResponseB:Z8github.com/topfans/backend/pkg/proto/statistic;statisticb\x06proto3" + +var ( + file_statistic_proto_rawDescOnce sync.Once + file_statistic_proto_rawDescData []byte +) + +func file_statistic_proto_rawDescGZIP() []byte { + file_statistic_proto_rawDescOnce.Do(func() { + file_statistic_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_statistic_proto_rawDesc), len(file_statistic_proto_rawDesc))) + }) + return file_statistic_proto_rawDescData +} + +var file_statistic_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_statistic_proto_goTypes = []any{ + (*GetTodayOverviewRequest)(nil), // 0: topfans.statistic.GetTodayOverviewRequest + (*GetTodayOverviewResponse)(nil), // 1: topfans.statistic.GetTodayOverviewResponse + (*Get7DayIncomeCurveRequest)(nil), // 2: topfans.statistic.Get7DayIncomeCurveRequest + (*DailyIncomePoint)(nil), // 3: topfans.statistic.DailyIncomePoint + (*Get7DayIncomeCurveResponse)(nil), // 4: topfans.statistic.Get7DayIncomeCurveResponse + (*GetExhibitionIncomeSummaryRequest)(nil), // 5: topfans.statistic.GetExhibitionIncomeSummaryRequest + (*TopExhibitionItem)(nil), // 6: topfans.statistic.TopExhibitionItem + (*GetExhibitionIncomeSummaryResponse)(nil), // 7: topfans.statistic.GetExhibitionIncomeSummaryResponse + (*GetLikeIncomeByLevelRequest)(nil), // 8: topfans.statistic.GetLikeIncomeByLevelRequest + (*LikeIncomeLevelItem)(nil), // 9: topfans.statistic.LikeIncomeLevelItem + (*GetLikeIncomeByLevelResponse)(nil), // 10: topfans.statistic.GetLikeIncomeByLevelResponse + (*GetTopAssetsByEarningRequest)(nil), // 11: topfans.statistic.GetTopAssetsByEarningRequest + (*TopAssetItem)(nil), // 12: topfans.statistic.TopAssetItem + (*GetTopAssetsByEarningResponse)(nil), // 13: topfans.statistic.GetTopAssetsByEarningResponse + (*GetAssetLevelDistributionRequest)(nil), // 14: topfans.statistic.GetAssetLevelDistributionRequest + (*AssetLevelItem)(nil), // 15: topfans.statistic.AssetLevelItem + (*GetAssetLevelDistributionResponse)(nil), // 16: topfans.statistic.GetAssetLevelDistributionResponse + (*GetAssetUpgradeProgressRequest)(nil), // 17: topfans.statistic.GetAssetUpgradeProgressRequest + (*UpcomingLevelUpItem)(nil), // 18: topfans.statistic.UpcomingLevelUpItem + (*RecentLevelUpItem)(nil), // 19: topfans.statistic.RecentLevelUpItem + (*GetAssetUpgradeProgressResponse)(nil), // 20: topfans.statistic.GetAssetUpgradeProgressResponse + (*TrackEventResponse)(nil), // 21: topfans.statistic.TrackEventResponse + (*event.Event)(nil), // 22: topfans.event.Event + (*event.BatchEventRequest)(nil), // 23: topfans.event.BatchEventRequest +} +var file_statistic_proto_depIdxs = []int32{ + 3, // 0: topfans.statistic.Get7DayIncomeCurveResponse.points:type_name -> topfans.statistic.DailyIncomePoint + 6, // 1: topfans.statistic.GetExhibitionIncomeSummaryResponse.top5:type_name -> topfans.statistic.TopExhibitionItem + 9, // 2: topfans.statistic.GetLikeIncomeByLevelResponse.levels:type_name -> topfans.statistic.LikeIncomeLevelItem + 12, // 3: topfans.statistic.GetTopAssetsByEarningResponse.items:type_name -> topfans.statistic.TopAssetItem + 15, // 4: topfans.statistic.GetAssetLevelDistributionResponse.items:type_name -> topfans.statistic.AssetLevelItem + 18, // 5: topfans.statistic.GetAssetUpgradeProgressResponse.upcoming:type_name -> topfans.statistic.UpcomingLevelUpItem + 19, // 6: topfans.statistic.GetAssetUpgradeProgressResponse.recent:type_name -> topfans.statistic.RecentLevelUpItem + 0, // 7: topfans.statistic.StatisticService.GetTodayOverview:input_type -> topfans.statistic.GetTodayOverviewRequest + 2, // 8: topfans.statistic.StatisticService.Get7DayIncomeCurve:input_type -> topfans.statistic.Get7DayIncomeCurveRequest + 5, // 9: topfans.statistic.StatisticService.GetExhibitionIncomeSummary:input_type -> topfans.statistic.GetExhibitionIncomeSummaryRequest + 8, // 10: topfans.statistic.StatisticService.GetLikeIncomeByLevel:input_type -> topfans.statistic.GetLikeIncomeByLevelRequest + 11, // 11: topfans.statistic.StatisticService.GetTopAssetsByEarning:input_type -> topfans.statistic.GetTopAssetsByEarningRequest + 14, // 12: topfans.statistic.StatisticService.GetAssetLevelDistribution:input_type -> topfans.statistic.GetAssetLevelDistributionRequest + 17, // 13: topfans.statistic.StatisticService.GetAssetUpgradeProgress:input_type -> topfans.statistic.GetAssetUpgradeProgressRequest + 22, // 14: topfans.statistic.StatisticService.TrackEvent:input_type -> topfans.event.Event + 23, // 15: topfans.statistic.StatisticService.BatchTrackEvent:input_type -> topfans.event.BatchEventRequest + 1, // 16: topfans.statistic.StatisticService.GetTodayOverview:output_type -> topfans.statistic.GetTodayOverviewResponse + 4, // 17: topfans.statistic.StatisticService.Get7DayIncomeCurve:output_type -> topfans.statistic.Get7DayIncomeCurveResponse + 7, // 18: topfans.statistic.StatisticService.GetExhibitionIncomeSummary:output_type -> topfans.statistic.GetExhibitionIncomeSummaryResponse + 10, // 19: topfans.statistic.StatisticService.GetLikeIncomeByLevel:output_type -> topfans.statistic.GetLikeIncomeByLevelResponse + 13, // 20: topfans.statistic.StatisticService.GetTopAssetsByEarning:output_type -> topfans.statistic.GetTopAssetsByEarningResponse + 16, // 21: topfans.statistic.StatisticService.GetAssetLevelDistribution:output_type -> topfans.statistic.GetAssetLevelDistributionResponse + 20, // 22: topfans.statistic.StatisticService.GetAssetUpgradeProgress:output_type -> topfans.statistic.GetAssetUpgradeProgressResponse + 21, // 23: topfans.statistic.StatisticService.TrackEvent:output_type -> topfans.statistic.TrackEventResponse + 21, // 24: topfans.statistic.StatisticService.BatchTrackEvent:output_type -> topfans.statistic.TrackEventResponse + 16, // [16:25] is the sub-list for method output_type + 7, // [7:16] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_statistic_proto_init() } +func file_statistic_proto_init() { + if File_statistic_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_statistic_proto_rawDesc), len(file_statistic_proto_rawDesc)), + NumEnums: 0, + NumMessages: 22, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_statistic_proto_goTypes, + DependencyIndexes: file_statistic_proto_depIdxs, + MessageInfos: file_statistic_proto_msgTypes, + }.Build() + File_statistic_proto = out.File + file_statistic_proto_goTypes = nil + file_statistic_proto_depIdxs = nil +} diff --git a/backend/pkg/proto/statistic/statistic.triple.go b/backend/pkg/proto/statistic/statistic.triple.go new file mode 100644 index 0000000..483e286 --- /dev/null +++ b/backend/pkg/proto/statistic/statistic.triple.go @@ -0,0 +1,339 @@ +// Code generated by protoc-gen-triple. DO NOT EDIT. +// +// Source: statistic.proto +package statistic + +import ( + "context" +) + +import ( + "dubbo.apache.org/dubbo-go/v3" + "dubbo.apache.org/dubbo-go/v3/client" + "dubbo.apache.org/dubbo-go/v3/common" + "dubbo.apache.org/dubbo-go/v3/common/constant" + "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol" + "dubbo.apache.org/dubbo-go/v3/server" + event "github.com/topfans/backend/pkg/proto/event" +) + +// This is a compile-time assertion to ensure that this generated file and the Triple package +// are compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of Triple newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of Triple or updating the Triple +// version compiled into your binary. +const _ = triple_protocol.IsAtLeastVersion0_1_0 + +const ( + // StatisticServiceName is the fully-qualified name of the StatisticService service. + StatisticServiceName = "topfans.statistic.StatisticService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // StatisticServiceGetTodayOverviewProcedure is the fully-qualified name of the StatisticService's GetTodayOverview RPC. + StatisticServiceGetTodayOverviewProcedure = "/topfans.statistic.StatisticService/GetTodayOverview" + // StatisticServiceGet7DayIncomeCurveProcedure is the fully-qualified name of the StatisticService's Get7DayIncomeCurve RPC. + StatisticServiceGet7DayIncomeCurveProcedure = "/topfans.statistic.StatisticService/Get7DayIncomeCurve" + // StatisticServiceGetExhibitionIncomeSummaryProcedure is the fully-qualified name of the StatisticService's GetExhibitionIncomeSummary RPC. + StatisticServiceGetExhibitionIncomeSummaryProcedure = "/topfans.statistic.StatisticService/GetExhibitionIncomeSummary" + // StatisticServiceGetLikeIncomeByLevelProcedure is the fully-qualified name of the StatisticService's GetLikeIncomeByLevel RPC. + StatisticServiceGetLikeIncomeByLevelProcedure = "/topfans.statistic.StatisticService/GetLikeIncomeByLevel" + // StatisticServiceGetTopAssetsByEarningProcedure is the fully-qualified name of the StatisticService's GetTopAssetsByEarning RPC. + StatisticServiceGetTopAssetsByEarningProcedure = "/topfans.statistic.StatisticService/GetTopAssetsByEarning" + // StatisticServiceGetAssetLevelDistributionProcedure is the fully-qualified name of the StatisticService's GetAssetLevelDistribution RPC. + StatisticServiceGetAssetLevelDistributionProcedure = "/topfans.statistic.StatisticService/GetAssetLevelDistribution" + // StatisticServiceGetAssetUpgradeProgressProcedure is the fully-qualified name of the StatisticService's GetAssetUpgradeProgress RPC. + StatisticServiceGetAssetUpgradeProgressProcedure = "/topfans.statistic.StatisticService/GetAssetUpgradeProgress" + // StatisticServiceTrackEventProcedure is the fully-qualified name of the StatisticService's TrackEvent RPC. + StatisticServiceTrackEventProcedure = "/topfans.statistic.StatisticService/TrackEvent" + // StatisticServiceBatchTrackEventProcedure is the fully-qualified name of the StatisticService's BatchTrackEvent RPC. + StatisticServiceBatchTrackEventProcedure = "/topfans.statistic.StatisticService/BatchTrackEvent" +) + +var ( + _ StatisticService = (*StatisticServiceImpl)(nil) +) + +// StatisticService is a client for the topfans.statistic.StatisticService service. +type StatisticService interface { + GetTodayOverview(ctx context.Context, req *GetTodayOverviewRequest, opts ...client.CallOption) (*GetTodayOverviewResponse, error) + Get7DayIncomeCurve(ctx context.Context, req *Get7DayIncomeCurveRequest, opts ...client.CallOption) (*Get7DayIncomeCurveResponse, error) + GetExhibitionIncomeSummary(ctx context.Context, req *GetExhibitionIncomeSummaryRequest, opts ...client.CallOption) (*GetExhibitionIncomeSummaryResponse, error) + GetLikeIncomeByLevel(ctx context.Context, req *GetLikeIncomeByLevelRequest, opts ...client.CallOption) (*GetLikeIncomeByLevelResponse, error) + GetTopAssetsByEarning(ctx context.Context, req *GetTopAssetsByEarningRequest, opts ...client.CallOption) (*GetTopAssetsByEarningResponse, error) + GetAssetLevelDistribution(ctx context.Context, req *GetAssetLevelDistributionRequest, opts ...client.CallOption) (*GetAssetLevelDistributionResponse, error) + GetAssetUpgradeProgress(ctx context.Context, req *GetAssetUpgradeProgressRequest, opts ...client.CallOption) (*GetAssetUpgradeProgressResponse, error) + TrackEvent(ctx context.Context, req *event.Event, opts ...client.CallOption) (*TrackEventResponse, error) + BatchTrackEvent(ctx context.Context, req *event.BatchEventRequest, opts ...client.CallOption) (*TrackEventResponse, error) +} + +// NewStatisticService constructs a client for the statistic.StatisticService service. +func NewStatisticService(cli *client.Client, opts ...client.ReferenceOption) (StatisticService, error) { + conn, err := cli.DialWithInfo("topfans.statistic.StatisticService", &StatisticService_ClientInfo, opts...) + if err != nil { + return nil, err + } + return &StatisticServiceImpl{ + conn: conn, + }, nil +} + +func SetConsumerStatisticService(srv common.RPCService) { + dubbo.SetConsumerServiceWithInfo(srv, &StatisticService_ClientInfo) +} + +// StatisticServiceImpl implements StatisticService. +type StatisticServiceImpl struct { + conn *client.Connection +} + +func (c *StatisticServiceImpl) GetTodayOverview(ctx context.Context, req *GetTodayOverviewRequest, opts ...client.CallOption) (*GetTodayOverviewResponse, error) { + resp := new(GetTodayOverviewResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetTodayOverview", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) Get7DayIncomeCurve(ctx context.Context, req *Get7DayIncomeCurveRequest, opts ...client.CallOption) (*Get7DayIncomeCurveResponse, error) { + resp := new(Get7DayIncomeCurveResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Get7DayIncomeCurve", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) GetExhibitionIncomeSummary(ctx context.Context, req *GetExhibitionIncomeSummaryRequest, opts ...client.CallOption) (*GetExhibitionIncomeSummaryResponse, error) { + resp := new(GetExhibitionIncomeSummaryResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetExhibitionIncomeSummary", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) GetLikeIncomeByLevel(ctx context.Context, req *GetLikeIncomeByLevelRequest, opts ...client.CallOption) (*GetLikeIncomeByLevelResponse, error) { + resp := new(GetLikeIncomeByLevelResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetLikeIncomeByLevel", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) GetTopAssetsByEarning(ctx context.Context, req *GetTopAssetsByEarningRequest, opts ...client.CallOption) (*GetTopAssetsByEarningResponse, error) { + resp := new(GetTopAssetsByEarningResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetTopAssetsByEarning", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) GetAssetLevelDistribution(ctx context.Context, req *GetAssetLevelDistributionRequest, opts ...client.CallOption) (*GetAssetLevelDistributionResponse, error) { + resp := new(GetAssetLevelDistributionResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetAssetLevelDistribution", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) GetAssetUpgradeProgress(ctx context.Context, req *GetAssetUpgradeProgressRequest, opts ...client.CallOption) (*GetAssetUpgradeProgressResponse, error) { + resp := new(GetAssetUpgradeProgressResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetAssetUpgradeProgress", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) TrackEvent(ctx context.Context, req *event.Event, opts ...client.CallOption) (*TrackEventResponse, error) { + resp := new(TrackEventResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "TrackEvent", opts...); err != nil { + return nil, err + } + return resp, nil +} + +func (c *StatisticServiceImpl) BatchTrackEvent(ctx context.Context, req *event.BatchEventRequest, opts ...client.CallOption) (*TrackEventResponse, error) { + resp := new(TrackEventResponse) + if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "BatchTrackEvent", opts...); err != nil { + return nil, err + } + return resp, nil +} + +var StatisticService_ClientInfo = client.ClientInfo{ + InterfaceName: "topfans.statistic.StatisticService", + MethodNames: []string{"GetTodayOverview", "Get7DayIncomeCurve", "GetExhibitionIncomeSummary", "GetLikeIncomeByLevel", "GetTopAssetsByEarning", "GetAssetLevelDistribution", "GetAssetUpgradeProgress", "TrackEvent", "BatchTrackEvent"}, + ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) { + dubboCli := dubboCliRaw.(*StatisticServiceImpl) + dubboCli.conn = conn + }, +} + +// StatisticServiceHandler is an implementation of the topfans.statistic.StatisticService service. +type StatisticServiceHandler interface { + GetTodayOverview(context.Context, *GetTodayOverviewRequest) (*GetTodayOverviewResponse, error) + Get7DayIncomeCurve(context.Context, *Get7DayIncomeCurveRequest) (*Get7DayIncomeCurveResponse, error) + GetExhibitionIncomeSummary(context.Context, *GetExhibitionIncomeSummaryRequest) (*GetExhibitionIncomeSummaryResponse, error) + GetLikeIncomeByLevel(context.Context, *GetLikeIncomeByLevelRequest) (*GetLikeIncomeByLevelResponse, error) + GetTopAssetsByEarning(context.Context, *GetTopAssetsByEarningRequest) (*GetTopAssetsByEarningResponse, error) + GetAssetLevelDistribution(context.Context, *GetAssetLevelDistributionRequest) (*GetAssetLevelDistributionResponse, error) + GetAssetUpgradeProgress(context.Context, *GetAssetUpgradeProgressRequest) (*GetAssetUpgradeProgressResponse, error) + TrackEvent(context.Context, *event.Event) (*TrackEventResponse, error) + BatchTrackEvent(context.Context, *event.BatchEventRequest) (*TrackEventResponse, error) +} + +func RegisterStatisticServiceHandler(srv *server.Server, hdlr StatisticServiceHandler, opts ...server.ServiceOption) error { + return srv.Register(hdlr, &StatisticService_ServiceInfo, opts...) +} + +func SetProviderStatisticService(srv common.RPCService) { + dubbo.SetProviderServiceWithInfo(srv, &StatisticService_ServiceInfo) +} + +var StatisticService_ServiceInfo = server.ServiceInfo{ + InterfaceName: "topfans.statistic.StatisticService", + ServiceType: (*StatisticServiceHandler)(nil), + Methods: []server.MethodInfo{ + { + Name: "GetTodayOverview", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetTodayOverviewRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetTodayOverviewRequest) + res, err := handler.(StatisticServiceHandler).GetTodayOverview(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "Get7DayIncomeCurve", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(Get7DayIncomeCurveRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*Get7DayIncomeCurveRequest) + res, err := handler.(StatisticServiceHandler).Get7DayIncomeCurve(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetExhibitionIncomeSummary", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetExhibitionIncomeSummaryRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetExhibitionIncomeSummaryRequest) + res, err := handler.(StatisticServiceHandler).GetExhibitionIncomeSummary(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetLikeIncomeByLevel", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetLikeIncomeByLevelRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetLikeIncomeByLevelRequest) + res, err := handler.(StatisticServiceHandler).GetLikeIncomeByLevel(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetTopAssetsByEarning", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetTopAssetsByEarningRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetTopAssetsByEarningRequest) + res, err := handler.(StatisticServiceHandler).GetTopAssetsByEarning(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetAssetLevelDistribution", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetAssetLevelDistributionRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetAssetLevelDistributionRequest) + res, err := handler.(StatisticServiceHandler).GetAssetLevelDistribution(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "GetAssetUpgradeProgress", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(GetAssetUpgradeProgressRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*GetAssetUpgradeProgressRequest) + res, err := handler.(StatisticServiceHandler).GetAssetUpgradeProgress(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "TrackEvent", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(event.Event) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*event.Event) + res, err := handler.(StatisticServiceHandler).TrackEvent(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + { + Name: "BatchTrackEvent", + Type: constant.CallUnary, + ReqInitFunc: func() interface{} { + return new(event.BatchEventRequest) + }, + MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { + req := args[0].(*event.BatchEventRequest) + res, err := handler.(StatisticServiceHandler).BatchTrackEvent(ctx, req) + if err != nil { + return nil, err + } + return triple_protocol.NewResponse(res), nil + }, + }, + }, +} diff --git a/backend/proto/event.proto b/backend/proto/event.proto new file mode 100644 index 0000000..9dbeba4 --- /dev/null +++ b/backend/proto/event.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package topfans.event; + +option go_package = "github.com/topfans/backend/pkg/proto/event;event"; + +// ==================== 通用事件 ==================== +// 独立 proto 文件,跨服务复用。其他服务(如 socialService、assetService 等) +// 可以只引用 event.proto 而不必引用 statistic.proto,避免循环依赖。 + +// 单条事件 +message Event { + string event_id = 1; // 事件 ID(UUID,客户端生成,用于去重) + int64 user_id = 2; // 用户 ID + int64 star_id = 3; // 顶粉星城 ID + string event_type = 4; // 事件类型(如 "asset.like", "exhibition.start") + int64 occurred_at = 5; // 事件发生时间(ms timestamp) + int64 received_at = 6; // 服务端接收时间(ms,服务端填充) + map properties = 7; // 自定义属性(扁平 key-value) +} + +// 批量事件请求 +message BatchEventRequest { + repeated Event events = 1; +} diff --git a/backend/proto/statistic.proto b/backend/proto/statistic.proto new file mode 100644 index 0000000..5cdfc8c --- /dev/null +++ b/backend/proto/statistic.proto @@ -0,0 +1,146 @@ +syntax = "proto3"; + +package topfans.statistic; + +option go_package = "github.com/topfans/backend/pkg/proto/statistic;statistic"; + +import "proto/event.proto"; + +// ==================== StatisticService ==================== +// 看板 7 RPC(经 gateway 暴露给前端)+ 事件采集 2 RPC(内部)。 +// Go 侧由 mobile_provider.go / internal_provider.go 两个文件实现同名服务。 + +service StatisticService { + // ============ 看板 7 RPC(经 gateway 暴露) ============ + rpc GetTodayOverview(GetTodayOverviewRequest) returns (GetTodayOverviewResponse); + rpc Get7DayIncomeCurve(Get7DayIncomeCurveRequest) returns (Get7DayIncomeCurveResponse); + rpc GetExhibitionIncomeSummary(GetExhibitionIncomeSummaryRequest) returns (GetExhibitionIncomeSummaryResponse); + rpc GetLikeIncomeByLevel(GetLikeIncomeByLevelRequest) returns (GetLikeIncomeByLevelResponse); + rpc GetTopAssetsByEarning(GetTopAssetsByEarningRequest) returns (GetTopAssetsByEarningResponse); + rpc GetAssetLevelDistribution(GetAssetLevelDistributionRequest) returns (GetAssetLevelDistributionResponse); + rpc GetAssetUpgradeProgress(GetAssetUpgradeProgressRequest) returns (GetAssetUpgradeProgressResponse); + + // ============ 事件采集(内部 RPC) ============ + rpc TrackEvent(topfans.event.Event) returns (TrackEventResponse); + rpc BatchTrackEvent(topfans.event.BatchEventRequest) returns (TrackEventResponse); +} + +// ====== 1. 今日概览 ====== +message GetTodayOverviewRequest { + int64 star_id = 1; +} +message GetTodayOverviewResponse { + int64 crystal_balance = 1; + int64 today_income = 2; + int32 week_rank = 3; // 本期完整实现 + int32 week_total_users = 4; // 用于"击败 X%"展示 +} + +// ====== 2. 七日收益曲线 ====== +message Get7DayIncomeCurveRequest { + int64 star_id = 1; +} +message DailyIncomePoint { + string date = 1; // "YYYY-MM-DD" + int64 income = 2; + bool is_today = 3; + bool is_peak = 4; +} +message Get7DayIncomeCurveResponse { + repeated DailyIncomePoint points = 1; + int64 total_income = 2; + int64 avg_income = 3; +} + +// ====== 3. 展出收益中心 ====== +message GetExhibitionIncomeSummaryRequest { + int64 star_id = 1; +} +message TopExhibitionItem { + int64 asset_id = 1; + string asset_name = 2; + string asset_thumb = 3; + string duration_7d = 4; // 7 天累计展示时长("D:HH:MM:SS") + int64 earnings_7d = 5; + int32 avg_earnings = 6; +} +message GetExhibitionIncomeSummaryResponse { + int32 exhibiting_count = 1; // 当前在展藏品数 + int32 starbook_count = 2; // 星图册数 + string total_duration = 3; // 累计展示时长 + int64 total_earnings = 4; // 累计收益 + repeated TopExhibitionItem top5 = 5; +} + +// ====== 4. 点赞收益按等级 ====== +message GetLikeIncomeByLevelRequest { + int64 star_id = 1; +} +message LikeIncomeLevelItem { + string level = 1; // 藏品等级(N/R/SR/SSR/UR) + int32 asset_count = 2; + int64 total_income = 3; + string thumb = 4; // 等级代表缩略图 +} +message GetLikeIncomeByLevelResponse { + int64 total_like_count = 1; + int64 total_income = 2; + repeated LikeIncomeLevelItem levels = 3; +} + +// ====== 5. 藏品 TOP5(按收益) ====== +message GetTopAssetsByEarningRequest { + int64 star_id = 1; +} +message TopAssetItem { + int64 asset_id = 1; + string asset_name = 2; + string asset_thumb = 3; + int64 total_earnings = 4; + int32 rank = 5; +} +message GetTopAssetsByEarningResponse { + repeated TopAssetItem items = 1; +} + +// ====== 6. 藏品等级分布 ====== +message GetAssetLevelDistributionRequest { + int64 star_id = 1; +} +message AssetLevelItem { + string level = 1; // 藏品等级 + int32 count = 2; // 当前持有该等级的藏品数 + int32 total = 3; // 累计(历史)该等级藏品数 +} +message GetAssetLevelDistributionResponse { + repeated AssetLevelItem items = 1; +} + +// ====== 7. 升级进度 ====== +message GetAssetUpgradeProgressRequest { + int64 star_id = 1; +} +message UpcomingLevelUpItem { + int64 asset_id = 1; + string asset_name = 2; + string asset_thumb = 3; + int32 like_progress = 4; // 0-100 进度 + int32 duration_progress = 5; // 0-100 进度 +} +message RecentLevelUpItem { + int64 asset_id = 1; + string asset_name = 2; + string asset_thumb = 3; + string new_level = 4; + int64 upgrade_time = 5; // ms timestamp +} +message GetAssetUpgradeProgressResponse { + repeated UpcomingLevelUpItem upcoming = 1; + repeated RecentLevelUpItem recent = 2; +} + +// ====== 事件采集响应 ====== +message TrackEventResponse { + int32 accepted = 1; // 成功接收并进入 channel 的事件数 + int32 rejected = 2; // 被拒收的事件数(格式错误、限流等) +} diff --git a/backend/scripts/compile-proto.sh b/backend/scripts/compile-proto.sh index fa3a4fe..0ee5598 100755 --- a/backend/scripts/compile-proto.sh +++ b/backend/scripts/compile-proto.sh @@ -67,7 +67,7 @@ move_triple_files() { # 预先创建目标目录 echo "📁 创建目标目录..." -for name in common user social asset gallery ranking activity task starbook ai_chat; do +for name in common user social asset gallery ranking activity task starbook ai_chat event statistic; do mkdir -p "pkg/proto/$name" done echo "" @@ -208,6 +208,75 @@ move_triple_files "topfans/backend/pkg/proto/ai_chat" "pkg/proto/ai_chat" echo "✅ ai_chat.proto 编译完成" echo "" +# 编译 event.proto(仅生成 pb.go;event.proto 没有 service,生成 triple.go 会导致未使用 import 编译失败) +echo "📦 编译 event.proto ..." +protoc --proto_path=proto \ + --proto_path=. \ + --go_out=pkg/proto/event \ + --go_opt=paths=source_relative \ + event.proto + +echo "✅ event.proto 编译完成" +echo "" + +# 编译 statistic.proto +echo "📦 编译 statistic.proto ..." +protoc --proto_path=proto \ + --proto_path=. \ + --go_out=pkg/proto/statistic \ + --go_opt=paths=source_relative \ + --go-triple_out=pkg/proto/statistic \ + --go-triple_opt=paths=source_relative \ + statistic.proto +move_triple_files "topfans/backend/pkg/proto/statistic" "pkg/proto/statistic" + +# 后处理:protoc-gen-go-triple v3.0.0 在跨包类型作 RPC 参数时丢包前缀。 +# statistic.proto 引用了 event.Event / event.BatchEventRequest, +# triple 生成器把它们当作 statistic 包内类型(new(Event) / *Event), +# 而未导入 event 包,导致编译失败。这里补回 event 包导入和类型前缀。 +TRIPLE_FILE="pkg/proto/statistic/statistic.triple.go" +if [ -f "$TRIPLE_FILE" ]; then + if ! grep -q 'github.com/topfans/backend/pkg/proto/event"' "$TRIPLE_FILE"; then + # 在第二个 import 块(dubbo 块)的最末 import 行后追加 event 包导入 + # 用 awk 顺序扫描,找到第二个 "import (" 之后第一个 ")" 之前的最后一行 + python3 -c " +import re, sys +with open('$TRIPLE_FILE', 'r') as f: + src = f.read() +# 找所有 import 块,定位第二个 import ( ... ) +pattern = re.compile(r'(import\s*\([^)]*\))', re.MULTILINE) +blocks = list(pattern.finditer(src)) +if len(blocks) >= 2: + second = blocks[1] + block_text = second.group(1) + if 'pkg/proto/event' not in block_text: + new_block = block_text[:-1].rstrip() + '\n\tevent \"github.com/topfans/backend/pkg/proto/event\"\n)' + src = src[:second.start()] + new_block + src[second.end():] +with open('$TRIPLE_FILE', 'w') as f: + f.write(src) +" + # 把 RPC 方法签名 / new() / 类型断言中的裸 Event / BatchEventRequest 加上 event. 前缀 + # 注意:BSD sed(macOS)不支持 \b,改用 ([,)]) 等显式边界 + sed -i '' \ + -e 's/\*Event\([,)]\)/\*event.Event\1/g' \ + -e 's/\*Event$/&XXX/g' \ + -e 's/\*Event[^a-zA-Z._)/]/\*event.Event\&/g' \ + -e 's/new(Event)/new(event.Event)/g' \ + -e 's/\*BatchEventRequest\([,)]\)/\*event.BatchEventRequest\1/g' \ + -e 's/new(BatchEventRequest)/new(event.BatchEventRequest)/g' \ + "$TRIPLE_FILE" + # 修复 args[0].(*Event) 类型断言 — 用单独的 sed 处理方括号 + sed -i '' \ + -e 's/(\*Event)/(\*event.Event)/g' \ + -e 's/(\*BatchEventRequest)/(\*event.BatchEventRequest)/g' \ + "$TRIPLE_FILE" + echo " ✅ statistic.triple.go 已修复跨包类型引用(protoc-gen-go-triple v3.0.0 bug)" + fi +fi + +echo "✅ statistic.proto 编译完成" +echo "" + # 清理可能存在的冗余目录和文件 echo "🔄 清理冗余文件..." @@ -218,7 +287,7 @@ if [ -d "github.com" ]; then fi # 删除 proto 目录下的生成文件(如果存在) -for name in common user social asset gallery ranking activity task starbook ai_chat; do +for name in common user social asset gallery ranking activity task starbook ai_chat event statistic; do if [ -f "proto/$name.pb.go" ]; then rm "proto/$name.pb.go" echo " ✅ proto/$name.pb.go 已清理"