From a279eaad4cb5735258c5de8e70b600c456168f31 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 8 Nov 2024 00:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9E=E7=BB=AD=E5=85=85?= =?UTF-8?q?=E5=80=BC=E4=B8=AD=E6=96=AD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldsrv/shopmgr.go | 15 +++++++++++++-- worldsrv/trascate_webapi.go | 12 ++++++++---- worldsrv/welfmgr.go | 10 +++++----- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/worldsrv/shopmgr.go b/worldsrv/shopmgr.go index e74bb0a..1164d74 100644 --- a/worldsrv/shopmgr.go +++ b/worldsrv/shopmgr.go @@ -1290,9 +1290,9 @@ func (this *ShopMgr) NewDbShop(p *Player, pageId int32, amount []int32, consume, // SendAPICreateOrder 创建订单 func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any, remark string) { //三方购买 + var amount [ShopParamMax]int32 + var dbShop *model.DbShop task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - var amount [ShopParamMax]int32 - var dbShop *model.DbShop if shopInfo, ok := data.(*model.ShopInfo); ok { costNum := rand.Int31n(shopInfo.CostArea[1]-shopInfo.CostArea[0]+1) + shopInfo.CostArea[0] var itemInfo []model.ItemInfo @@ -1437,6 +1437,17 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any, pack.Url = info.Url logger.Logger.Trace("SCPayInfo:", pack) p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack) + + // test + //fn := WebAPIHandlerMgrSingleton.GetWebAPIHandler("/api/pay/CallbackPayment") + //msg := &webapi_proto.ASCallbackPayment{ + // OrderId: dbShop.LogId.Hex(), + // Platform: "1", + // State: 1, + //} + //b, _ := proto.Marshal(msg) + //fn.Handler(nil, b) + // test } }), "API_CreateOrder").Start() } diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 6a10564..ea5202d 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -2224,8 +2224,10 @@ func init() { retFail := func(errorMsg string) { pack.Tag = webapiproto.TagCode_FAILED pack.Msg = errorMsg - tNode.TransRep.RetFiels = pack - tNode.Resume() + if tNode != nil { + tNode.TransRep.RetFiels = pack + tNode.Resume() + } } var info *model.DbShop @@ -2284,8 +2286,10 @@ func init() { } pack.Tag = webapiproto.TagCode_SUCCESS pack.Msg = "success" - tNode.TransRep.RetFiels = pack - tNode.Resume() + if tNode != nil { + tNode.TransRep.RetFiels = pack + tNode.Resume() + } })).StartByExecutor(fmt.Sprintf("Player%v", info.SnId)) })).StartByFixExecutor("CallbackPayment") return common.ResponseTag_TransactYield, pack diff --git a/worldsrv/welfmgr.go b/worldsrv/welfmgr.go index 231a27d..95960ad 100644 --- a/worldsrv/welfmgr.go +++ b/worldsrv/welfmgr.go @@ -1601,12 +1601,12 @@ func (this *WelfareMgr) BuyContinuousPay(p *Player, ConfigPayId int32) { p.WelfData.ContinuousPayDay = 0 } var wfs *webapi_proto.WelfareSpree - for i, v := range continuousPay.List { + for _, v := range continuousPay.List { - if v.Day == p.WelfData.ContinuousPayDay || p.WelfData.ContinuousPayDay == 0 { - if p.WelfData.ContinuousPayDay != 0 { // 为0领取第一个 p.WelfData.FirstPayDay不为0代表已经领取到该礼包 需要领取下一个 - i++ - } + if v.Day == p.WelfData.ContinuousPayDay+1 || p.WelfData.ContinuousPayDay == 0 { + //if p.WelfData.ContinuousPayDay != 0 { // 为0领取第一个 p.WelfData.FirstPayDay不为0代表已经领取到该礼包 需要领取下一个 + // i++ + //} wfs = v //data := continuousPay.List[i] // 越界条件已判断