From 1bb3d823e2b47e55418babd3af561fa074cb81dd Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 1 Aug 2022 11:20:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=BE=97=E6=8C=87=E5=AE=9A=E6=98=9F?= =?UTF-8?q?=E7=BA=A7=E7=AD=89=E7=BA=A7=E8=8B=B1=E9=9B=84=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/hero/module.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index c29a228eb..fc088299f 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -49,7 +49,7 @@ type ( //清理玩家英雄数据 CleanData(uid string) // 获取指定星级等级的英雄 - GetSpecifiedHero(session IUserSession, heroConfId string, star, lv int32) (*pb.DBHero, error) + GetSpecifiedHero(session IUserSession, heroConfId string, star, lv, amount int32) (*pb.DBHero, error) } //玩家 diff --git a/modules/hero/module.go b/modules/hero/module.go index 943ac4892..5a4e6113d 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -123,8 +123,8 @@ func (this *Hero) CleanData(uid string) { } // 创建一些特殊的英雄 -func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv int32) (hero *pb.DBHero, err error) { - if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 { +func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv, amount int32) (hero *pb.DBHero, err error) { + if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 || amount == 0 { return nil, errors.New("parameter err") } hero, err = this.modelHero.createOneHero(session.GetUserId(), heroConfId) @@ -133,10 +133,12 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, } hero.Lv = lv hero.Star = star + hero.SameCount = amount _heroMap := map[string]interface{}{ "lv": hero.Lv, "star": hero.Star, "isOverlying": false, + "sameCount": amount, } // 保存数据 err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap) @@ -144,11 +146,8 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, log.Errorf("GetSpecified failed:%v", err) return } - list := make([]*pb.DBHero, 0) - - list = append(list, hero) // push change - session.SendMsg("hero", "change", &pb.HeroChangePush{List: list}) + session.SendMsg("hero", "change", &pb.HeroChangePush{List: []*pb.DBHero{hero}}) return }