上传代码

This commit is contained in:
liwei1dao 2024-01-25 10:18:18 +08:00
parent c3ffcaa0ab
commit afa1ca9a9f
4 changed files with 59 additions and 39 deletions

View File

@ -78,6 +78,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
})
return
}
if errdata = this.module.ConsumeRes(session, cfgEnchant.PsConsume, true); errdata != nil {
return
}
@ -101,8 +102,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
this.module.CheckRank(session.GetUserId(), req.BossType, req.Report, userinfo, req.Score)
}
enchant.Boss[req.BossType] = req.Score // 获得的积分
enchant.Boss[req.BossType] = req.Report.Score // 获得的积分
enchant.Grade[req.BossType] = req.Report.Grade // 获得的积分
for _, v1 := range conf.Reward1Drop {
reward := this.module.ModuleTools.GetGroupDataByLottery(v1, userinfo.Vip, userinfo.Lv)
res = append(res, reward...)

View File

@ -26,8 +26,9 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListRe
list.Id = primitive.NewObjectID().Hex()
list.Uid = session.GetUserId()
list.Boss = make(map[int32]int64)
list.Boss = make(map[int32]int32)
list.BossTime = make(map[int32]int32)
list.Grade = make(map[int32]int32)
this.module.modelEnchant.Add(session.GetUserId(), list)
}

View File

@ -36,8 +36,9 @@ func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBEnchant, err
result = &pb.DBEnchant{
Id: primitive.NewObjectID().Hex(),
Uid: uid,
Boss: make(map[int32]int64),
Boss: make(map[int32]int32),
BossTime: make(map[int32]int32),
Grade: make(map[int32]int32),
}
if err = this.Get(uid, result); err != nil {
return

View File

@ -27,11 +27,12 @@ type DBEnchant struct {
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
Boss map[int32]int64 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分
Boss map[int32]int32 `protobuf:"bytes,3,rep,name=boss,proto3" json:"boss" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分
BuyCount int32 `protobuf:"varint,4,opt,name=buyCount,proto3" json:"buyCount" bson:"buyCount"` //购买次数
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间
BossTime map[int32]int32 `protobuf:"bytes,6,rep,name=bossTime,proto3" json:"bossTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"bossTime"` //
RecoveryTime int64 `protobuf:"varint,7,opt,name=recoveryTime,proto3" json:"recoveryTime" bson:"recoveryTime"` //// 开始恢复的时间
Grade map[int32]int32 `protobuf:"bytes,8,rep,name=grade,proto3" json:"grade" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key boss 类型 value 积分
}
func (x *DBEnchant) Reset() {
@ -80,7 +81,7 @@ func (x *DBEnchant) GetUid() string {
return ""
}
func (x *DBEnchant) GetBoss() map[int32]int64 {
func (x *DBEnchant) GetBoss() map[int32]int32 {
if x != nil {
return x.Boss
}
@ -115,6 +116,13 @@ func (x *DBEnchant) GetRecoveryTime() int64 {
return 0
}
func (x *DBEnchant) GetGrade() map[int32]int32 {
if x != nil {
return x.Grade
}
return nil
}
// 排行榜
type DBEnchantRank struct {
state protoimpl.MessageState
@ -241,7 +249,7 @@ var file_enchant_enchant_db_proto_rawDesc = []byte{
0x0a, 0x18, 0x65, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x2f, 0x65, 0x6e, 0x63, 0x68, 0x61, 0x6e,
0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x62, 0x61, 0x74, 0x74,
0x6c, 0x65, 0x2f, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e,
0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x03, 0x0a, 0x09, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e,
0x74, 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, 0x28, 0x0a, 0x04, 0x62, 0x6f, 0x73, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
@ -255,31 +263,38 @@ var file_enchant_enchant_db_proto_rawDesc = []byte{
0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x62, 0x6f, 0x73,
0x73, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72,
0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x72, 0x65, 0x63,
0x6f, 0x76, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x6f, 0x73,
0x73, 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, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x42, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e,
0x6f, 0x76, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x67, 0x72, 0x61,
0x64, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x45, 0x6e, 0x63,
0x68, 0x61, 0x6e, 0x74, 0x2e, 0x47, 0x72, 0x61, 0x64, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x05, 0x67, 0x72, 0x61, 0x64, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x6f, 0x73, 0x73, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
0xf8, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x45, 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 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, 0x62, 0x6f, 0x73, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f, 0x73, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6c,
0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x6c,
0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65,
0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x07, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x55, 0x70, 0x52, 0x04, 0x6c, 0x69,
0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08,
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14,
0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73,
0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x0a, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
0x3b, 0x0a, 0x0d, 0x42, 0x6f, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 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,
0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a,
0x47, 0x72, 0x61, 0x64, 0x65, 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, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf8, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x45, 0x6e, 0x63,
0x68, 0x61, 0x6e, 0x74, 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, 0x62, 0x6f,
0x73, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x6f,
0x73, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18, 0x06, 0x20,
0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x1b, 0x0a, 0x04,
0x6c, 0x69, 0x6e, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x4c, 0x69, 0x6e,
0x65, 0x55, 0x70, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x73,
0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x73,
0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74,
0x69, 0x74, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c,
0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
@ -294,23 +309,25 @@ func file_enchant_enchant_db_proto_rawDescGZIP() []byte {
return file_enchant_enchant_db_proto_rawDescData
}
var file_enchant_enchant_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_enchant_enchant_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_enchant_enchant_db_proto_goTypes = []interface{}{
(*DBEnchant)(nil), // 0: DBEnchant
(*DBEnchantRank)(nil), // 1: DBEnchantRank
nil, // 2: DBEnchant.BossEntry
nil, // 3: DBEnchant.BossTimeEntry
(*LineUp)(nil), // 4: LineUp
nil, // 4: DBEnchant.GradeEntry
(*LineUp)(nil), // 5: LineUp
}
var file_enchant_enchant_db_proto_depIdxs = []int32{
2, // 0: DBEnchant.boss:type_name -> DBEnchant.BossEntry
3, // 1: DBEnchant.bossTime:type_name -> DBEnchant.BossTimeEntry
4, // 2: DBEnchantRank.line:type_name -> LineUp
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
4, // 2: DBEnchant.grade:type_name -> DBEnchant.GradeEntry
5, // 3: DBEnchantRank.line:type_name -> LineUp
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
}
func init() { file_enchant_enchant_db_proto_init() }
@ -351,7 +368,7 @@ func file_enchant_enchant_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_enchant_enchant_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},