上传代码

This commit is contained in:
meixiongfeng 2024-01-30 09:51:22 +08:00
parent a7d9ef9aed
commit 1549f3beae
3 changed files with 27 additions and 69 deletions

View File

@ -18,9 +18,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankLis
ranks []*pb.DBIntegralBoss
// franks []*pb.DBIntegralBoss
players []*pb.DBIntegralRank
myself *pb.DBIntegralRank
err error
bInRank bool // 自己是否入榜
)
if errdata = this.RankListCheck(session, req); errdata != nil {
@ -35,15 +33,6 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankLis
}
return
}
for _, v := range uids {
if v == session.GetUserId() {
bInRank = true
break
}
}
if !bInRank {
uids = append(uids, session.GetUserId())
}
if ranks, err = this.module.modelIntegral.queryPlayers(uids); err != nil {
errdata = &pb.ErrorData{
@ -55,31 +44,13 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankLis
}
players = make([]*pb.DBIntegralRank, len(ranks))
for i, v := range ranks {
if !bInRank { // 没入榜
if v.Uid == session.GetUserId() {
myself = players[i]
} else {
players[i] = &pb.DBIntegralRank{
Id: v.Uid,
Uinfo: v.Uinfo,
Nandu: v.Nandu,
Score: v.Score[req.Nandu],
Line: v.Line[req.Nandu],
Buff: v.Carrybuff[req.Nandu].Buff,
}
}
} else { // 入榜了
if v.Uid == session.GetUserId() {
myself = players[i]
}
players[i] = &pb.DBIntegralRank{
Id: v.Uid,
Uinfo: v.Uinfo,
Nandu: v.Nandu,
Score: v.Score[req.Nandu],
Line: v.Line[req.Nandu],
Buff: v.Carrybuff[req.Nandu].Buff,
}
players[i] = &pb.DBIntegralRank{
Id: v.Uid,
Uinfo: v.Uinfo,
Nandu: v.Nandu,
Score: v.Score[req.Nandu],
Line: v.Line[req.Nandu],
Buff: v.Carrybuff[req.Nandu].Buff,
}
}
// // 获取好友
@ -103,8 +74,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankLis
// }
// }
session.SendMsg(string(this.module.GetType()), "ranklist", &pb.IntegralRankListResp{
Ranks: players,
Myself: myself,
Ranks: players,
})
return
}

View File

@ -208,7 +208,7 @@ type FreightBuff struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Buff []int32 `protobuf:"varint,6,rep,packed,name=buff,proto3" json:"buff"`
Buff []int32 `protobuf:"varint,1,rep,packed,name=buff,proto3" json:"buff"`
}
func (x *FreightBuff) Reset() {
@ -403,7 +403,7 @@ var file_integral_integral_db_proto_rawDesc = []byte{
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x46, 0x72, 0x65, 0x69, 0x67, 0x68,
0x74, 0x42, 0x75, 0x66, 0x66, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x22, 0x21, 0x0a, 0x0b, 0x46, 0x72, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x75, 0x66, 0x66, 0x12,
0x12, 0x0a, 0x04, 0x62, 0x75, 0x66, 0x66, 0x18, 0x06, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x62,
0x12, 0x0a, 0x04, 0x62, 0x75, 0x66, 0x66, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04, 0x62,
0x75, 0x66, 0x66, 0x22, 0xa4, 0x01, 0x0a, 0x0e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72,
0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x69, 0x6e, 0x66, 0x6f, 0x18,

View File

@ -499,9 +499,7 @@ type IntegralRankListResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Ranks []*DBIntegralRank `protobuf:"bytes,1,rep,name=ranks,proto3" json:"ranks"`
// repeated DBIntegralRank friends = 2;
Myself *DBIntegralRank `protobuf:"bytes,2,opt,name=myself,proto3" json:"myself"` // 我自己的数据
Ranks []*DBIntegralRank `protobuf:"bytes,1,rep,name=ranks,proto3" json:"ranks"` // repeated DBIntegralRank friends = 2;
}
func (x *IntegralRankListResp) Reset() {
@ -543,13 +541,6 @@ func (x *IntegralRankListResp) GetRanks() []*DBIntegralRank {
return nil
}
func (x *IntegralRankListResp) GetMyself() *DBIntegralRank {
if x != nil {
return x.Myself
}
return nil
}
// 领取成就
type IntegralGetAchieveReq struct {
state protoimpl.MessageState
@ -710,21 +701,19 @@ var file_integral_integral_msg_proto_rawDesc = []byte{
0x61, 0x72, 0x64, 0x22, 0x2b, 0x0a, 0x13, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52,
0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61,
0x6e, 0x64, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75,
0x22, 0x66, 0x0a, 0x14, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b,
0x22, 0x3d, 0x0a, 0x14, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b,
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x6b,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65,
0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x12,
0x27, 0x0a, 0x06, 0x6d, 0x79, 0x73, 0x65, 0x6c, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b,
0x52, 0x06, 0x6d, 0x79, 0x73, 0x65, 0x6c, 0x66, 0x22, 0x27, 0x0a, 0x15, 0x49, 0x6e, 0x74, 0x65,
0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x22,
0x27, 0x0a, 0x15, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x47, 0x65, 0x74, 0x41, 0x63,
0x68, 0x69, 0x65, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x49, 0x0a, 0x16, 0x49, 0x6e, 0x74, 0x65,
0x67, 0x72, 0x61, 0x6c, 0x47, 0x65, 0x74, 0x41, 0x63, 0x68, 0x69, 0x65, 0x76, 0x65, 0x52, 0x65,
0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69,
0x64, 0x22, 0x49, 0x0a, 0x16, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x47, 0x65, 0x74,
0x41, 0x63, 0x68, 0x69, 0x65, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x05, 0x61,
0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65,
0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
0x69, 0x64, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77,
0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
@ -772,13 +761,12 @@ var file_integral_integral_msg_proto_depIdxs = []int32{
13, // 7: IntegralGetRewardResp.data:type_name -> DBIntegralBoss
17, // 8: IntegralGetRewardResp.award:type_name -> UserAtno
18, // 9: IntegralRankListResp.ranks:type_name -> DBIntegralRank
18, // 10: IntegralRankListResp.myself:type_name -> DBIntegralRank
17, // 11: IntegralGetAchieveResp.award:type_name -> UserAtno
12, // [12:12] is the sub-list for method output_type
12, // [12:12] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
12, // [12:12] is the sub-list for extension extendee
0, // [0:12] is the sub-list for field type_name
17, // 10: IntegralGetAchieveResp.award:type_name -> UserAtno
11, // [11:11] is the sub-list for method output_type
11, // [11:11] 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
}
func init() { file_integral_integral_msg_proto_init() }