diff --git a/backend/gateway/config/config.go b/backend/gateway/config/config.go index 8d7e235..b91430e 100644 --- a/backend/gateway/config/config.go +++ b/backend/gateway/config/config.go @@ -12,7 +12,7 @@ type Config struct { Dubbo DubboConfig JWT JWTConfig OSS OSSConfig - Redis RedisConfig // 新增 + Redis RedisConfig Root string } diff --git a/backend/gateway/controller/activity_controller.go b/backend/gateway/controller/activity_controller.go index d310d26..22fd5f2 100644 --- a/backend/gateway/controller/activity_controller.go +++ b/backend/gateway/controller/activity_controller.go @@ -512,6 +512,99 @@ func (ctrl *ActivityController) GetMintingActivities(c *gin.Context) { response.Success(c, data) } +// GetLatestContributions 获取最新贡献记录(用于实时显示) +// @Summary 获取最新贡献记录 +// @Description 获取活动最新贡献记录,用于实时显示 +// @Tags activities +// @Accept json +// @Produce json +// @Security BearerAuth +// @Param activity_id path int64 true "活动ID" +// @Param since_timestamp query int64 false "时间戳筛选,返回此时间之后的新记录" +// @Param since_id query int64 false "ID筛选,配合since_timestamp使用" +// @Param limit query int false "返回数量,默认5,最大20" +// @Success 200 {object} response.Response +// @Router /api/v1/activities/{activity_id}/contributions/latest [get] +func (ctrl *ActivityController) GetLatestContributions(c *gin.Context) { + // 解析路径参数 + activityIDStr := c.Param("id") + activityID, err := strconv.ParseInt(activityIDStr, 10, 64) + if err != nil { + response.Error(c, http.StatusBadRequest, "活动ID参数错误") + return + } + + // 解析查询参数 + sinceTimestamp, _ := strconv.ParseInt(c.DefaultQuery("since_timestamp", "0"), 10, 64) + sinceID, _ := strconv.ParseInt(c.DefaultQuery("since_id", "0"), 10, 64) + limit, _ := strconv.Atoi(c.DefaultQuery("limit", "5")) + if limit <= 0 { + limit = 5 + } + if limit > 20 { + limit = 20 + } + + logger.Logger.Info("GetLatestContributions request", + zap.Int64("activity_id", activityID), + zap.Int64("since_timestamp", sinceTimestamp), + zap.Int64("since_id", sinceID), + zap.Int("limit", limit), + ) + + // 设置上下文 + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + // 调用 RPC + resp, err := ctrl.activityService.GetLatestContributions(ctx, &pbActivity.GetLatestContributionsRequest{ + ActivityId: activityID, + SinceTimestamp: sinceTimestamp, + SinceId: sinceID, + Limit: int32(limit), + }) + + if err != nil { + logger.Logger.Error("GetLatestContributions RPC failed", zap.Error(err)) + response.Error(c, http.StatusInternalServerError, "获取贡献记录失败") + return + } + + if resp.Base.Code != pbCommon.StatusCode_STATUS_OK { + response.ErrorWithCode(c, int(resp.Base.Code), resp.Base.Message) + return + } + + // 转换响应 + data := convertLatestContributionsResponse(resp) + response.Success(c, data) +} + +// convertLatestContributionsResponse 转换最新贡献记录响应 +func convertLatestContributionsResponse(resp *pbActivity.GetLatestContributionsResponse) map[string]interface{} { + records := make([]map[string]interface{}, 0, len(resp.Records)) + for _, record := range resp.Records { + records = append(records, map[string]interface{}{ + "id": record.Id, + "user_id": record.UserId, + "nickname": record.Nickname, + "avatar_url": record.AvatarUrl, + "star_id": record.StarId, + "item_id": record.ItemId, + "item_type": record.ItemType, + "item_name": record.ItemName, + "item_icon": record.ItemIcon, + "quantity": record.Quantity, + "combo_count": record.ComboCount, + "created_at": record.CreatedAt, + }) + } + + return map[string]interface{}{ + "records": records, + } +} + // convertMintingActivitiesResponse 转换铸造活动列表响应 func convertMintingActivitiesResponse(resp *pbActivity.GetMintingActivitiesResponse) map[string]interface{} { activities := make([]map[string]interface{}, 0, len(resp.Activities)) diff --git a/backend/gateway/router/router.go b/backend/gateway/router/router.go index f50862c..2d632e2 100644 --- a/backend/gateway/router/router.go +++ b/backend/gateway/router/router.go @@ -250,6 +250,7 @@ func SetupRouter(userClient *client.Client, socialClient *client.Client, assetCl activities.GET("/:id/progress", activityCtrl.GetProgress) // 获取活动进度 activities.POST("/:id/purchase", activityCtrl.PurchaseItem) // 购买道具 activities.GET("/:id/ranking", activityCtrl.GetContributionRanking) // 获取贡献点排名 + activities.GET("/:id/contributions/latest", activityCtrl.GetLatestContributions) // 获取最新贡献记录 } // 铸造活动相关路由(运营banner)- 公开接口,不需要认证 diff --git a/backend/pkg/proto/activity/activity.pb.go b/backend/pkg/proto/activity/activity.pb.go index 164623c..d64a75c 100644 --- a/backend/pkg/proto/activity/activity.pb.go +++ b/backend/pkg/proto/activity/activity.pb.go @@ -1359,6 +1359,261 @@ func (x *GetMintingActivitiesResponse) GetTotal() int32 { return 0 } +// 获取最新贡献记录请求(用于实时显示) +type GetLatestContributionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ActivityId int64 `protobuf:"varint,1,opt,name=activity_id,json=activityId,proto3" json:"activity_id,omitempty"` + SinceTimestamp int64 `protobuf:"varint,2,opt,name=since_timestamp,json=sinceTimestamp,proto3" json:"since_timestamp,omitempty"` // 时间戳筛选,返回此时间之后的新记录 + SinceId int64 `protobuf:"varint,3,opt,name=since_id,json=sinceId,proto3" json:"since_id,omitempty"` // ID筛选,配合since_timestamp使用 + Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` // 返回数量,默认5,最大20 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLatestContributionsRequest) Reset() { + *x = GetLatestContributionsRequest{} + mi := &file_activity_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLatestContributionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLatestContributionsRequest) ProtoMessage() {} + +func (x *GetLatestContributionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_activity_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 GetLatestContributionsRequest.ProtoReflect.Descriptor instead. +func (*GetLatestContributionsRequest) Descriptor() ([]byte, []int) { + return file_activity_proto_rawDescGZIP(), []int{16} +} + +func (x *GetLatestContributionsRequest) GetActivityId() int64 { + if x != nil { + return x.ActivityId + } + return 0 +} + +func (x *GetLatestContributionsRequest) GetSinceTimestamp() int64 { + if x != nil { + return x.SinceTimestamp + } + return 0 +} + +func (x *GetLatestContributionsRequest) GetSinceId() int64 { + if x != nil { + return x.SinceId + } + return 0 +} + +func (x *GetLatestContributionsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +// 单条贡献记录 +type ContributionRecord struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Nickname string `protobuf:"bytes,3,opt,name=nickname,proto3" json:"nickname,omitempty"` + AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` + StarId int64 `protobuf:"varint,5,opt,name=star_id,json=starId,proto3" json:"star_id,omitempty"` + ItemId int64 `protobuf:"varint,6,opt,name=item_id,json=itemId,proto3" json:"item_id,omitempty"` + ItemType string `protobuf:"bytes,7,opt,name=item_type,json=itemType,proto3" json:"item_type,omitempty"` + ItemName string `protobuf:"bytes,8,opt,name=item_name,json=itemName,proto3" json:"item_name,omitempty"` + ItemIcon string `protobuf:"bytes,9,opt,name=item_icon,json=itemIcon,proto3" json:"item_icon,omitempty"` + Quantity int32 `protobuf:"varint,10,opt,name=quantity,proto3" json:"quantity,omitempty"` + ComboCount int32 `protobuf:"varint,11,opt,name=combo_count,json=comboCount,proto3" json:"combo_count,omitempty"` + CreatedAt int64 `protobuf:"varint,12,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ContributionRecord) Reset() { + *x = ContributionRecord{} + mi := &file_activity_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ContributionRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContributionRecord) ProtoMessage() {} + +func (x *ContributionRecord) ProtoReflect() protoreflect.Message { + mi := &file_activity_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 ContributionRecord.ProtoReflect.Descriptor instead. +func (*ContributionRecord) Descriptor() ([]byte, []int) { + return file_activity_proto_rawDescGZIP(), []int{17} +} + +func (x *ContributionRecord) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ContributionRecord) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ContributionRecord) GetNickname() string { + if x != nil { + return x.Nickname + } + return "" +} + +func (x *ContributionRecord) GetAvatarUrl() string { + if x != nil { + return x.AvatarUrl + } + return "" +} + +func (x *ContributionRecord) GetStarId() int64 { + if x != nil { + return x.StarId + } + return 0 +} + +func (x *ContributionRecord) GetItemId() int64 { + if x != nil { + return x.ItemId + } + return 0 +} + +func (x *ContributionRecord) GetItemType() string { + if x != nil { + return x.ItemType + } + return "" +} + +func (x *ContributionRecord) GetItemName() string { + if x != nil { + return x.ItemName + } + return "" +} + +func (x *ContributionRecord) GetItemIcon() string { + if x != nil { + return x.ItemIcon + } + return "" +} + +func (x *ContributionRecord) GetQuantity() int32 { + if x != nil { + return x.Quantity + } + return 0 +} + +func (x *ContributionRecord) GetComboCount() int32 { + if x != nil { + return x.ComboCount + } + return 0 +} + +func (x *ContributionRecord) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +// 获取最新贡献记录响应 +type GetLatestContributionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Base *common.BaseResponse `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` + Records []*ContributionRecord `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLatestContributionsResponse) Reset() { + *x = GetLatestContributionsResponse{} + mi := &file_activity_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLatestContributionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLatestContributionsResponse) ProtoMessage() {} + +func (x *GetLatestContributionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_activity_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 GetLatestContributionsResponse.ProtoReflect.Descriptor instead. +func (*GetLatestContributionsResponse) Descriptor() ([]byte, []int) { + return file_activity_proto_rawDescGZIP(), []int{18} +} + +func (x *GetLatestContributionsResponse) GetBase() *common.BaseResponse { + if x != nil { + return x.Base + } + return nil +} + +func (x *GetLatestContributionsResponse) GetRecords() []*ContributionRecord { + if x != nil { + return x.Records + } + return nil +} + var File_activity_proto protoreflect.FileDescriptor const file_activity_proto_rawDesc = "" + @@ -1488,7 +1743,33 @@ const file_activity_proto_rawDesc = "" + "activities\x12\x12\n" + "\x04page\x18\x03 \x01(\x05R\x04page\x12\x1b\n" + "\tpage_size\x18\x04 \x01(\x05R\bpageSize\x12\x14\n" + - "\x05total\x18\x05 \x01(\x05R\x05total2\x91\b\n" + + "\x05total\x18\x05 \x01(\x05R\x05total\"\x9a\x01\n" + + "\x1dGetLatestContributionsRequest\x12\x1f\n" + + "\vactivity_id\x18\x01 \x01(\x03R\n" + + "activityId\x12'\n" + + "\x0fsince_timestamp\x18\x02 \x01(\x03R\x0esinceTimestamp\x12\x19\n" + + "\bsince_id\x18\x03 \x01(\x03R\asinceId\x12\x14\n" + + "\x05limit\x18\x04 \x01(\x05R\x05limit\"\xdd\x02\n" + + "\x12ContributionRecord\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x17\n" + + "\auser_id\x18\x02 \x01(\x03R\x06userId\x12\x1a\n" + + "\bnickname\x18\x03 \x01(\tR\bnickname\x12\x1d\n" + + "\n" + + "avatar_url\x18\x04 \x01(\tR\tavatarUrl\x12\x17\n" + + "\astar_id\x18\x05 \x01(\x03R\x06starId\x12\x17\n" + + "\aitem_id\x18\x06 \x01(\x03R\x06itemId\x12\x1b\n" + + "\titem_type\x18\a \x01(\tR\bitemType\x12\x1b\n" + + "\titem_name\x18\b \x01(\tR\bitemName\x12\x1b\n" + + "\titem_icon\x18\t \x01(\tR\bitemIcon\x12\x1a\n" + + "\bquantity\x18\n" + + " \x01(\x05R\bquantity\x12\x1f\n" + + "\vcombo_count\x18\v \x01(\x05R\n" + + "comboCount\x12\x1d\n" + + "\n" + + "created_at\x18\f \x01(\x03R\tcreatedAt\"\x92\x01\n" + + "\x1eGetLatestContributionsResponse\x120\n" + + "\x04base\x18\x01 \x01(\v2\x1c.topfans.common.BaseResponseR\x04base\x12>\n" + + "\arecords\x18\x02 \x03(\v2$.topfans.activity.ContributionRecordR\arecords2\xce\t\n" + "\x0fActivityService\x12\x82\x01\n" + "\x0fGetActivityList\x12(.topfans.activity.GetActivityListRequest\x1a).topfans.activity.GetActivityListResponse\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/api/v1/activities\x12y\n" + "\vGetActivity\x12$.topfans.activity.GetProgressRequest\x1a\x1a.topfans.activity.Activity\"(\x82\xd3\xe4\x93\x02\"\x12 /api/v1/activities/{activity_id}\x12\x91\x01\n" + @@ -1496,7 +1777,8 @@ const file_activity_proto_rawDesc = "" + "\vGetProgress\x12$.topfans.activity.GetProgressRequest\x1a%.topfans.activity.GetProgressResponse\"1\x82\xd3\xe4\x93\x02+\x12)/api/v1/activities/{activity_id}/progress\x12\x93\x01\n" + "\fPurchaseItem\x12%.topfans.activity.PurchaseItemRequest\x1a&.topfans.activity.PurchaseItemResponse\"4\x82\xd3\xe4\x93\x02.:\x01*\")/api/v1/activities/{activity_id}/purchase\x12\xa7\x01\n" + "\x16GetContributionRanking\x12,.topfans.activity.ContributionRankingRequest\x1a-.topfans.activity.ContributionRankingResponse\"0\x82\xd3\xe4\x93\x02*\x12(/api/v1/activities/{activity_id}/ranking\x12\x99\x01\n" + - "\x14GetMintingActivities\x12-.topfans.activity.GetMintingActivitiesRequest\x1a..topfans.activity.GetMintingActivitiesResponse\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/api/v1/minting-activitiesB8Z6github.com/topfans/backend/pkg/proto/activity;activityb\x06proto3" + "\x14GetMintingActivities\x12-.topfans.activity.GetMintingActivitiesRequest\x1a..topfans.activity.GetMintingActivitiesResponse\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/api/v1/minting-activities\x12\xba\x01\n" + + "\x16GetLatestContributions\x12/.topfans.activity.GetLatestContributionsRequest\x1a0.topfans.activity.GetLatestContributionsResponse\"=\x82\xd3\xe4\x93\x027\x125/api/v1/activities/{activity_id}/contributions/latestB8Z6github.com/topfans/backend/pkg/proto/activity;activityb\x06proto3" var ( file_activity_proto_rawDescOnce sync.Once @@ -1510,57 +1792,64 @@ func file_activity_proto_rawDescGZIP() []byte { return file_activity_proto_rawDescData } -var file_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_activity_proto_goTypes = []any{ - (*Activity)(nil), // 0: topfans.activity.Activity - (*ActivityItem)(nil), // 1: topfans.activity.ActivityItem - (*ActivityItemsResponse)(nil), // 2: topfans.activity.ActivityItemsResponse - (*PurchaseItemRequest)(nil), // 3: topfans.activity.PurchaseItemRequest - (*PurchaseItemResponse)(nil), // 4: topfans.activity.PurchaseItemResponse - (*ContributionRankingRequest)(nil), // 5: topfans.activity.ContributionRankingRequest - (*ContributionRankingItem)(nil), // 6: topfans.activity.ContributionRankingItem - (*ContributionRankingResponse)(nil), // 7: topfans.activity.ContributionRankingResponse - (*MyContribution)(nil), // 8: topfans.activity.MyContribution - (*GetActivityListRequest)(nil), // 9: topfans.activity.GetActivityListRequest - (*GetActivityListResponse)(nil), // 10: topfans.activity.GetActivityListResponse - (*GetProgressRequest)(nil), // 11: topfans.activity.GetProgressRequest - (*GetProgressResponse)(nil), // 12: topfans.activity.GetProgressResponse - (*MintingActivity)(nil), // 13: topfans.activity.MintingActivity - (*GetMintingActivitiesRequest)(nil), // 14: topfans.activity.GetMintingActivitiesRequest - (*GetMintingActivitiesResponse)(nil), // 15: topfans.activity.GetMintingActivitiesResponse - (*common.BaseResponse)(nil), // 16: topfans.common.BaseResponse + (*Activity)(nil), // 0: topfans.activity.Activity + (*ActivityItem)(nil), // 1: topfans.activity.ActivityItem + (*ActivityItemsResponse)(nil), // 2: topfans.activity.ActivityItemsResponse + (*PurchaseItemRequest)(nil), // 3: topfans.activity.PurchaseItemRequest + (*PurchaseItemResponse)(nil), // 4: topfans.activity.PurchaseItemResponse + (*ContributionRankingRequest)(nil), // 5: topfans.activity.ContributionRankingRequest + (*ContributionRankingItem)(nil), // 6: topfans.activity.ContributionRankingItem + (*ContributionRankingResponse)(nil), // 7: topfans.activity.ContributionRankingResponse + (*MyContribution)(nil), // 8: topfans.activity.MyContribution + (*GetActivityListRequest)(nil), // 9: topfans.activity.GetActivityListRequest + (*GetActivityListResponse)(nil), // 10: topfans.activity.GetActivityListResponse + (*GetProgressRequest)(nil), // 11: topfans.activity.GetProgressRequest + (*GetProgressResponse)(nil), // 12: topfans.activity.GetProgressResponse + (*MintingActivity)(nil), // 13: topfans.activity.MintingActivity + (*GetMintingActivitiesRequest)(nil), // 14: topfans.activity.GetMintingActivitiesRequest + (*GetMintingActivitiesResponse)(nil), // 15: topfans.activity.GetMintingActivitiesResponse + (*GetLatestContributionsRequest)(nil), // 16: topfans.activity.GetLatestContributionsRequest + (*ContributionRecord)(nil), // 17: topfans.activity.ContributionRecord + (*GetLatestContributionsResponse)(nil), // 18: topfans.activity.GetLatestContributionsResponse + (*common.BaseResponse)(nil), // 19: topfans.common.BaseResponse } var file_activity_proto_depIdxs = []int32{ 1, // 0: topfans.activity.Activity.items:type_name -> topfans.activity.ActivityItem 1, // 1: topfans.activity.ActivityItemsResponse.items:type_name -> topfans.activity.ActivityItem - 16, // 2: topfans.activity.PurchaseItemResponse.base:type_name -> topfans.common.BaseResponse - 16, // 3: topfans.activity.ContributionRankingResponse.base:type_name -> topfans.common.BaseResponse + 19, // 2: topfans.activity.PurchaseItemResponse.base:type_name -> topfans.common.BaseResponse + 19, // 3: topfans.activity.ContributionRankingResponse.base:type_name -> topfans.common.BaseResponse 6, // 4: topfans.activity.ContributionRankingResponse.items:type_name -> topfans.activity.ContributionRankingItem 8, // 5: topfans.activity.ContributionRankingResponse.my_contribution:type_name -> topfans.activity.MyContribution - 16, // 6: topfans.activity.GetActivityListResponse.base:type_name -> topfans.common.BaseResponse + 19, // 6: topfans.activity.GetActivityListResponse.base:type_name -> topfans.common.BaseResponse 0, // 7: topfans.activity.GetActivityListResponse.activities:type_name -> topfans.activity.Activity - 16, // 8: topfans.activity.GetProgressResponse.base:type_name -> topfans.common.BaseResponse - 16, // 9: topfans.activity.GetMintingActivitiesResponse.base:type_name -> topfans.common.BaseResponse + 19, // 8: topfans.activity.GetProgressResponse.base:type_name -> topfans.common.BaseResponse + 19, // 9: topfans.activity.GetMintingActivitiesResponse.base:type_name -> topfans.common.BaseResponse 13, // 10: topfans.activity.GetMintingActivitiesResponse.activities:type_name -> topfans.activity.MintingActivity - 9, // 11: topfans.activity.ActivityService.GetActivityList:input_type -> topfans.activity.GetActivityListRequest - 11, // 12: topfans.activity.ActivityService.GetActivity:input_type -> topfans.activity.GetProgressRequest - 11, // 13: topfans.activity.ActivityService.GetActivityItems:input_type -> topfans.activity.GetProgressRequest - 11, // 14: topfans.activity.ActivityService.GetProgress:input_type -> topfans.activity.GetProgressRequest - 3, // 15: topfans.activity.ActivityService.PurchaseItem:input_type -> topfans.activity.PurchaseItemRequest - 5, // 16: topfans.activity.ActivityService.GetContributionRanking:input_type -> topfans.activity.ContributionRankingRequest - 14, // 17: topfans.activity.ActivityService.GetMintingActivities:input_type -> topfans.activity.GetMintingActivitiesRequest - 10, // 18: topfans.activity.ActivityService.GetActivityList:output_type -> topfans.activity.GetActivityListResponse - 0, // 19: topfans.activity.ActivityService.GetActivity:output_type -> topfans.activity.Activity - 2, // 20: topfans.activity.ActivityService.GetActivityItems:output_type -> topfans.activity.ActivityItemsResponse - 12, // 21: topfans.activity.ActivityService.GetProgress:output_type -> topfans.activity.GetProgressResponse - 4, // 22: topfans.activity.ActivityService.PurchaseItem:output_type -> topfans.activity.PurchaseItemResponse - 7, // 23: topfans.activity.ActivityService.GetContributionRanking:output_type -> topfans.activity.ContributionRankingResponse - 15, // 24: topfans.activity.ActivityService.GetMintingActivities:output_type -> topfans.activity.GetMintingActivitiesResponse - 18, // [18:25] is the sub-list for method output_type - 11, // [11:18] is the sub-list for method input_type - 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 + 19, // 11: topfans.activity.GetLatestContributionsResponse.base:type_name -> topfans.common.BaseResponse + 17, // 12: topfans.activity.GetLatestContributionsResponse.records:type_name -> topfans.activity.ContributionRecord + 9, // 13: topfans.activity.ActivityService.GetActivityList:input_type -> topfans.activity.GetActivityListRequest + 11, // 14: topfans.activity.ActivityService.GetActivity:input_type -> topfans.activity.GetProgressRequest + 11, // 15: topfans.activity.ActivityService.GetActivityItems:input_type -> topfans.activity.GetProgressRequest + 11, // 16: topfans.activity.ActivityService.GetProgress:input_type -> topfans.activity.GetProgressRequest + 3, // 17: topfans.activity.ActivityService.PurchaseItem:input_type -> topfans.activity.PurchaseItemRequest + 5, // 18: topfans.activity.ActivityService.GetContributionRanking:input_type -> topfans.activity.ContributionRankingRequest + 14, // 19: topfans.activity.ActivityService.GetMintingActivities:input_type -> topfans.activity.GetMintingActivitiesRequest + 16, // 20: topfans.activity.ActivityService.GetLatestContributions:input_type -> topfans.activity.GetLatestContributionsRequest + 10, // 21: topfans.activity.ActivityService.GetActivityList:output_type -> topfans.activity.GetActivityListResponse + 0, // 22: topfans.activity.ActivityService.GetActivity:output_type -> topfans.activity.Activity + 2, // 23: topfans.activity.ActivityService.GetActivityItems:output_type -> topfans.activity.ActivityItemsResponse + 12, // 24: topfans.activity.ActivityService.GetProgress:output_type -> topfans.activity.GetProgressResponse + 4, // 25: topfans.activity.ActivityService.PurchaseItem:output_type -> topfans.activity.PurchaseItemResponse + 7, // 26: topfans.activity.ActivityService.GetContributionRanking:output_type -> topfans.activity.ContributionRankingResponse + 15, // 27: topfans.activity.ActivityService.GetMintingActivities:output_type -> topfans.activity.GetMintingActivitiesResponse + 18, // 28: topfans.activity.ActivityService.GetLatestContributions:output_type -> topfans.activity.GetLatestContributionsResponse + 21, // [21:29] is the sub-list for method output_type + 13, // [13:21] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_activity_proto_init() } @@ -1574,7 +1863,7 @@ func file_activity_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_activity_proto_rawDesc), len(file_activity_proto_rawDesc)), NumEnums: 0, - NumMessages: 16, + NumMessages: 19, NumExtensions: 0, NumServices: 1, }, diff --git a/backend/pkg/proto/activity/activity.triple.go b/backend/pkg/proto/activity/activity.triple.go deleted file mode 100644 index 4093920..0000000 --- a/backend/pkg/proto/activity/activity.triple.go +++ /dev/null @@ -1,284 +0,0 @@ -// Code generated by protoc-gen-triple. DO NOT EDIT. -// -// Source: activity.proto -package activity - -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" -) - -// 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 ( - // ActivityServiceName is the fully-qualified name of the ActivityService service. - ActivityServiceName = "topfans.activity.ActivityService" -) - -// 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 ( - // ActivityServiceGetActivityListProcedure is the fully-qualified name of the ActivityService's GetActivityList RPC. - ActivityServiceGetActivityListProcedure = "/topfans.activity.ActivityService/GetActivityList" - // ActivityServiceGetActivityProcedure is the fully-qualified name of the ActivityService's GetActivity RPC. - ActivityServiceGetActivityProcedure = "/topfans.activity.ActivityService/GetActivity" - // ActivityServiceGetActivityItemsProcedure is the fully-qualified name of the ActivityService's GetActivityItems RPC. - ActivityServiceGetActivityItemsProcedure = "/topfans.activity.ActivityService/GetActivityItems" - // ActivityServiceGetProgressProcedure is the fully-qualified name of the ActivityService's GetProgress RPC. - ActivityServiceGetProgressProcedure = "/topfans.activity.ActivityService/GetProgress" - // ActivityServicePurchaseItemProcedure is the fully-qualified name of the ActivityService's PurchaseItem RPC. - ActivityServicePurchaseItemProcedure = "/topfans.activity.ActivityService/PurchaseItem" - // ActivityServiceGetContributionRankingProcedure is the fully-qualified name of the ActivityService's GetContributionRanking RPC. - ActivityServiceGetContributionRankingProcedure = "/topfans.activity.ActivityService/GetContributionRanking" - // ActivityServiceGetMintingActivitiesProcedure is the fully-qualified name of the ActivityService's GetMintingActivities RPC. - ActivityServiceGetMintingActivitiesProcedure = "/topfans.activity.ActivityService/GetMintingActivities" -) - -var ( - _ ActivityService = (*ActivityServiceImpl)(nil) -) - -// ActivityService is a client for the topfans.activity.ActivityService service. -type ActivityService interface { - GetActivityList(ctx context.Context, req *GetActivityListRequest, opts ...client.CallOption) (*GetActivityListResponse, error) - GetActivity(ctx context.Context, req *GetProgressRequest, opts ...client.CallOption) (*Activity, error) - GetActivityItems(ctx context.Context, req *GetProgressRequest, opts ...client.CallOption) (*ActivityItemsResponse, error) - GetProgress(ctx context.Context, req *GetProgressRequest, opts ...client.CallOption) (*GetProgressResponse, error) - PurchaseItem(ctx context.Context, req *PurchaseItemRequest, opts ...client.CallOption) (*PurchaseItemResponse, error) - GetContributionRanking(ctx context.Context, req *ContributionRankingRequest, opts ...client.CallOption) (*ContributionRankingResponse, error) - GetMintingActivities(ctx context.Context, req *GetMintingActivitiesRequest, opts ...client.CallOption) (*GetMintingActivitiesResponse, error) -} - -// NewActivityService constructs a client for the activity.ActivityService service. -func NewActivityService(cli *client.Client, opts ...client.ReferenceOption) (ActivityService, error) { - conn, err := cli.DialWithInfo("topfans.activity.ActivityService", &ActivityService_ClientInfo, opts...) - if err != nil { - return nil, err - } - return &ActivityServiceImpl{ - conn: conn, - }, nil -} - -func SetConsumerActivityService(srv common.RPCService) { - dubbo.SetConsumerServiceWithInfo(srv, &ActivityService_ClientInfo) -} - -// ActivityServiceImpl implements ActivityService. -type ActivityServiceImpl struct { - conn *client.Connection -} - -func (c *ActivityServiceImpl) GetActivityList(ctx context.Context, req *GetActivityListRequest, opts ...client.CallOption) (*GetActivityListResponse, error) { - resp := new(GetActivityListResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetActivityList", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *ActivityServiceImpl) GetActivity(ctx context.Context, req *GetProgressRequest, opts ...client.CallOption) (*Activity, error) { - resp := new(Activity) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetActivity", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *ActivityServiceImpl) GetActivityItems(ctx context.Context, req *GetProgressRequest, opts ...client.CallOption) (*ActivityItemsResponse, error) { - resp := new(ActivityItemsResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetActivityItems", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *ActivityServiceImpl) GetProgress(ctx context.Context, req *GetProgressRequest, opts ...client.CallOption) (*GetProgressResponse, error) { - resp := new(GetProgressResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetProgress", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *ActivityServiceImpl) PurchaseItem(ctx context.Context, req *PurchaseItemRequest, opts ...client.CallOption) (*PurchaseItemResponse, error) { - resp := new(PurchaseItemResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "PurchaseItem", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *ActivityServiceImpl) GetContributionRanking(ctx context.Context, req *ContributionRankingRequest, opts ...client.CallOption) (*ContributionRankingResponse, error) { - resp := new(ContributionRankingResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetContributionRanking", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *ActivityServiceImpl) GetMintingActivities(ctx context.Context, req *GetMintingActivitiesRequest, opts ...client.CallOption) (*GetMintingActivitiesResponse, error) { - resp := new(GetMintingActivitiesResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetMintingActivities", opts...); err != nil { - return nil, err - } - return resp, nil -} - -var ActivityService_ClientInfo = client.ClientInfo{ - InterfaceName: "topfans.activity.ActivityService", - MethodNames: []string{"GetActivityList", "GetActivity", "GetActivityItems", "GetProgress", "PurchaseItem", "GetContributionRanking", "GetMintingActivities"}, - ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) { - dubboCli := dubboCliRaw.(*ActivityServiceImpl) - dubboCli.conn = conn - }, -} - -// ActivityServiceHandler is an implementation of the topfans.activity.ActivityService service. -type ActivityServiceHandler interface { - GetActivityList(context.Context, *GetActivityListRequest) (*GetActivityListResponse, error) - GetActivity(context.Context, *GetProgressRequest) (*Activity, error) - GetActivityItems(context.Context, *GetProgressRequest) (*ActivityItemsResponse, error) - GetProgress(context.Context, *GetProgressRequest) (*GetProgressResponse, error) - PurchaseItem(context.Context, *PurchaseItemRequest) (*PurchaseItemResponse, error) - GetContributionRanking(context.Context, *ContributionRankingRequest) (*ContributionRankingResponse, error) - GetMintingActivities(context.Context, *GetMintingActivitiesRequest) (*GetMintingActivitiesResponse, error) -} - -func RegisterActivityServiceHandler(srv *server.Server, hdlr ActivityServiceHandler, opts ...server.ServiceOption) error { - return srv.Register(hdlr, &ActivityService_ServiceInfo, opts...) -} - -func SetProviderActivityService(srv common.RPCService) { - dubbo.SetProviderServiceWithInfo(srv, &ActivityService_ServiceInfo) -} - -var ActivityService_ServiceInfo = server.ServiceInfo{ - InterfaceName: "topfans.activity.ActivityService", - ServiceType: (*ActivityServiceHandler)(nil), - Methods: []server.MethodInfo{ - { - Name: "GetActivityList", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetActivityListRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetActivityListRequest) - res, err := handler.(ActivityServiceHandler).GetActivityList(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetActivity", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetProgressRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetProgressRequest) - res, err := handler.(ActivityServiceHandler).GetActivity(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetActivityItems", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetProgressRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetProgressRequest) - res, err := handler.(ActivityServiceHandler).GetActivityItems(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetProgress", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetProgressRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetProgressRequest) - res, err := handler.(ActivityServiceHandler).GetProgress(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "PurchaseItem", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(PurchaseItemRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*PurchaseItemRequest) - res, err := handler.(ActivityServiceHandler).PurchaseItem(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetContributionRanking", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(ContributionRankingRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*ContributionRankingRequest) - res, err := handler.(ActivityServiceHandler).GetContributionRanking(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetMintingActivities", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetMintingActivitiesRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetMintingActivitiesRequest) - res, err := handler.(ActivityServiceHandler).GetMintingActivities(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - }, -} diff --git a/backend/pkg/proto/user/user.triple.go b/backend/pkg/proto/user/user.triple.go deleted file mode 100644 index d6b78a8..0000000 --- a/backend/pkg/proto/user/user.triple.go +++ /dev/null @@ -1,689 +0,0 @@ -// Code generated by protoc-gen-triple. DO NOT EDIT. -// -// Source: user.proto -package user - -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" -) - -// 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 ( - // UserSocialServiceName is the fully-qualified name of the UserSocialService service. - UserSocialServiceName = "topfans.user.UserSocialService" -) - -// 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 ( - // UserSocialServiceRegisterProcedure is the fully-qualified name of the UserSocialService's Register RPC. - UserSocialServiceRegisterProcedure = "/topfans.user.UserSocialService/Register" - // UserSocialServiceLoginProcedure is the fully-qualified name of the UserSocialService's Login RPC. - UserSocialServiceLoginProcedure = "/topfans.user.UserSocialService/Login" - // UserSocialServiceRefreshTokenProcedure is the fully-qualified name of the UserSocialService's RefreshToken RPC. - UserSocialServiceRefreshTokenProcedure = "/topfans.user.UserSocialService/RefreshToken" - // UserSocialServiceValidateTokenProcedure is the fully-qualified name of the UserSocialService's ValidateToken RPC. - UserSocialServiceValidateTokenProcedure = "/topfans.user.UserSocialService/ValidateToken" - // UserSocialServiceLogoutProcedure is the fully-qualified name of the UserSocialService's Logout RPC. - UserSocialServiceLogoutProcedure = "/topfans.user.UserSocialService/Logout" - // UserSocialServiceCheckNicknameProcedure is the fully-qualified name of the UserSocialService's CheckNickname RPC. - UserSocialServiceCheckNicknameProcedure = "/topfans.user.UserSocialService/CheckNickname" - // UserSocialServiceCheckMobileProcedure is the fully-qualified name of the UserSocialService's CheckMobile RPC. - UserSocialServiceCheckMobileProcedure = "/topfans.user.UserSocialService/CheckMobile" - // UserSocialServiceGetUserProcedure is the fully-qualified name of the UserSocialService's GetUser RPC. - UserSocialServiceGetUserProcedure = "/topfans.user.UserSocialService/GetUser" - // UserSocialServiceGetFanProfileProcedure is the fully-qualified name of the UserSocialService's GetFanProfile RPC. - UserSocialServiceGetFanProfileProcedure = "/topfans.user.UserSocialService/GetFanProfile" - // UserSocialServiceUpdateFanProfileSocialProcedure is the fully-qualified name of the UserSocialService's UpdateFanProfileSocial RPC. - UserSocialServiceUpdateFanProfileSocialProcedure = "/topfans.user.UserSocialService/UpdateFanProfileSocial" - // UserSocialServiceUpdateCrystalBalanceProcedure is the fully-qualified name of the UserSocialService's UpdateCrystalBalance RPC. - UserSocialServiceUpdateCrystalBalanceProcedure = "/topfans.user.UserSocialService/UpdateCrystalBalance" - // UserSocialServiceUpdateAssetsCountProcedure is the fully-qualified name of the UserSocialService's UpdateAssetsCount RPC. - UserSocialServiceUpdateAssetsCountProcedure = "/topfans.user.UserSocialService/UpdateAssetsCount" - // UserSocialServiceAddExhibitionHoursProcedure is the fully-qualified name of the UserSocialService's AddExhibitionHours RPC. - UserSocialServiceAddExhibitionHoursProcedure = "/topfans.user.UserSocialService/AddExhibitionHours" - // UserSocialServiceGetCurrentUserProcedure is the fully-qualified name of the UserSocialService's GetCurrentUser RPC. - UserSocialServiceGetCurrentUserProcedure = "/topfans.user.UserSocialService/GetCurrentUser" - // UserSocialServiceGetMyProfileProcedure is the fully-qualified name of the UserSocialService's GetMyProfile RPC. - UserSocialServiceGetMyProfileProcedure = "/topfans.user.UserSocialService/GetMyProfile" - // UserSocialServiceUpdateNicknameProcedure is the fully-qualified name of the UserSocialService's UpdateNickname RPC. - UserSocialServiceUpdateNicknameProcedure = "/topfans.user.UserSocialService/UpdateNickname" - // UserSocialServiceUpdatePasswordProcedure is the fully-qualified name of the UserSocialService's UpdatePassword RPC. - UserSocialServiceUpdatePasswordProcedure = "/topfans.user.UserSocialService/UpdatePassword" - // UserSocialServiceUpdateAvatarProcedure is the fully-qualified name of the UserSocialService's UpdateAvatar RPC. - UserSocialServiceUpdateAvatarProcedure = "/topfans.user.UserSocialService/UpdateAvatar" - // UserSocialServiceGetFanIdentitiesProcedure is the fully-qualified name of the UserSocialService's GetFanIdentities RPC. - UserSocialServiceGetFanIdentitiesProcedure = "/topfans.user.UserSocialService/GetFanIdentities" - // UserSocialServiceGetMyFanIdentitiesProcedure is the fully-qualified name of the UserSocialService's GetMyFanIdentities RPC. - UserSocialServiceGetMyFanIdentitiesProcedure = "/topfans.user.UserSocialService/GetMyFanIdentities" - // UserSocialServiceAddIdentityProcedure is the fully-qualified name of the UserSocialService's AddIdentity RPC. - UserSocialServiceAddIdentityProcedure = "/topfans.user.UserSocialService/AddIdentity" - // UserSocialServiceSwitchIdentityProcedure is the fully-qualified name of the UserSocialService's SwitchIdentity RPC. - UserSocialServiceSwitchIdentityProcedure = "/topfans.user.UserSocialService/SwitchIdentity" -) - -var ( - _ UserSocialService = (*UserSocialServiceImpl)(nil) -) - -// UserSocialService is a client for the topfans.user.UserSocialService service. -type UserSocialService interface { - Register(ctx context.Context, req *RegisterRequest, opts ...client.CallOption) (*RegisterResponse, error) - Login(ctx context.Context, req *LoginRequest, opts ...client.CallOption) (*LoginResponse, error) - RefreshToken(ctx context.Context, req *RefreshTokenRequest, opts ...client.CallOption) (*RefreshTokenResponse, error) - ValidateToken(ctx context.Context, req *ValidateTokenRequest, opts ...client.CallOption) (*ValidateTokenResponse, error) - Logout(ctx context.Context, req *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error) - CheckNickname(ctx context.Context, req *CheckNicknameRequest, opts ...client.CallOption) (*CheckNicknameResponse, error) - CheckMobile(ctx context.Context, req *CheckMobileRequest, opts ...client.CallOption) (*CheckMobileResponse, error) - GetUser(ctx context.Context, req *GetUserRequest, opts ...client.CallOption) (*GetUserResponse, error) - GetFanProfile(ctx context.Context, req *GetFanProfileRequest, opts ...client.CallOption) (*GetFanProfileResponse, error) - UpdateFanProfileSocial(ctx context.Context, req *UpdateFanProfileSocialRequest, opts ...client.CallOption) (*UpdateFanProfileSocialResponse, error) - UpdateCrystalBalance(ctx context.Context, req *UpdateCrystalBalanceRequest, opts ...client.CallOption) (*UpdateCrystalBalanceResponse, error) - UpdateAssetsCount(ctx context.Context, req *UpdateAssetsCountRequest, opts ...client.CallOption) (*UpdateAssetsCountResponse, error) - AddExhibitionHours(ctx context.Context, req *AddExhibitionHoursRequest, opts ...client.CallOption) (*AddExhibitionHoursResponse, error) - GetCurrentUser(ctx context.Context, req *GetCurrentUserRequest, opts ...client.CallOption) (*GetCurrentUserResponse, error) - GetMyProfile(ctx context.Context, req *GetMyProfileRequest, opts ...client.CallOption) (*GetMyProfileResponse, error) - UpdateNickname(ctx context.Context, req *UpdateNicknameRequest, opts ...client.CallOption) (*UpdateNicknameResponse, error) - UpdatePassword(ctx context.Context, req *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error) - UpdateAvatar(ctx context.Context, req *UpdateAvatarRequest, opts ...client.CallOption) (*UpdateAvatarResponse, error) - GetFanIdentities(ctx context.Context, req *GetFanIdentitiesRequest, opts ...client.CallOption) (*GetFanIdentitiesResponse, error) - GetMyFanIdentities(ctx context.Context, req *GetMyFanIdentitiesRequest, opts ...client.CallOption) (*GetMyFanIdentitiesResponse, error) - AddIdentity(ctx context.Context, req *AddIdentityRequest, opts ...client.CallOption) (*AddIdentityResponse, error) - SwitchIdentity(ctx context.Context, req *SwitchIdentityRequest, opts ...client.CallOption) (*SwitchIdentityResponse, error) -} - -// NewUserSocialService constructs a client for the user.UserSocialService service. -func NewUserSocialService(cli *client.Client, opts ...client.ReferenceOption) (UserSocialService, error) { - conn, err := cli.DialWithInfo("topfans.user.UserSocialService", &UserSocialService_ClientInfo, opts...) - if err != nil { - return nil, err - } - return &UserSocialServiceImpl{ - conn: conn, - }, nil -} - -func SetConsumerUserSocialService(srv common.RPCService) { - dubbo.SetConsumerServiceWithInfo(srv, &UserSocialService_ClientInfo) -} - -// UserSocialServiceImpl implements UserSocialService. -type UserSocialServiceImpl struct { - conn *client.Connection -} - -func (c *UserSocialServiceImpl) Register(ctx context.Context, req *RegisterRequest, opts ...client.CallOption) (*RegisterResponse, error) { - resp := new(RegisterResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Register", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) Login(ctx context.Context, req *LoginRequest, opts ...client.CallOption) (*LoginResponse, error) { - resp := new(LoginResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Login", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) RefreshToken(ctx context.Context, req *RefreshTokenRequest, opts ...client.CallOption) (*RefreshTokenResponse, error) { - resp := new(RefreshTokenResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "RefreshToken", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) ValidateToken(ctx context.Context, req *ValidateTokenRequest, opts ...client.CallOption) (*ValidateTokenResponse, error) { - resp := new(ValidateTokenResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "ValidateToken", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) Logout(ctx context.Context, req *LogoutRequest, opts ...client.CallOption) (*LogoutResponse, error) { - resp := new(LogoutResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Logout", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) CheckNickname(ctx context.Context, req *CheckNicknameRequest, opts ...client.CallOption) (*CheckNicknameResponse, error) { - resp := new(CheckNicknameResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "CheckNickname", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) CheckMobile(ctx context.Context, req *CheckMobileRequest, opts ...client.CallOption) (*CheckMobileResponse, error) { - resp := new(CheckMobileResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "CheckMobile", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) GetUser(ctx context.Context, req *GetUserRequest, opts ...client.CallOption) (*GetUserResponse, error) { - resp := new(GetUserResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetUser", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) GetFanProfile(ctx context.Context, req *GetFanProfileRequest, opts ...client.CallOption) (*GetFanProfileResponse, error) { - resp := new(GetFanProfileResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetFanProfile", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) UpdateFanProfileSocial(ctx context.Context, req *UpdateFanProfileSocialRequest, opts ...client.CallOption) (*UpdateFanProfileSocialResponse, error) { - resp := new(UpdateFanProfileSocialResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateFanProfileSocial", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) UpdateCrystalBalance(ctx context.Context, req *UpdateCrystalBalanceRequest, opts ...client.CallOption) (*UpdateCrystalBalanceResponse, error) { - resp := new(UpdateCrystalBalanceResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateCrystalBalance", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) UpdateAssetsCount(ctx context.Context, req *UpdateAssetsCountRequest, opts ...client.CallOption) (*UpdateAssetsCountResponse, error) { - resp := new(UpdateAssetsCountResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateAssetsCount", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) AddExhibitionHours(ctx context.Context, req *AddExhibitionHoursRequest, opts ...client.CallOption) (*AddExhibitionHoursResponse, error) { - resp := new(AddExhibitionHoursResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "AddExhibitionHours", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) GetCurrentUser(ctx context.Context, req *GetCurrentUserRequest, opts ...client.CallOption) (*GetCurrentUserResponse, error) { - resp := new(GetCurrentUserResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetCurrentUser", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) GetMyProfile(ctx context.Context, req *GetMyProfileRequest, opts ...client.CallOption) (*GetMyProfileResponse, error) { - resp := new(GetMyProfileResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetMyProfile", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) UpdateNickname(ctx context.Context, req *UpdateNicknameRequest, opts ...client.CallOption) (*UpdateNicknameResponse, error) { - resp := new(UpdateNicknameResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateNickname", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) UpdatePassword(ctx context.Context, req *UpdatePasswordRequest, opts ...client.CallOption) (*UpdatePasswordResponse, error) { - resp := new(UpdatePasswordResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdatePassword", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) UpdateAvatar(ctx context.Context, req *UpdateAvatarRequest, opts ...client.CallOption) (*UpdateAvatarResponse, error) { - resp := new(UpdateAvatarResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UpdateAvatar", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) GetFanIdentities(ctx context.Context, req *GetFanIdentitiesRequest, opts ...client.CallOption) (*GetFanIdentitiesResponse, error) { - resp := new(GetFanIdentitiesResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetFanIdentities", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) GetMyFanIdentities(ctx context.Context, req *GetMyFanIdentitiesRequest, opts ...client.CallOption) (*GetMyFanIdentitiesResponse, error) { - resp := new(GetMyFanIdentitiesResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetMyFanIdentities", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) AddIdentity(ctx context.Context, req *AddIdentityRequest, opts ...client.CallOption) (*AddIdentityResponse, error) { - resp := new(AddIdentityResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "AddIdentity", opts...); err != nil { - return nil, err - } - return resp, nil -} - -func (c *UserSocialServiceImpl) SwitchIdentity(ctx context.Context, req *SwitchIdentityRequest, opts ...client.CallOption) (*SwitchIdentityResponse, error) { - resp := new(SwitchIdentityResponse) - if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "SwitchIdentity", opts...); err != nil { - return nil, err - } - return resp, nil -} - -var UserSocialService_ClientInfo = client.ClientInfo{ - InterfaceName: "topfans.user.UserSocialService", - MethodNames: []string{"Register", "Login", "RefreshToken", "ValidateToken", "Logout", "CheckNickname", "CheckMobile", "GetUser", "GetFanProfile", "UpdateFanProfileSocial", "UpdateCrystalBalance", "UpdateAssetsCount", "AddExhibitionHours", "GetCurrentUser", "GetMyProfile", "UpdateNickname", "UpdatePassword", "UpdateAvatar", "GetFanIdentities", "GetMyFanIdentities", "AddIdentity", "SwitchIdentity"}, - ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) { - dubboCli := dubboCliRaw.(*UserSocialServiceImpl) - dubboCli.conn = conn - }, -} - -// UserSocialServiceHandler is an implementation of the topfans.user.UserSocialService service. -type UserSocialServiceHandler interface { - Register(context.Context, *RegisterRequest) (*RegisterResponse, error) - Login(context.Context, *LoginRequest) (*LoginResponse, error) - RefreshToken(context.Context, *RefreshTokenRequest) (*RefreshTokenResponse, error) - ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error) - Logout(context.Context, *LogoutRequest) (*LogoutResponse, error) - CheckNickname(context.Context, *CheckNicknameRequest) (*CheckNicknameResponse, error) - CheckMobile(context.Context, *CheckMobileRequest) (*CheckMobileResponse, error) - GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) - GetFanProfile(context.Context, *GetFanProfileRequest) (*GetFanProfileResponse, error) - UpdateFanProfileSocial(context.Context, *UpdateFanProfileSocialRequest) (*UpdateFanProfileSocialResponse, error) - UpdateCrystalBalance(context.Context, *UpdateCrystalBalanceRequest) (*UpdateCrystalBalanceResponse, error) - UpdateAssetsCount(context.Context, *UpdateAssetsCountRequest) (*UpdateAssetsCountResponse, error) - AddExhibitionHours(context.Context, *AddExhibitionHoursRequest) (*AddExhibitionHoursResponse, error) - GetCurrentUser(context.Context, *GetCurrentUserRequest) (*GetCurrentUserResponse, error) - GetMyProfile(context.Context, *GetMyProfileRequest) (*GetMyProfileResponse, error) - UpdateNickname(context.Context, *UpdateNicknameRequest) (*UpdateNicknameResponse, error) - UpdatePassword(context.Context, *UpdatePasswordRequest) (*UpdatePasswordResponse, error) - UpdateAvatar(context.Context, *UpdateAvatarRequest) (*UpdateAvatarResponse, error) - GetFanIdentities(context.Context, *GetFanIdentitiesRequest) (*GetFanIdentitiesResponse, error) - GetMyFanIdentities(context.Context, *GetMyFanIdentitiesRequest) (*GetMyFanIdentitiesResponse, error) - AddIdentity(context.Context, *AddIdentityRequest) (*AddIdentityResponse, error) - SwitchIdentity(context.Context, *SwitchIdentityRequest) (*SwitchIdentityResponse, error) -} - -func RegisterUserSocialServiceHandler(srv *server.Server, hdlr UserSocialServiceHandler, opts ...server.ServiceOption) error { - return srv.Register(hdlr, &UserSocialService_ServiceInfo, opts...) -} - -func SetProviderUserSocialService(srv common.RPCService) { - dubbo.SetProviderServiceWithInfo(srv, &UserSocialService_ServiceInfo) -} - -var UserSocialService_ServiceInfo = server.ServiceInfo{ - InterfaceName: "topfans.user.UserSocialService", - ServiceType: (*UserSocialServiceHandler)(nil), - Methods: []server.MethodInfo{ - { - Name: "Register", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(RegisterRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*RegisterRequest) - res, err := handler.(UserSocialServiceHandler).Register(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "Login", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(LoginRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*LoginRequest) - res, err := handler.(UserSocialServiceHandler).Login(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "RefreshToken", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(RefreshTokenRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*RefreshTokenRequest) - res, err := handler.(UserSocialServiceHandler).RefreshToken(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "ValidateToken", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(ValidateTokenRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*ValidateTokenRequest) - res, err := handler.(UserSocialServiceHandler).ValidateToken(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "Logout", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(LogoutRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*LogoutRequest) - res, err := handler.(UserSocialServiceHandler).Logout(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "CheckNickname", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(CheckNicknameRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*CheckNicknameRequest) - res, err := handler.(UserSocialServiceHandler).CheckNickname(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "CheckMobile", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(CheckMobileRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*CheckMobileRequest) - res, err := handler.(UserSocialServiceHandler).CheckMobile(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetUser", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetUserRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetUserRequest) - res, err := handler.(UserSocialServiceHandler).GetUser(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetFanProfile", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetFanProfileRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetFanProfileRequest) - res, err := handler.(UserSocialServiceHandler).GetFanProfile(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "UpdateFanProfileSocial", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(UpdateFanProfileSocialRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*UpdateFanProfileSocialRequest) - res, err := handler.(UserSocialServiceHandler).UpdateFanProfileSocial(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "UpdateCrystalBalance", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(UpdateCrystalBalanceRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*UpdateCrystalBalanceRequest) - res, err := handler.(UserSocialServiceHandler).UpdateCrystalBalance(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "UpdateAssetsCount", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(UpdateAssetsCountRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*UpdateAssetsCountRequest) - res, err := handler.(UserSocialServiceHandler).UpdateAssetsCount(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "AddExhibitionHours", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(AddExhibitionHoursRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*AddExhibitionHoursRequest) - res, err := handler.(UserSocialServiceHandler).AddExhibitionHours(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetCurrentUser", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetCurrentUserRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetCurrentUserRequest) - res, err := handler.(UserSocialServiceHandler).GetCurrentUser(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetMyProfile", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetMyProfileRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetMyProfileRequest) - res, err := handler.(UserSocialServiceHandler).GetMyProfile(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "UpdateNickname", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(UpdateNicknameRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*UpdateNicknameRequest) - res, err := handler.(UserSocialServiceHandler).UpdateNickname(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "UpdatePassword", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(UpdatePasswordRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*UpdatePasswordRequest) - res, err := handler.(UserSocialServiceHandler).UpdatePassword(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "UpdateAvatar", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(UpdateAvatarRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*UpdateAvatarRequest) - res, err := handler.(UserSocialServiceHandler).UpdateAvatar(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetFanIdentities", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetFanIdentitiesRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetFanIdentitiesRequest) - res, err := handler.(UserSocialServiceHandler).GetFanIdentities(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "GetMyFanIdentities", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(GetMyFanIdentitiesRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*GetMyFanIdentitiesRequest) - res, err := handler.(UserSocialServiceHandler).GetMyFanIdentities(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "AddIdentity", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(AddIdentityRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*AddIdentityRequest) - res, err := handler.(UserSocialServiceHandler).AddIdentity(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - { - Name: "SwitchIdentity", - Type: constant.CallUnary, - ReqInitFunc: func() interface{} { - return new(SwitchIdentityRequest) - }, - MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) { - req := args[0].(*SwitchIdentityRequest) - res, err := handler.(UserSocialServiceHandler).SwitchIdentity(ctx, req) - if err != nil { - return nil, err - } - return triple_protocol.NewResponse(res), nil - }, - }, - }, -} diff --git a/backend/proto/activity.proto b/backend/proto/activity.proto index 333ae31..d7798a5 100644 --- a/backend/proto/activity.proto +++ b/backend/proto/activity.proto @@ -168,6 +168,36 @@ message GetMintingActivitiesResponse { int32 total = 5; } +// 获取最新贡献记录请求(用于实时显示) +message GetLatestContributionsRequest { + int64 activity_id = 1; + int64 since_timestamp = 2; // 时间戳筛选,返回此时间之后的新记录 + int64 since_id = 3; // ID筛选,配合since_timestamp使用 + int32 limit = 4; // 返回数量,默认5,最大20 +} + +// 单条贡献记录 +message ContributionRecord { + int64 id = 1; + int64 user_id = 2; + string nickname = 3; + string avatar_url = 4; + int64 star_id = 5; + int64 item_id = 6; + string item_type = 7; + string item_name = 8; + string item_icon = 9; + int32 quantity = 10; + int32 combo_count = 11; + int64 created_at = 12; +} + +// 获取最新贡献记录响应 +message GetLatestContributionsResponse { + topfans.common.BaseResponse base = 1; + repeated ContributionRecord records = 2; +} + // ==================== 活动服务 ==================== service ActivityService { @@ -220,4 +250,11 @@ service ActivityService { get: "/api/v1/minting-activities" }; } + + // 获取最新贡献记录(用于实时显示) + rpc GetLatestContributions(GetLatestContributionsRequest) returns (GetLatestContributionsResponse) { + option (google.api.http) = { + get: "/api/v1/activities/{activity_id}/contributions/latest" + }; + } } diff --git a/backend/scripts/migrations/migrate_create_activity_contributions_table.sql b/backend/scripts/migrations/migrate_create_activity_contributions_table.sql new file mode 100644 index 0000000..97b59f6 --- /dev/null +++ b/backend/scripts/migrations/migrate_create_activity_contributions_table.sql @@ -0,0 +1,40 @@ +-- Migration: Create activity_contributions table +-- Description: 用户活动贡献记录表,用于实时显示最新贡献 + +-- 1. 创建 activity_contributions 表 +CREATE TABLE IF NOT EXISTS activity_contributions ( + id BIGSERIAL PRIMARY KEY, + activity_id BIGINT NOT NULL, + user_id BIGINT NOT NULL, + star_id BIGINT NOT NULL, + item_id BIGINT NOT NULL, + item_type VARCHAR(50) NOT NULL, + quantity INTEGER NOT NULL DEFAULT 1, + crystal_spent BIGINT NOT NULL, + contribution_points BIGINT NOT NULL, + created_at BIGINT NOT NULL +); + +-- 2. 创建索引 +CREATE INDEX IF NOT EXISTS idx_activity_contributions_activity ON activity_contributions(activity_id); +CREATE INDEX IF NOT EXISTS idx_activity_contributions_user_star ON activity_contributions(user_id, star_id); +CREATE INDEX IF NOT EXISTS idx_activity_contributions_created ON activity_contributions(created_at DESC); + +-- 3. 添加外键约束 +ALTER TABLE activity_contributions + ADD CONSTRAINT fk_activity_contributions_activity FOREIGN KEY (activity_id) REFERENCES activities(id) ON DELETE CASCADE, + ADD CONSTRAINT fk_activity_contributions_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, + ADD CONSTRAINT fk_activity_contributions_item FOREIGN KEY (item_id) REFERENCES activity_items(id) ON DELETE CASCADE, + ADD CONSTRAINT fk_activity_contributions_star FOREIGN KEY (star_id) REFERENCES stars(star_id) ON DELETE CASCADE; + +-- 4. 添加注释 +COMMENT ON TABLE activity_contributions IS '用户活动贡献记录表'; +COMMENT ON COLUMN activity_contributions.activity_id IS '活动ID'; +COMMENT ON COLUMN activity_contributions.user_id IS '用户ID'; +COMMENT ON COLUMN activity_contributions.star_id IS '粉丝身份ID'; +COMMENT ON COLUMN activity_contributions.item_id IS '道具ID'; +COMMENT ON COLUMN activity_contributions.item_type IS '道具类型'; +COMMENT ON COLUMN activity_contributions.quantity IS '购买数量'; +COMMENT ON COLUMN activity_contributions.crystal_spent IS '消耗水晶数'; +COMMENT ON COLUMN activity_contributions.contribution_points IS '贡献点数'; +COMMENT ON COLUMN activity_contributions.created_at IS '创建时间(毫秒时间戳)'; \ No newline at end of file diff --git a/backend/services/activityService/repository/activity_repository.go b/backend/services/activityService/repository/activity_repository.go index 25722e1..ca8b52b 100644 --- a/backend/services/activityService/repository/activity_repository.go +++ b/backend/services/activityService/repository/activity_repository.go @@ -42,6 +42,9 @@ type ActivityRepository interface { // GetUserRank 获取用户排名 GetUserRank(userID, activityID, starID int64) (int, error) + + // GetLatestContributions 获取最新贡献记录(用于实时显示) + GetLatestContributions(activityID int64, sinceTimestamp int64, sinceID int64, limit int) ([]*models.ActivityContribution, error) } // activityRepository Activity仓库实现 @@ -287,3 +290,34 @@ func (r *activityRepository) GetUserRank(userID, activityID, starID int64) (int, return int(count) + 1, nil } + +// GetLatestContributions 获取最新贡献记录(用于实时显示) +func (r *activityRepository) GetLatestContributions(activityID int64, sinceTimestamp int64, sinceID int64, limit int) ([]*models.ActivityContribution, error) { + if activityID <= 0 { + return nil, errors.New("activity_id must be greater than 0") + } + + if limit <= 0 { + limit = 5 + } + if limit > 20 { + limit = 20 // 最多返回20条 + } + + query := r.db.Model(&models.ActivityContribution{}). + Where("activity_id = ?", activityID). + Order("created_at DESC, id DESC") + + // 如果有 sinceTimestamp 和 sinceID,进行分页查询 + // 用于增量获取:获取 created_at > sinceTimestamp 或者 (created_at == sinceTimestamp AND id > sinceID) 的记录 + if sinceTimestamp > 0 { + query = query.Where("created_at > ? OR (created_at = ? AND id > ?)", sinceTimestamp, sinceTimestamp, sinceID) + } + + var contributions []*models.ActivityContribution + if err := query.Limit(limit).Find(&contributions).Error; err != nil { + return nil, err + } + + return contributions, nil +} diff --git a/backend/services/activityService/service/activity_service.go b/backend/services/activityService/service/activity_service.go index c74d531..366ec80 100644 --- a/backend/services/activityService/service/activity_service.go +++ b/backend/services/activityService/service/activity_service.go @@ -37,6 +37,9 @@ type ActivityService interface { // GetMintingActivities 获取铸造活动列表(用于运营banner) GetMintingActivities(ctx context.Context, req *pb.GetMintingActivitiesRequest) (*pb.GetMintingActivitiesResponse, error) + + // GetLatestContributions 获取最新贡献记录(用于实时显示) + GetLatestContributions(ctx context.Context, req *pb.GetLatestContributionsRequest) (*pb.GetLatestContributionsResponse, error) } // activityService 活动Service实现 @@ -611,4 +614,93 @@ func (s *activityService) GetMintingActivities(ctx context.Context, req *pb.GetM PageSize: req.PageSize, Total: int32(total), }, nil +} + +// GetLatestContributions 获取最新贡献记录(用于实时显示) +func (s *activityService) GetLatestContributions(ctx context.Context, req *pb.GetLatestContributionsRequest) (*pb.GetLatestContributionsResponse, error) { + logger.Logger.Info("GetLatestContributions request", + zap.Int64("activity_id", req.ActivityId), + zap.Int64("since_timestamp", req.SinceTimestamp), + zap.Int64("since_id", req.SinceId), + zap.Int32("limit", req.Limit), + ) + + if req.ActivityId <= 0 { + return &pb.GetLatestContributionsResponse{ + Base: &pbCommon.BaseResponse{ + Code: 400, + Message: "activity_id is required", + }, + }, nil + } + + limit := int(req.Limit) + if limit <= 0 { + limit = 5 + } + if limit > 20 { + limit = 20 + } + + // 获取贡献记录 + contributions, err := s.activityRepo.GetLatestContributions(req.ActivityId, req.SinceTimestamp, req.SinceId, limit) + if err != nil { + logger.Logger.Error("GetLatestContributions failed", zap.Error(err)) + return &pb.GetLatestContributionsResponse{ + Base: &pbCommon.BaseResponse{ + Code: 500, + Message: "获取贡献记录失败: " + err.Error(), + }, + }, nil + } + + // 转换结果 + records := make([]*pb.ContributionRecord, len(contributions)) + for i, c := range contributions { + // 获取用户昵称和头像 + nickname, avatarUrl := "", "" + if req.SinceTimestamp == 0 && req.SinceId == 0 { + // 只在首次全量拉取时获取用户信息 + fanProfile, err := s.userRPCClient.GetFanProfile(c.UserID, c.StarID) + if err == nil && fanProfile != nil { + nickname = fanProfile.Nickname + avatarUrl = fanProfile.AvatarUrl + } + } + + // 获取道具信息 + itemName, itemIcon := "", "" + items, err := s.activityRepo.GetActivityItems(req.ActivityId) + if err == nil { + for _, item := range items { + if item.ID == c.ItemID { + itemName = item.ItemName + itemIcon = item.IconURL + break + } + } + } + + records[i] = &pb.ContributionRecord{ + Id: c.ID, + UserId: c.UserID, + Nickname: nickname, + AvatarUrl: avatarUrl, + StarId: c.StarID, + ItemId: c.ItemID, + ItemType: c.ItemType, + ItemName: itemName, + ItemIcon: itemIcon, + Quantity: int32(c.Quantity), + CreatedAt: c.CreatedAt, + } + } + + return &pb.GetLatestContributionsResponse{ + Base: &pbCommon.BaseResponse{ + Code: 200, + Message: "ok", + }, + Records: records, + }, nil } \ No newline at end of file diff --git a/frontend/pages/profile/myWorks.vue b/frontend/pages/profile/myWorks.vue index 687980a..85f1aeb 100644 --- a/frontend/pages/profile/myWorks.vue +++ b/frontend/pages/profile/myWorks.vue @@ -28,15 +28,29 @@ - - + + + + + + + 领取收益 + + + + {{ exhibitionAtSlot[0].like_count || 0 }} - + {{ formatCountdown(exhibitionAtSlot[0].id) }} @@ -48,22 +62,37 @@ - + + + - - + + + + + + + + 领取收益 + + + {{ exhibitionAtSlot[1].like_count || 0 }} - + {{ formatCountdown(exhibitionAtSlot[1].id) }} @@ -75,7 +104,8 @@ - + + + @@ -116,16 +146,11 @@ - + :transforms="getLikedLenticularTransforms(item.id)" :gyro-source="gyroSourceLabel" + :skip-built-in-touch="false" :shimmer-mid-opacity="0.16" + @simulate="(x, y) => onLikedLenticularSimulate(item.id, x, y)" /> { // if (data?.earnings !== undefined) { // exhibitionWorks.value[index].earnings = data.earnings; // } else { - // 如果没有返回收益数据,刷新列表获取最新收益 + // 如果没有返回收益数据,刷新列表获取最新收益 await loadExhibitedAssets(); await loadLikedAssets(); - + // } uni.showToast({ title: '点赞成功', icon: 'success' }); @@ -795,7 +820,7 @@ const loadExhibitedAssets = async () => { cover_url: item.cover_url, like_count: item.like_count, earnings: item.earnings, - hourly_earnings:item.hourly_earnings, + hourly_earnings: item.hourly_earnings, exhibited_at: item.exhibited_at, expire_at: item.expire_at, name: item.name, @@ -1056,13 +1081,14 @@ onShow(() => { .card-tilt-left { transform: rotate(-4deg) translateY(10rpx); - margin-right: 64rpx; + margin-right: 32rpx; border-radius: 32rpx; box-shadow: -16rpx 16rpx 16rpx rgba(229, 76, 93, 0.9); } .card-tilt-right { transform: rotate(4deg) translateY(10rpx); + margin-left: 32rpx; border-radius: 32rpx; box-shadow: 16rpx 16rpx 16rpx rgba(229, 76, 93, 0.9); } @@ -1294,6 +1320,7 @@ onShow(() => { border-radius: 20rpx; overflow: visible; position: relative; + margin: 0 32rpx; } .empty-card-left { @@ -1312,6 +1339,7 @@ onShow(() => { z-index: 3; padding: 16rpx; opacity: 0.5; + } /* 卡片内的添加按钮 */ diff --git a/frontend/pages/support-activity/index.vue b/frontend/pages/support-activity/index.vue index 6cd9af1..96efcce 100644 --- a/frontend/pages/support-activity/index.vue +++ b/frontend/pages/support-activity/index.vue @@ -22,11 +22,11 @@ /> - + />