上传英雄装备更新接口
This commit is contained in:
parent
e90a8fbb3c
commit
b7e83a6371
@ -4,6 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
@ -11,6 +12,7 @@ func (this *Api_Comp) Equip_Check(session comm.IUserSession, req *pb.Equipment_E
|
|||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
errorCode pb.ErrorCode
|
errorCode pb.ErrorCode
|
||||||
|
conf *cfg.Game_equipmentData
|
||||||
equipment *pb.DB_Equipment
|
equipment *pb.DB_Equipment
|
||||||
hero *pb.DB_HeroData
|
hero *pb.DB_HeroData
|
||||||
)
|
)
|
||||||
@ -24,7 +26,13 @@ func (this *Api_Comp) Equip_Check(session comm.IUserSession, req *pb.Equipment_E
|
|||||||
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,
|
||||||
"equipment": equipment,
|
"equipment": equipment,
|
||||||
"hero": hero,
|
"hero": hero,
|
||||||
}
|
}
|
||||||
@ -34,7 +42,10 @@ 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
|
||||||
|
conf *cfg.Game_equipmentData
|
||||||
equipment *pb.DB_Equipment
|
equipment *pb.DB_Equipment
|
||||||
|
equipments []*pb.DB_Equipment
|
||||||
hero *pb.DB_HeroData
|
hero *pb.DB_HeroData
|
||||||
)
|
)
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -42,8 +53,26 @@ func (this *Api_Comp) Equip(session comm.IUserSession, agrs map[string]interface
|
|||||||
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)
|
||||||
equipment = agrs["equipment"].(*pb.DB_Equipment)
|
equipment = agrs["equipment"].(*pb.DB_Equipment)
|
||||||
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 {
|
||||||
|
if v != "" {
|
||||||
|
if equipments[i], 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hero.EquipID[conf.Station] = equipment.Id
|
||||||
|
equipments[conf.Station] = equipment
|
||||||
|
code = this.module.hero.UpdateEquipment(hero, equipments)
|
||||||
|
} else {
|
||||||
|
log.Errorf("Equip conf:%v Station Incorrect range!", conf)
|
||||||
|
code = pb.ErrorCode_SystemError
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -40,3 +40,20 @@ func (this *Configure_Comp) GetEquipmentConfigure() (configure *cfg.Game_equipme
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取装备配置数据
|
||||||
|
func (this *Configure_Comp) GetEquipmentConfigureById(equipmentId int32) (configure *cfg.Game_equipmentData, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(game_equipment); err != nil {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if configure, ok = v.(*cfg.Game_equipment).GetDataMap()[equipmentId]; !ok {
|
||||||
|
err = fmt.Errorf("EquipmentConfigure not found:%d ", equipmentId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -63,6 +63,8 @@ const (
|
|||||||
ErrorCode_PackGirdAmountUpper ErrorCode = 1203 //背包格子容量已达上限
|
ErrorCode_PackGirdAmountUpper ErrorCode = 1203 //背包格子容量已达上限
|
||||||
// hero
|
// hero
|
||||||
ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在
|
ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在
|
||||||
|
//equipment
|
||||||
|
ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for ErrorCode.
|
// Enum value maps for ErrorCode.
|
||||||
@ -104,6 +106,7 @@ var (
|
|||||||
1202: "PackGridNumUpper",
|
1202: "PackGridNumUpper",
|
||||||
1203: "PackGirdAmountUpper",
|
1203: "PackGirdAmountUpper",
|
||||||
1300: "HeroNoExist",
|
1300: "HeroNoExist",
|
||||||
|
1400: "EquipmentOnFoundEquipment",
|
||||||
}
|
}
|
||||||
ErrorCode_value = map[string]int32{
|
ErrorCode_value = map[string]int32{
|
||||||
"Success": 0,
|
"Success": 0,
|
||||||
@ -142,6 +145,7 @@ var (
|
|||||||
"PackGridNumUpper": 1202,
|
"PackGridNumUpper": 1202,
|
||||||
"PackGirdAmountUpper": 1203,
|
"PackGirdAmountUpper": 1203,
|
||||||
"HeroNoExist": 1300,
|
"HeroNoExist": 1300,
|
||||||
|
"EquipmentOnFoundEquipment": 1400,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -176,7 +180,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_errorcode_proto_rawDesc = []byte{
|
var file_errorcode_proto_rawDesc = []byte{
|
||||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x2a, 0xed, 0x05, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
0x6f, 0x2a, 0x8d, 0x06, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
@ -223,6 +227,8 @@ var file_errorcode_proto_rawDesc = []byte{
|
|||||||
0x65, 0x72, 0x10, 0xb2, 0x09, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x72,
|
0x65, 0x72, 0x10, 0xb2, 0x09, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x72,
|
||||||
0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x70, 0x65, 0x72, 0x10, 0xb3, 0x09, 0x12,
|
0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x70, 0x65, 0x72, 0x10, 0xb3, 0x09, 0x12,
|
||||||
0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x94,
|
0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x94,
|
||||||
|
0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e,
|
||||||
|
0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8,
|
||||||
0x0a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x0a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x33,
|
0x33,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user