优化评论点赞代码

This commit is contained in:
liwei1dao 2022-08-18 17:39:25 +08:00
parent 121e7c94d2
commit bf7e6a68b4
5 changed files with 30 additions and 263 deletions

View File

@ -38,5 +38,10 @@
"msgid": "chat.send",
"routrules": "~/worker",
"describe": "聊天消息发送"
},
{
"msgid": "forum.like",
"routrules": "~/worker",
"describe": "论坛点赞入口"
}
]

View File

@ -80,7 +80,7 @@ type DBChat struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Channel ChatChannel `protobuf:"varint,2,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道
Suid string `protobuf:"bytes,3,opt,name=suid,proto3" json:"suid"` //发送用户id
Slv int32 `protobuf:"varint,4,opt,name=slv,proto3" json:"slv"` //发送者等级

View File

@ -72,7 +72,7 @@ type DBComment struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Heroid string `protobuf:"bytes,2,opt,name=heroid,proto3" json:"heroid"` //英雄id
Heroobjid string `protobuf:"bytes,3,opt,name=heroobjid,proto3" json:"heroobjid"` //目标英雄的实例id
Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid"` //发送用户id

View File

@ -29,7 +29,6 @@ type DBPagoda struct {
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
PagodaId int32 `protobuf:"varint,3,opt,name=pagodaId,proto3" json:"pagodaId" bson:"pagodaId"` //塔层
Reward map[int32]bool `protobuf:"bytes,4,rep,name=reward,proto3" json:"reward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 是否领奖
Type int32 `protobuf:"varint,5,opt,name=type,proto3" json:"type"`
}
func (x *DBPagoda) Reset() {
@ -92,105 +91,11 @@ func (x *DBPagoda) GetReward() map[int32]bool {
return nil
}
func (x *DBPagoda) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
type DBPagodaRank struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
PagodaId int32 `protobuf:"varint,3,opt,name=pagodaId,proto3" json:"pagodaId" bson:"pagodaId"` //塔层
Type int32 `protobuf:"varint,4,opt,name=type,proto3" json:"type"` // 塔类型
Nickname string `protobuf:"bytes,5,opt,name=nickname,proto3" json:"nickname"` // 昵称
Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon"` // 头像
}
func (x *DBPagodaRank) Reset() {
*x = DBPagodaRank{}
if protoimpl.UnsafeEnabled {
mi := &file_pagoda_pagoda_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBPagodaRank) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBPagodaRank) ProtoMessage() {}
func (x *DBPagodaRank) ProtoReflect() protoreflect.Message {
mi := &file_pagoda_pagoda_db_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DBPagodaRank.ProtoReflect.Descriptor instead.
func (*DBPagodaRank) Descriptor() ([]byte, []int) {
return file_pagoda_pagoda_db_proto_rawDescGZIP(), []int{1}
}
func (x *DBPagodaRank) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DBPagodaRank) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBPagodaRank) GetPagodaId() int32 {
if x != nil {
return x.PagodaId
}
return 0
}
func (x *DBPagodaRank) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
func (x *DBPagodaRank) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}
func (x *DBPagodaRank) GetIcon() string {
if x != nil {
return x.Icon
}
return ""
}
var File_pagoda_pagoda_db_proto protoreflect.FileDescriptor
var file_pagoda_pagoda_db_proto_rawDesc = []byte{
0x0a, 0x16, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x2f, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x5f,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc6, 0x01, 0x0a, 0x08, 0x44, 0x42, 0x50,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x01, 0x0a, 0x08, 0x44, 0x42, 0x50,
0x61, 0x67, 0x6f, 0x64, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64,
@ -198,22 +103,11 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{
0x61, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x2e, 0x52,
0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61,
0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61,
0x6e, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x69, 0x63, 0x6f, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x72, 0x64, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -228,14 +122,13 @@ func file_pagoda_pagoda_db_proto_rawDescGZIP() []byte {
return file_pagoda_pagoda_db_proto_rawDescData
}
var file_pagoda_pagoda_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_pagoda_pagoda_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pagoda_pagoda_db_proto_goTypes = []interface{}{
(*DBPagoda)(nil), // 0: DBPagoda
(*DBPagodaRank)(nil), // 1: DBPagodaRank
nil, // 2: DBPagoda.RewardEntry
(*DBPagoda)(nil), // 0: DBPagoda
nil, // 1: DBPagoda.RewardEntry
}
var file_pagoda_pagoda_db_proto_depIdxs = []int32{
2, // 0: DBPagoda.reward:type_name -> DBPagoda.RewardEntry
1, // 0: DBPagoda.reward:type_name -> DBPagoda.RewardEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
@ -261,18 +154,6 @@ func file_pagoda_pagoda_db_proto_init() {
return nil
}
}
file_pagoda_pagoda_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBPagodaRank); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -280,7 +161,7 @@ func file_pagoda_pagoda_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pagoda_pagoda_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -305,92 +305,6 @@ func (x *PagodaChallengeResp) GetData() *DBPagoda {
return nil
}
// 排行榜
type PagodaRankListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *PagodaRankListReq) Reset() {
*x = PagodaRankListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_pagoda_pagoda_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PagodaRankListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PagodaRankListReq) ProtoMessage() {}
func (x *PagodaRankListReq) ProtoReflect() protoreflect.Message {
mi := &file_pagoda_pagoda_msg_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PagodaRankListReq.ProtoReflect.Descriptor instead.
func (*PagodaRankListReq) Descriptor() ([]byte, []int) {
return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{6}
}
type PagodaRankListResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Ranks []*DBPagodaRank `protobuf:"bytes,1,rep,name=ranks,proto3" json:"ranks"`
}
func (x *PagodaRankListResp) Reset() {
*x = PagodaRankListResp{}
if protoimpl.UnsafeEnabled {
mi := &file_pagoda_pagoda_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PagodaRankListResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PagodaRankListResp) ProtoMessage() {}
func (x *PagodaRankListResp) ProtoReflect() protoreflect.Message {
mi := &file_pagoda_pagoda_msg_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PagodaRankListResp.ProtoReflect.Descriptor instead.
func (*PagodaRankListResp) Descriptor() ([]byte, []int) {
return file_pagoda_pagoda_msg_proto_rawDescGZIP(), []int{7}
}
func (x *PagodaRankListResp) GetRanks() []*DBPagodaRank {
if x != nil {
return x.Ranks
}
return nil
}
var File_pagoda_pagoda_msg_proto protoreflect.FileDescriptor
var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
@ -415,12 +329,7 @@ var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
0x61, 0x54, 0x79, 0x70, 0x65, 0x22, 0x34, 0x0a, 0x13, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x43,
0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04,
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x50,
0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x13, 0x0a, 0x11, 0x50,
0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
0x22, 0x39, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61,
0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
@ -436,7 +345,7 @@ func file_pagoda_pagoda_msg_proto_rawDescGZIP() []byte {
return file_pagoda_pagoda_msg_proto_rawDescData
}
var file_pagoda_pagoda_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_pagoda_pagoda_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_pagoda_pagoda_msg_proto_goTypes = []interface{}{
(*PagodaGetListReq)(nil), // 0: PagodaGetListReq
(*PagodaGetListResp)(nil), // 1: PagodaGetListResp
@ -444,21 +353,17 @@ var file_pagoda_pagoda_msg_proto_goTypes = []interface{}{
(*PagodaGetRewardResp)(nil), // 3: PagodaGetRewardResp
(*PagodaChallengeReq)(nil), // 4: PagodaChallengeReq
(*PagodaChallengeResp)(nil), // 5: PagodaChallengeResp
(*PagodaRankListReq)(nil), // 6: PagodaRankListReq
(*PagodaRankListResp)(nil), // 7: PagodaRankListResp
(*DBPagoda)(nil), // 8: DBPagoda
(*DBPagodaRank)(nil), // 9: DBPagodaRank
(*DBPagoda)(nil), // 6: DBPagoda
}
var file_pagoda_pagoda_msg_proto_depIdxs = []int32{
8, // 0: PagodaGetListResp.data:type_name -> DBPagoda
8, // 1: PagodaGetRewardResp.data:type_name -> DBPagoda
8, // 2: PagodaChallengeResp.data:type_name -> DBPagoda
9, // 3: PagodaRankListResp.ranks:type_name -> DBPagodaRank
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
6, // 0: PagodaGetListResp.data:type_name -> DBPagoda
6, // 1: PagodaGetRewardResp.data:type_name -> DBPagoda
6, // 2: PagodaChallengeResp.data:type_name -> DBPagoda
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_pagoda_pagoda_msg_proto_init() }
@ -540,30 +445,6 @@ func file_pagoda_pagoda_msg_proto_init() {
return nil
}
}
file_pagoda_pagoda_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PagodaRankListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_pagoda_pagoda_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PagodaRankListResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -571,7 +452,7 @@ func file_pagoda_pagoda_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pagoda_pagoda_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},