上传装备协议代码优化

This commit is contained in:
liwei1dao 2022-06-24 12:02:42 +08:00
parent b7e83a6371
commit 191d416405
8 changed files with 148 additions and 126 deletions

View File

@ -24,8 +24,7 @@ func (this *MComp_Configure) Init(service core.IService, module core.IModule, co
//加载配置文件 //加载配置文件
func (this *MComp_Configure) LoadConfigure(name string, fn interface{}) (err error) { func (this *MComp_Configure) LoadConfigure(name string, fn interface{}) (err error) {
configure.RegisterConfigure(name, fn) return configure.RegisterConfigure(name, fn)
return
} }
//读取配置数据 //读取配置数据

View File

@ -10,31 +10,37 @@ import (
//参数校验 //参数校验
func (this *Api_Comp) Equip_Check(session comm.IUserSession, req *pb.Equipment_Equip_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *Api_Comp) Equip_Check(session comm.IUserSession, req *pb.Equipment_Equip_Req) (result map[string]interface{}, code comm.ErrorCode) {
var ( var (
err error err error
errorCode pb.ErrorCode errorCode pb.ErrorCode
conf *cfg.Game_equipmentData confs []*cfg.Game_equipmentData
equipment *pb.DB_Equipment equipments []*pb.DB_Equipment
hero *pb.DB_HeroData hero *pb.DB_HeroData
) )
if equipment, err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), req.EquipmentId); err != nil { confs = make([]*cfg.Game_equipmentData, len(req.EquipmentId))
log.Errorf("Equip_Check err:%v", err) equipments = make([]*pb.DB_Equipment, len(req.EquipmentId))
code.Code = pb.ErrorCode_EquipmentOnFoundEquipment for i, v := range req.EquipmentId {
return if v != "" {
if equipments[i], err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), v); err != nil {
log.Errorf("Equip_Check err:%v", err)
code.Code = pb.ErrorCode_EquipmentOnFoundEquipment
return
}
if confs[i], err = this.module.configure_comp.GetEquipmentConfigureById(equipments[i].CId); err != nil {
log.Errorf("Equip_Check err:%v", err)
code.Code = pb.ErrorCode_EquipmentOnFoundEquipment
return
}
}
} }
if hero, errorCode = this.module.hero.GetHero(req.HeroCardId); errorCode != pb.ErrorCode_Success { if hero, errorCode = this.module.hero.GetHero(req.HeroCardId); errorCode != pb.ErrorCode_Success {
code.Code = errorCode code.Code = errorCode
return return
} }
if conf, err = this.module.configure_comp.GetEquipmentConfigureById(equipment.CId); err != nil {
log.Errorf("Equip_Check err:%v", err)
code.Code = pb.ErrorCode_EquipmentOnFoundEquipment
return
}
result = map[string]interface{}{ result = map[string]interface{}{
"conf": conf, "confs": confs,
"equipment": equipment, "equipments": equipments,
"hero": hero, "hero": hero,
} }
return return
} }
@ -42,37 +48,63 @@ func (this *Api_Comp) Equip_Check(session comm.IUserSession, req *pb.Equipment_E
///英雄挂在装备 ///英雄挂在装备
func (this *Api_Comp) Equip(session comm.IUserSession, agrs map[string]interface{}, req *pb.Equipment_Equip_Req) (code pb.ErrorCode) { func (this *Api_Comp) Equip(session comm.IUserSession, agrs map[string]interface{}, req *pb.Equipment_Equip_Req) (code pb.ErrorCode) {
var ( var (
err error err error
conf *cfg.Game_equipmentData confs []*cfg.Game_equipmentData
equipment *pb.DB_Equipment equipment *pb.DB_Equipment
equipments []*pb.DB_Equipment equipments []*pb.DB_Equipment
hero *pb.DB_HeroData updatequipment []*pb.DB_Equipment
hero *pb.DB_HeroData
) )
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_Equip_Resp{}) session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_Equip_Resp{})
} }
}() }()
conf = agrs["conf"].(*cfg.Game_equipmentData) confs = agrs["conf"].([]*cfg.Game_equipmentData)
equipment = agrs["equipment"].(*pb.DB_Equipment) equipments = agrs["equipment"].([]*pb.DB_Equipment)
updatequipment = make([]*pb.DB_Equipment, 0)
hero = agrs["hero"].(*pb.DB_HeroData) hero = agrs["hero"].(*pb.DB_HeroData)
if int(conf.Station) < len(hero.EquipID) {
equipments = make([]*pb.DB_Equipment, len(hero.EquipID)) for i, v := range hero.EquipID {
for i, v := range hero.EquipID { if v != "" {
if v != "" { if equipments[i] != nil && v != equipments[i].Id {
if equipments[i], err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), v); err != nil { if equipment, err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), v); err != nil {
log.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err) log.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
} }
equipment.IsEquip = false
equipments[i].IsEquip = true
updatequipment = append(updatequipment, equipment, equipments[i])
} else if equipments[i] == nil {
if equipment, err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), v); err != nil {
log.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err)
code = pb.ErrorCode_SystemError
return
}
equipment.IsEquip = false
updatequipment = append(updatequipment, equipment)
}
} else {
if equipments[i] != nil {
equipments[i].IsEquip = true
updatequipment = append(updatequipment, equipments[i])
} }
} }
hero.EquipID[conf.Station] = equipment.Id }
equipments[conf.Station] = equipment for i, _ := range equipments {
code = this.module.hero.UpdateEquipment(hero, equipments) if i != int(confs[i].Station) {
} else { log.Errorf("Equip conf:%v Target:%d Incorrect range!", confs[i], i)
log.Errorf("Equip conf:%v Station Incorrect range!", conf) code = pb.ErrorCode_SystemError
code = pb.ErrorCode_SystemError return
}
}
if code = this.module.hero.UpdateEquipment(hero, equipments); code == pb.ErrorCode_Success {
if err = this.module.model_equipment_comp.Equipment_UpdateIsEquip(session.GetUserId(), updatequipment...); err != nil {
log.Errorf("Equip err%v", err)
code = pb.ErrorCode_SystemError
return
}
} }
return return
} }

View File

@ -98,3 +98,15 @@ func (this *Model_Equipment_Comp) Equipment_AddEquipmentsToPack(uId string, cIds
} }
return return
} }
func (this *Model_Equipment_Comp) Equipment_UpdateIsEquip(uid string, equipments ...*pb.DB_Equipment) (err error) {
for _, v := range equipments {
if err = this.ChangeList(uid, v.Id, map[string]interface{}{
"isEquip": v.IsEquip,
}); err != nil {
log.Errorf("Equipment_UpdateIsEquip err:%v", err)
return
}
}
return
}

View File

@ -113,16 +113,16 @@ type DB_Equipment struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields 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
CId int32 `protobuf:"zigzag32,2,opt,name=cId,proto3" json:"cId"` //配置Id CId int32 `protobuf:"zigzag32,2,opt,name=cId,proto3" json:"cId" bson:"cId"` // 配置Id
UId string `protobuf:"bytes,3,opt,name=uId,proto3" json:"uId"` //所属玩家Id UId string `protobuf:"bytes,3,opt,name=uId,proto3" json:"uId" bson:"uid"` // 所属玩家Id
IsEquip bool `protobuf:"varint,4,opt,name=IsEquip,proto3" json:"IsEquip"` //是否装备 IsEquip bool `protobuf:"varint,4,opt,name=isEquip,proto3" json:"isEquip" bson:"isEquip"` // 是否装备
Lv int32 `protobuf:"zigzag32,5,opt,name=lv,proto3" json:"lv"` //装备强化等级 Lv int32 `protobuf:"zigzag32,5,opt,name=lv,proto3" json:"lv" bson:"lv"` //装备强化等级
KeepFailNum int32 `protobuf:"zigzag32,6,opt,name=keepFailNum,proto3" json:"keepFailNum"` //连续强化失败次数 KeepFailNum int32 `protobuf:"zigzag32,6,opt,name=keepFailNum,proto3" json:"keepFailNum" bson:"keepFailNum"` // 连续强化失败次数
MainEntry map[uint32]int32 `protobuf:"bytes,7,rep,name=MainEntry,proto3" json:"MainEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //装备主词条 MainEntry map[uint32]int32 `protobuf:"bytes,7,rep,name=mainEntry,proto3" json:"mainEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"mainEntry"` // 装备主词条
AdverbEntry map[uint32]int32 `protobuf:"bytes,8,rep,name=AdverbEntry,proto3" json:"AdverbEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //装备副词条 AdverbEntry map[uint32]int32 `protobuf:"bytes,8,rep,name=adverbEntry,proto3" json:"adverbEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"adverbEntry"` //装备副词条
OverlayNum uint32 `protobuf:"varint,9,opt,name=OverlayNum,proto3" json:"OverlayNum"` //叠加数量 OverlayNum uint32 `protobuf:"varint,9,opt,name=overlayNum,proto3" json:"overlayNum" bson:"overlayNum"` //叠加数量
IsInitialState bool `protobuf:"varint,10,opt,name=IsInitialState,proto3" json:"IsInitialState"` //是否初始状态 IsInitialState bool `protobuf:"varint,10,opt,name=isInitialState,proto3" json:"isInitialState" bson:"isInitialState"` //是否初始状态
} }
func (x *DB_Equipment) Reset() { func (x *DB_Equipment) Reset() {
@ -236,23 +236,23 @@ var file_equipment_equipment_db_proto_rawDesc = []byte{
0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12,
0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x63, 0x49, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x63, 0x49,
0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x75, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x18, 0x04, 0x75, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x18, 0x04,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x49, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x12, 0x0e, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x12, 0x0e, 0x0a,
0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a,
0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01,
0x28, 0x11, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x12, 0x28, 0x11, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x12,
0x3a, 0x0a, 0x09, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x03, 0x3a, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e,
0x74, 0x2e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x74, 0x2e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x09, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x40, 0x0a, 0x0b, 0x41, 0x52, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x40, 0x0a, 0x0b, 0x61,
0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x1e, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x32, 0x1e, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x0b, 0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x52, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a,
0x0a, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x0a, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0d, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a,
0x0e, 0x49, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x49, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c,
0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
@ -291,8 +291,8 @@ var file_equipment_equipment_db_proto_goTypes = []interface{}{
nil, // 4: DB_Equipment.AdverbEntryEntry nil, // 4: DB_Equipment.AdverbEntryEntry
} }
var file_equipment_equipment_db_proto_depIdxs = []int32{ var file_equipment_equipment_db_proto_depIdxs = []int32{
3, // 0: DB_Equipment.MainEntry:type_name -> DB_Equipment.MainEntryEntry 3, // 0: DB_Equipment.mainEntry:type_name -> DB_Equipment.MainEntryEntry
4, // 1: DB_Equipment.AdverbEntry:type_name -> DB_Equipment.AdverbEntryEntry 4, // 1: DB_Equipment.adverbEntry:type_name -> DB_Equipment.AdverbEntryEntry
2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type 2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension type_name

View File

@ -113,8 +113,8 @@ type Equipment_Equip_Req struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
EquipmentId string `protobuf:"bytes,1,opt,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id HeroCardId string `protobuf:"bytes,1,opt,name=HeroCardId,proto3" json:"HeroCardId"` //英雄卡Id
HeroCardId string `protobuf:"bytes,2,opt,name=HeroCardId,proto3" json:"HeroCardId"` //英雄卡Id EquipmentId []string `protobuf:"bytes,2,rep,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id 固定长度的数组 0-5 对应的装备栏
} }
func (x *Equipment_Equip_Req) Reset() { func (x *Equipment_Equip_Req) Reset() {
@ -149,13 +149,6 @@ func (*Equipment_Equip_Req) Descriptor() ([]byte, []int) {
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{2} return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{2}
} }
func (x *Equipment_Equip_Req) GetEquipmentId() string {
if x != nil {
return x.EquipmentId
}
return ""
}
func (x *Equipment_Equip_Req) GetHeroCardId() string { func (x *Equipment_Equip_Req) GetHeroCardId() string {
if x != nil { if x != nil {
return x.HeroCardId return x.HeroCardId
@ -163,14 +156,18 @@ func (x *Equipment_Equip_Req) GetHeroCardId() string {
return "" return ""
} }
func (x *Equipment_Equip_Req) GetEquipmentId() []string {
if x != nil {
return x.EquipmentId
}
return nil
}
//装备挂在到英雄上 回应 //装备挂在到英雄上 回应
type Equipment_Equip_Resp struct { type Equipment_Equip_Resp struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
EquipmentId string `protobuf:"bytes,1,opt,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id
HeroCardId string `protobuf:"bytes,2,opt,name=HeroCardId,proto3" json:"HeroCardId"` //英雄卡Id
} }
func (x *Equipment_Equip_Resp) Reset() { func (x *Equipment_Equip_Resp) Reset() {
@ -205,20 +202,6 @@ func (*Equipment_Equip_Resp) Descriptor() ([]byte, []int) {
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{3} return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{3}
} }
func (x *Equipment_Equip_Resp) GetEquipmentId() string {
if x != nil {
return x.EquipmentId
}
return ""
}
func (x *Equipment_Equip_Resp) GetHeroCardId() string {
if x != nil {
return x.HeroCardId
}
return ""
}
//装备升级 //装备升级
type Equipment_Upgrade_Req struct { type Equipment_Upgrade_Req struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -272,8 +255,6 @@ type Equipment_Upgrade_Resp struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
EquipmentId string `protobuf:"bytes,1,opt,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id
} }
func (x *Equipment_Upgrade_Resp) Reset() { func (x *Equipment_Upgrade_Resp) Reset() {
@ -308,13 +289,6 @@ func (*Equipment_Upgrade_Resp) Descriptor() ([]byte, []int) {
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{5} return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{5}
} }
func (x *Equipment_Upgrade_Resp) GetEquipmentId() string {
if x != nil {
return x.EquipmentId
}
return ""
}
var File_equipment_equipment_msg_proto protoreflect.FileDescriptor var File_equipment_equipment_msg_proto protoreflect.FileDescriptor
var file_equipment_equipment_msg_proto_rawDesc = []byte{ var file_equipment_equipment_msg_proto_rawDesc = []byte{
@ -329,25 +303,19 @@ var file_equipment_equipment_msg_proto_rawDesc = []byte{
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
0x65, 0x6e, 0x74, 0x52, 0x0a, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22,
0x57, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x45, 0x71, 0x75, 0x57, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x45, 0x71, 0x75,
0x69, 0x70, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x69, 0x70, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61,
0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x72, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x48, 0x65, 0x72, 0x6f,
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
0x43, 0x61, 0x72, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x48, 0x65, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75,
0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x16, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x5f, 0x52, 0x65, 0x73, 0x70,
0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x22, 0x39, 0x0a, 0x15, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x55, 0x70,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75,
0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x49, 0x64, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x45,
0x49, 0x64, 0x22, 0x39, 0x0a, 0x15, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65,
0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x3a, 0x0a,
0x16, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x55, 0x70, 0x67, 0x72, 0x61,
0x64, 0x65, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70,
0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71,
0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -12,14 +12,14 @@ enum EquipmentAdverbEntry {
} }
message DB_Equipment { message DB_Equipment {
string Id = 1; //id string Id = 1; //@go_tags(`bson:"_id"`) id
sint32 cId = 2; //Id sint32 cId = 2; //@go_tags(`bson:"cId"`) Id
string uId = 3; //Id string uId = 3; //@go_tags(`bson:"uid"`) Id
bool IsEquip = 4; // bool isEquip = 4; //@go_tags(`bson:"isEquip"`)
sint32 lv = 5; // sint32 lv = 5; //@go_tags(`bson:"lv"`)
sint32 keepFailNum = 6; // sint32 keepFailNum = 6; //@go_tags(`bson:"keepFailNum"`)
map<uint32,int32> MainEntry = 7; // map<uint32,int32> mainEntry = 7; //@go_tags(`bson:"mainEntry"`)
map<uint32,int32> AdverbEntry = 8; // map<uint32,int32> adverbEntry = 8; //@go_tags(`bson:"adverbEntry"`)
uint32 OverlayNum = 9; // uint32 overlayNum = 9; //@go_tags(`bson:"overlayNum"`)
bool IsInitialState = 10; // bool isInitialState = 10; //@go_tags(`bson:"isInitialState"`)
} }

View File

@ -13,14 +13,13 @@ message Equipment_GetList_Resp {
// //
message Equipment_Equip_Req{ message Equipment_Equip_Req{
string EquipmentId = 1; //Id string HeroCardId = 1; //Id
string HeroCardId = 2; //Id repeated string EquipmentId = 2; //Id 0-5
} }
// //
message Equipment_Equip_Resp{ message Equipment_Equip_Resp{
string EquipmentId = 1; //Id
string HeroCardId = 2; //Id
} }
// //
@ -30,5 +29,5 @@ message Equipment_Upgrade_Req{
// //
message Equipment_Upgrade_Resp{ message Equipment_Upgrade_Resp{
string EquipmentId = 1; //Id
} }

View File

@ -10,6 +10,18 @@ type Options struct {
CheckInterval int //配置文件更新检查间隔时间 单位秒 CheckInterval int //配置文件更新检查间隔时间 单位秒
} }
func Set_ConfigurePath(v string) Option {
return func(o *Options) {
o.ConfigurePath = v
}
}
func Set_CheckInterval(v int) Option {
return func(o *Options) {
o.CheckInterval = v
}
}
func newOptions(config map[string]interface{}, opts ...Option) (Options, error) { func newOptions(config map[string]interface{}, opts ...Option) (Options, error) {
options := Options{ options := Options{
CheckInterval: 60, CheckInterval: 60,