英雄传功接口
This commit is contained in:
parent
d1cfe5f910
commit
e4a5caccd3
@ -132,6 +132,8 @@ type (
|
|||||||
|
|
||||||
// 查询指定共鸣次数的英雄数量
|
// 查询指定共鸣次数的英雄数量
|
||||||
QueryHeroTelnetByCount(uid string, count int) (hids []string)
|
QueryHeroTelnetByCount(uid string, count int) (hids []string)
|
||||||
|
// key 英雄唯一id value 是否传功
|
||||||
|
PassonHero(session IUserSession, heroObjID map[string]bool) (errdata *pb.ErrorData)
|
||||||
}
|
}
|
||||||
|
|
||||||
//玩家
|
//玩家
|
||||||
|
@ -946,3 +946,61 @@ func (this *Hero) QueryHeroTelnetByCount(uid string, count int) (hids []string)
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func (this *Hero) PassonHero(session comm.IUserSession, heroObjID map[string]bool) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
_hero *pb.DBHero
|
||||||
|
_changeHero []*pb.DBHero // 变化的英雄
|
||||||
|
model *db.DBModel // 跨服对象
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
for oid, b := range heroObjID {
|
||||||
|
if this.IsCross() {
|
||||||
|
_hero = &pb.DBHero{}
|
||||||
|
if model, err = this.GetDBModelByUid(session.GetUserId(), this.modelHero.TableName); err == nil {
|
||||||
|
if err := model.GetListObj(session.GetUserId(), oid, _hero); err != nil {
|
||||||
|
this.Errorf("err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_hero, errdata = this.GetHeroByObjID(session.GetUserId(), oid)
|
||||||
|
if errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_hero.Ispasson = b
|
||||||
|
|
||||||
|
_heroMap := map[string]interface{}{
|
||||||
|
"ispasson": _hero.Ispasson,
|
||||||
|
}
|
||||||
|
|
||||||
|
if this.IsCross() {
|
||||||
|
if model != nil {
|
||||||
|
if err := model.ChangeList(session.GetUserId(), oid, _heroMap); err != nil {
|
||||||
|
this.Errorf("err:%v", err)
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := this.modelHero.ChangeList(session.GetUserId(), oid, _heroMap); err != nil { // 修改英雄信息
|
||||||
|
this.Errorf("err:%v", err)
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_changeHero = append(_changeHero, _hero)
|
||||||
|
session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user