From ef8cbfaedd598cc56143575217202c7b90b9ba79 Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Wed, 25 Sep 2024 17:38:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=91=E6=8D=A2=E8=AE=B0=E5=BD=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldsrv/action_bag.go | 43 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/worldsrv/action_bag.go b/worldsrv/action_bag.go index db955b0..66a00a0 100644 --- a/worldsrv/action_bag.go +++ b/worldsrv/action_bag.go @@ -3,6 +3,9 @@ package main import ( "fmt" "math/rand" + "mongo.games.com/game/proto" + webapi_proto "mongo.games.com/game/protocol/webapi" + "mongo.games.com/game/webapi" "strconv" "time" @@ -665,12 +668,42 @@ func CSDollChangeLog(s *netlib.Session, packetid int, data interface{}, sid int6 pack.Info = append(pack.Info, info) } } - value := ShopMgrSington.GetDollExchangeRecord(p) - if value != nil && value.Info != nil { - pack.Info = append(pack.Info, value.Info...) - } - p.SendToClient(int(bag.SPacketID_PACKET_SC_DollChangeLog), pack) + task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { + msg := &webapi_proto.ASGetDollExchangeOrder{ + Snid: p.SnId, + Platform: p.Platform, + } + buff, err := webapi.API_DollExchangeRecord(common.GetAppId(), msg) + as := &webapi_proto.SAGetDollExchangeOrder{} + if err != nil { + logger.Logger.Error("API_DollExchangeRecord error:", err) + return nil + } else if err := proto.Unmarshal(buff, as); err != nil { // 有订单 + logger.Logger.Errorf("DollExchangeRecord: %v", err) + return nil + + } + return as + }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { + if data != nil { + if as := data.(*webapi_proto.SAGetDollExchangeOrder); as != nil { + for _, v := range as.OrderList { + cdata := ShopMgrSington.GetExchangeData(p.Platform, v.GoodsId) + record := &bag.DillChangeLogInfo{ + CreateTs: strconv.FormatInt(v.CreateTime, 10), + State: v.Status, + Remark: v.Remark, + ItemId: cdata.ItemId, + ItemNum: v.ExchangeNum, + TypeId: 2, + } + pack.Info = append(pack.Info, record) + } + } + } + p.SendToClient(int(bag.SPacketID_PACKET_SC_DollChangeLog), pack) + }), "DollExchangeRecord").Start() }), "CSDollChangeLog").Start() return nil }