From a7f82085d305ea8e65f31a92370b7bb46453aca1 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 22 Nov 2022 20:31:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=9E=8D=E5=90=88=20=E7=BE=8E=E9=A3=9F?= =?UTF-8?q?=E9=A6=86=20=E9=93=81=E5=8C=A0=E9=93=BA=E5=9F=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gourmet/api_getlist.go | 2 ++ modules/gourmet/model_gourmet.go | 6 +++++- modules/hero/api_fusion.go | 3 +++ modules/smithy/api_getlist.go | 7 ++++--- modules/smithy/model_smithy.go | 8 +++++++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/modules/gourmet/api_getlist.go b/modules/gourmet/api_getlist.go index 4d61f3d9c..2205c35b8 100644 --- a/modules/gourmet/api_getlist.go +++ b/modules/gourmet/api_getlist.go @@ -29,5 +29,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.GourmetGetListRe // 计算订单信息 this.module.modelGourmet.CalculationGourmet(session.GetUserId(), _gourmet) session.SendMsg(string(this.module.GetType()), GourmetGetListResp, &pb.GourmetGetListResp{Data: _gourmet}) + + this.module.ModuleRtask.SendToRtask(session, comm.Rtype136, _gourmet.TotalTime) return } diff --git a/modules/gourmet/model_gourmet.go b/modules/gourmet/model_gourmet.go index 0febbcdd7..95b2cf91d 100644 --- a/modules/gourmet/model_gourmet.go +++ b/modules/gourmet/model_gourmet.go @@ -97,6 +97,9 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) for _, order := range gourmet.Foods { _gourmetcfg := this.module.configure.GetGourmetConfigData(order.FoodType, gourmet.Skill[order.FoodType]) // 美食家配置表 if order.FoodCount > 0 { + if gourmet.CookingFood.ETime > configure.Now().Unix() { + break + } order.FoodCount-- if order.FoodCount == 0 { order.CookTime = 0 @@ -127,7 +130,8 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) gourmet.Ctime = gourmet.CookingFood.ETime mapData["ctime"] = gourmet.Ctime bRet = true - break + gourmet.TotalTime += szTime[order.FoodType] + mapData["totalTime"] = gourmet.TotalTime } } if !bRet { // 没有订单可以做 diff --git a/modules/hero/api_fusion.go b/modules/hero/api_fusion.go index 718ae94df..dea8498a0 100644 --- a/modules/hero/api_fusion.go +++ b/modules/hero/api_fusion.go @@ -3,6 +3,7 @@ package hero import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -80,5 +81,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c code = pb.ErrorCode_HeroCreate // 创建新英雄失败 } session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero}) + // 通过融合获得指定英雄 + this.module.ModuleRtask.SendToRtask(session, comm.Rtype139, utils.ToInt32(conf.Hero)) return } diff --git a/modules/smithy/api_getlist.go b/modules/smithy/api_getlist.go index c1f4e6a91..f95832ef1 100644 --- a/modules/smithy/api_getlist.go +++ b/modules/smithy/api_getlist.go @@ -20,14 +20,15 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.SmithyGetListReq if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } - _gourmet, err := this.module.modelSmithy.getSmithyList(session.GetUserId()) + _smithy, err := this.module.modelSmithy.getSmithyList(session.GetUserId()) if err != nil { code = pb.ErrorCode_DBError return } // 计算订单信息 - this.module.modelSmithy.CalculationSmithy(session.GetUserId(), _gourmet) - session.SendMsg(string(this.module.GetType()), SmithyGetListResp, &pb.SmithyGetListResp{Data: _gourmet}) + this.module.modelSmithy.CalculationSmithy(session.GetUserId(), _smithy) + session.SendMsg(string(this.module.GetType()), SmithyGetListResp, &pb.SmithyGetListResp{Data: _smithy}) + this.module.ModuleRtask.SendToRtask(session, comm.Rtype137, _smithy.TotalTime) return } diff --git a/modules/smithy/model_smithy.go b/modules/smithy/model_smithy.go index 6bce20640..f0e21bad6 100644 --- a/modules/smithy/model_smithy.go +++ b/modules/smithy/model_smithy.go @@ -87,7 +87,11 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { bRet := false for _, order := range smithy.Orders { _gourmetcfg := this.module.configure.GetSmithyConfigData(order.DeskType, smithy.Skill[order.DeskType]) // 美食家配置表 + if order.Count > 0 { + if smithy.Clang.ETime > configure.Now().Unix() { + break + } order.Count-- if order.Count == 0 { order.NeedTime = 0 @@ -118,7 +122,8 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { smithy.Ctime = smithy.Clang.ETime mapData["ctime"] = smithy.Ctime bRet = true - break + smithy.TotalTime += szTime[order.DeskType] + mapData["totalTime"] = smithy.TotalTime } } if !bRet { // 没有订单可以做 @@ -147,6 +152,7 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { mapData["clang"] = smithy.Clang // 正在做的 this.module.ModifySmithyData(uid, mapData) // 同步数据 + } func (this *modelSmithy) CalculationDeskSkillLv(uid string, Smithy *pb.DBSmithy) {