上传英雄装备更新接口
This commit is contained in:
parent
e90a8fbb3c
commit
b7e83a6371
@ -4,6 +4,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"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 (
|
||||
err error
|
||||
errorCode pb.ErrorCode
|
||||
conf *cfg.Game_equipmentData
|
||||
equipment *pb.DB_Equipment
|
||||
hero *pb.DB_HeroData
|
||||
)
|
||||
@ -24,7 +26,13 @@ func (this *Api_Comp) Equip_Check(session comm.IUserSession, req *pb.Equipment_E
|
||||
code.Code = errorCode
|
||||
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{}{
|
||||
"conf": conf,
|
||||
"equipment": equipment,
|
||||
"hero": hero,
|
||||
}
|
||||
@ -34,16 +42,37 @@ 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) {
|
||||
var (
|
||||
equipment *pb.DB_Equipment
|
||||
hero *pb.DB_HeroData
|
||||
err error
|
||||
conf *cfg.Game_equipmentData
|
||||
equipment *pb.DB_Equipment
|
||||
equipments []*pb.DB_Equipment
|
||||
hero *pb.DB_HeroData
|
||||
)
|
||||
defer func() {
|
||||
if code == pb.ErrorCode_Success {
|
||||
session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_Equip_Resp{})
|
||||
}
|
||||
}()
|
||||
conf = agrs["conf"].(*cfg.Game_equipmentData)
|
||||
equipment = agrs["equipment"].(*pb.DB_Equipment)
|
||||
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
|
||||
}
|
||||
|
@ -40,3 +40,20 @@ func (this *Configure_Comp) GetEquipmentConfigure() (configure *cfg.Game_equipme
|
||||
}
|
||||
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 //背包格子容量已达上限
|
||||
// hero
|
||||
ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在
|
||||
//equipment
|
||||
ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器
|
||||
)
|
||||
|
||||
// Enum value maps for ErrorCode.
|
||||
@ -104,44 +106,46 @@ var (
|
||||
1202: "PackGridNumUpper",
|
||||
1203: "PackGirdAmountUpper",
|
||||
1300: "HeroNoExist",
|
||||
1400: "EquipmentOnFoundEquipment",
|
||||
}
|
||||
ErrorCode_value = map[string]int32{
|
||||
"Success": 0,
|
||||
"NoFindService": 10,
|
||||
"NoFindServiceHandleFunc": 11,
|
||||
"RpcFuncExecutionError": 12,
|
||||
"CacheReadError": 13,
|
||||
"SqlExecutionError": 14,
|
||||
"ReqParameterError": 15,
|
||||
"SignError": 16,
|
||||
"InsufficientPermissions": 17,
|
||||
"NoLogin": 18,
|
||||
"UserSessionNobeing": 19,
|
||||
"StateInvalid": 20,
|
||||
"DBError": 21,
|
||||
"SystemError": 22,
|
||||
"Exception": 100,
|
||||
"Unknown": 101,
|
||||
"SecKeyInvalid": 1000,
|
||||
"SecKey": 1001,
|
||||
"BindUser": 1002,
|
||||
"FriendNotSelf": 1100,
|
||||
"FriendSelfMax": 1101,
|
||||
"FriendTargetMax": 1102,
|
||||
"FriendSelfNoData": 1103,
|
||||
"FriendTargetNoData": 1104,
|
||||
"FriendYet": 1105,
|
||||
"FriendApplyYet": 1106,
|
||||
"FriendSelfBlackYet": 1107,
|
||||
"FriendTargetBlackYet": 1108,
|
||||
"FriendApplyError": 1109,
|
||||
"FriendBlackMax": 1110,
|
||||
"FriendSearchNameEmpty": 1111,
|
||||
"PackNoEnough": 1200,
|
||||
"PackNoFoundGird": 1201,
|
||||
"PackGridNumUpper": 1202,
|
||||
"PackGirdAmountUpper": 1203,
|
||||
"HeroNoExist": 1300,
|
||||
"Success": 0,
|
||||
"NoFindService": 10,
|
||||
"NoFindServiceHandleFunc": 11,
|
||||
"RpcFuncExecutionError": 12,
|
||||
"CacheReadError": 13,
|
||||
"SqlExecutionError": 14,
|
||||
"ReqParameterError": 15,
|
||||
"SignError": 16,
|
||||
"InsufficientPermissions": 17,
|
||||
"NoLogin": 18,
|
||||
"UserSessionNobeing": 19,
|
||||
"StateInvalid": 20,
|
||||
"DBError": 21,
|
||||
"SystemError": 22,
|
||||
"Exception": 100,
|
||||
"Unknown": 101,
|
||||
"SecKeyInvalid": 1000,
|
||||
"SecKey": 1001,
|
||||
"BindUser": 1002,
|
||||
"FriendNotSelf": 1100,
|
||||
"FriendSelfMax": 1101,
|
||||
"FriendTargetMax": 1102,
|
||||
"FriendSelfNoData": 1103,
|
||||
"FriendTargetNoData": 1104,
|
||||
"FriendYet": 1105,
|
||||
"FriendApplyYet": 1106,
|
||||
"FriendSelfBlackYet": 1107,
|
||||
"FriendTargetBlackYet": 1108,
|
||||
"FriendApplyError": 1109,
|
||||
"FriendBlackMax": 1110,
|
||||
"FriendSearchNameEmpty": 1111,
|
||||
"PackNoEnough": 1200,
|
||||
"PackNoFoundGird": 1201,
|
||||
"PackGridNumUpper": 1202,
|
||||
"PackGirdAmountUpper": 1203,
|
||||
"HeroNoExist": 1300,
|
||||
"EquipmentOnFoundEquipment": 1400,
|
||||
}
|
||||
)
|
||||
|
||||
@ -176,7 +180,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_errorcode_proto_rawDesc = []byte{
|
||||
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,
|
||||
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,
|
||||
@ -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,
|
||||
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,
|
||||
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,
|
||||
0x33,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user