From 0d7e23af9c2540a0ec759c5bb93c558075651e8c Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Mon, 26 Jun 2023 14:51:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=95=86=E5=BA=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/shop/api_getlist.go | 4 ++-- pb/shop_msg.pb.go | 35 +++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/modules/shop/api_getlist.go b/modules/shop/api_getlist.go index ed88520d7..1f29807d0 100644 --- a/modules/shop/api_getlist.go +++ b/modules/shop/api_getlist.go @@ -167,7 +167,6 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) items = append(items, randomGoods(_items)) } sdata.Buy = make(map[int32]int32) - goods = transGoods(items, sdata) sdata.LastRefreshTime = configure.Now().Unix() sdata.ManualRefreshNum++ sdata.Items = make([]int32, len(items)) @@ -180,6 +179,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) } } } + goods = transGoods(items, sdata) // this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype105, 1)) this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata}) @@ -247,6 +247,6 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) } return } - session.SendMsg(string(this.module.GetType()), "getlist", &pb.ShopGetListResp{SType: req.SType, IsManualRefresh: req.IsManualRefresh, Goods: goods, SurplusRefreshNum: leftrefnum}) + session.SendMsg(string(this.module.GetType()), "getlist", &pb.ShopGetListResp{SType: req.SType, IsManualRefresh: req.IsManualRefresh, Goods: goods, SurplusRefreshNum: leftrefnum, Lastrefreshtime: sdata.LastRefreshTime}) return } diff --git a/pb/shop_msg.pb.go b/pb/shop_msg.pb.go index 29bfa5231..570a3c1fe 100644 --- a/pb/shop_msg.pb.go +++ b/pb/shop_msg.pb.go @@ -174,6 +174,7 @@ type ShopGetListResp struct { IsManualRefresh bool `protobuf:"varint,2,opt,name=IsManualRefresh,proto3" json:"IsManualRefresh"` //是否手动刷新 Goods []*ShopItem `protobuf:"bytes,4,rep,name=Goods,proto3" json:"Goods"` //商品列表 SurplusRefreshNum int32 `protobuf:"varint,5,opt,name=SurplusRefreshNum,proto3" json:"SurplusRefreshNum"` //剩余手动刷新次数 + Lastrefreshtime int64 `protobuf:"varint,6,opt,name=lastrefreshtime,proto3" json:"lastrefreshtime"` //上一次刷新时间 } func (x *ShopGetListResp) Reset() { @@ -236,6 +237,13 @@ func (x *ShopGetListResp) GetSurplusRefreshNum() int32 { return 0 } +func (x *ShopGetListResp) GetLastrefreshtime() int64 { + if x != nil { + return x.Lastrefreshtime + } + return 0 +} + //购买商品 请求 type ShopBuyReq struct { state protoimpl.MessageState @@ -374,7 +382,7 @@ var file_shop_shop_msg_proto_rawDesc = []byte{ 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x49, 0x73, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x49, - 0x73, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x22, 0xab, + 0x73, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x22, 0xd5, 0x01, 0x0a, 0x0f, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x05, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x73, 0x54, @@ -385,17 +393,20 @@ var file_shop_shop_msg_proto_rawDesc = []byte{ 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x53, 0x75, 0x72, 0x70, 0x6c, - 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, 0x6d, 0x22, 0x65, 0x0a, 0x0a, - 0x53, 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x25, 0x0a, 0x08, 0x53, 0x68, - 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x53, - 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x42, - 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x42, 0x75, 0x79, - 0x4e, 0x75, 0x6d, 0x22, 0x25, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, 0x6d, 0x12, 0x28, 0x0a, 0x0f, + 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x66, 0x72, 0x65, + 0x73, 0x68, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x65, 0x0a, 0x0a, 0x53, 0x68, 0x6f, 0x70, 0x42, 0x75, + 0x79, 0x52, 0x65, 0x71, 0x12, 0x25, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x47, + 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x47, 0x6f, + 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x22, 0x25, 0x0a, + 0x0b, 0x53, 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, + 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x49, 0x73, + 0x53, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var (