From 1e4244a8b458f575d2b27def2f37cb29d57137ea Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 27 Jul 2022 10:57:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=95=86=E5=BA=97bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/items/configure.go | 4 ++-- modules/shop/api_buy.go | 9 ++++++--- pb/shop_db.pb.go | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/modules/items/configure.go b/modules/items/configure.go index 6aec4388f..728596e8f 100644 --- a/modules/items/configure.go +++ b/modules/items/configure.go @@ -63,7 +63,7 @@ func (this *ConfigureComp) GetItemConfigure(id string) (item *cfg.Game_itemData, } //获取指定类型的物品列表 -func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, usetype int32) (result []*pb.DB_UserItemData) { +func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, bagtype int32) (result []*pb.DB_UserItemData) { result = make([]*pb.DB_UserItemData, 0, len(itmes)) var ( v interface{} @@ -79,7 +79,7 @@ func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, usetyp table = v.(*cfg.Game_item) for _, v := range itmes { if item, ok = table.GetDataMap()[v.ItemId]; ok { - if item.Usetype == usetype { + if item.Bagtype == bagtype { result = append(result, v) } } else { diff --git a/modules/shop/api_buy.go b/modules/shop/api_buy.go index 1907922bb..cb8c40756 100644 --- a/modules/shop/api_buy.go +++ b/modules/shop/api_buy.go @@ -1,7 +1,6 @@ package shop import ( - "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -29,6 +28,10 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb shopitem *pb.DBShopItem need []*cfg.Game_atn ) + if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success { + return + } + if conf, err = this.module.configure.GetShopItemsConfigure(req.GoodsId); err != nil { code = pb.ErrorCode_SystemError return @@ -68,8 +71,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb this.module.modelShopItems.AddList(session.GetUserId(), shopitem.Id, shopitem) } else { this.module.modelShopItems.ChangeList(session.GetUserId(), shopitem.Id, map[string]interface{}{ - fmt.Sprintf("buynum.%d", req.ShopType): shopitem.BuyNum, - fmt.Sprintf("lastbuytime.%d", req.ShopType): shopitem.LastBuyTime, + "buyNum": shopitem.BuyNum, + "lastBuyTime": shopitem.LastBuyTime, }) } session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true}) diff --git a/pb/shop_db.pb.go b/pb/shop_db.pb.go index 5fe8a5354..c3d928840 100644 --- a/pb/shop_db.pb.go +++ b/pb/shop_db.pb.go @@ -146,13 +146,13 @@ type DBShop struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //装备id - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //装备id - GoldShop *UserShopData `protobuf:"bytes,3,opt,name=goldShop,proto3" json:"goldShop"` //@go_tags(`bson:"goldShop"`)金币商店数据 - DiamondShop *UserShopData `protobuf:"bytes,4,opt,name=diamondShop,proto3" json:"diamondShop"` //@go_tags(`bson:"diamondShop"`)金币商店数据 - PvpShop *UserShopData `protobuf:"bytes,5,opt,name=pvpShop,proto3" json:"pvpShop"` //@go_tags(`bson:"pvpShop"`)金币商店数据 - PveShop *UserShopData `protobuf:"bytes,6,opt,name=pveShop,proto3" json:"pveShop"` //@go_tags(`bson:"pveShop"`)金币商店数据 - AllianceShop *UserShopData `protobuf:"bytes,7,opt,name=allianceShop,proto3" json:"allianceShop"` //@go_tags(`bson:"allianceShop"`)金币商店数据 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //装备id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //装备id + GoldShop *UserShopData `protobuf:"bytes,3,opt,name=goldShop,proto3" json:"goldShop" bson:"goldShop"` //金币商店数据 + DiamondShop *UserShopData `protobuf:"bytes,4,opt,name=diamondShop,proto3" json:"diamondShop" bson:"diamondShop"` //金币商店数据 + PvpShop *UserShopData `protobuf:"bytes,5,opt,name=pvpShop,proto3" json:"pvpShop" bson:"pvpShop"` //金币商店数据 + PveShop *UserShopData `protobuf:"bytes,6,opt,name=pveShop,proto3" json:"pveShop" bson:"pveShop"` //金币商店数据 + AllianceShop *UserShopData `protobuf:"bytes,7,opt,name=allianceShop,proto3" json:"allianceShop" bson:"allianceShop"` //金币商店数据 } func (x *DBShop) Reset() { @@ -241,11 +241,11 @@ type DBShopItem struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //装备id - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //装备id - GoodsId int32 `protobuf:"varint,3,opt,name=goodsId,proto3" json:"goodsId"` //@go_tags(`bson:"goodsId"`)商品Id - BuyNum map[int32]int32 `protobuf:"bytes,4,rep,name=buyNum,proto3" json:"buyNum" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //@go_tags(`bson:"buyNum"`)购买数量 - LastBuyTime map[int32]int64 `protobuf:"bytes,5,rep,name=lastBuyTime,proto3" json:"lastBuyTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //@go_tags(`bson:"lastBuyTime"`)最后一次购买的时间 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //装备id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //装备id + GoodsId int32 `protobuf:"varint,3,opt,name=goodsId,proto3" json:"goodsId" bson:"goodsId"` //商品Id + BuyNum map[int32]int32 `protobuf:"bytes,4,rep,name=buyNum,proto3" json:"buyNum" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"buyNum"` //购买数量 + LastBuyTime map[int32]int64 `protobuf:"bytes,5,rep,name=lastBuyTime,proto3" json:"lastBuyTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"lastBuyTime"` //最后一次购买的时间 } func (x *DBShopItem) Reset() { From e36e16ae92aab6c940e81650cc0cfc11810598c8 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 27 Jul 2022 14:16:21 +0800 Subject: [PATCH 2/3] gm --- modules/gm/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gm/module.go b/modules/gm/module.go index fd6b30130..d8bb51026 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -9,7 +9,7 @@ import ( /* 模块名:GM工具模块 描述:处理客户端发过来的gm命令 -开发:李伟 +开发:梅雄风 */ func NewModule() core.IModule { m := new(GM) From 2a06c90585562b008b72a39b6025107edc83ab61 Mon Sep 17 00:00:00 2001 From: zhaocy Date: Wed, 27 Jul 2022 14:28:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/robot/task.go | 10 +++++----- modules/task/api_receive.go | 32 ++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/cmd/robot/task.go b/cmd/robot/task.go index e799ca6ef..2f5e54d4a 100644 --- a/cmd/robot/task.go +++ b/cmd/robot/task.go @@ -17,9 +17,9 @@ var ( subType: task.TaskSubTypeList, req: &pb.TaskListReq{ //设置任务类型 - TaskTag: int32(comm.TASK_DAILY), //每天任务 + // TaskTag: int32(comm.TASK_DAILY), //每天任务 // TaskTag: int32(comm.TASK_WEEKLY), //周任务 - // TaskTag: int32(comm.TASK_ACHIEVE), + TaskTag: int32(comm.TASK_ACHIEVE), // TaskTag: int32(comm.TASK_STRATEGY), }, rsp: &pb.TaskListResp{}, @@ -39,8 +39,8 @@ var ( mainType: string(comm.ModuleTask), subType: task.TaskSubTypeReceive, req: &pb.TaskReceiveReq{ - TaskTag: int32(comm.TASK_DAILY), - Id: "62dfee653be162da508224a4", + TaskTag: int32(comm.TASK_ACHIEVE), + Id: "62e0d79d7eefc9f4ef5803e3", }, rsp: &pb.TaskReceiveResp{}, // enabled: true, @@ -65,7 +65,7 @@ var ( } fmt.Printf("玩家活跃度 :%v \n", out.Active) }, - enabled: true, + // enabled: true, }, { desc: "活跃度领取", mainType: string(comm.ModuleTask), diff --git a/modules/task/api_receive.go b/modules/task/api_receive.go index 5b2afd9c0..46a741dfb 100644 --- a/modules/task/api_receive.go +++ b/modules/task/api_receive.go @@ -48,23 +48,27 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq) return } - //更新活跃度 - ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId()) - if err != nil { - code = pb.ErrorCode_DBError - return - } - if ue != nil { - update := make(map[string]interface{}) - if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY { - update["activeday"] = ue.Activeday + conf.Active - } else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY { - update["activeweek"] = ue.Activeweek + conf.Active - } - if err = this.moduleTask.ModuleUser.ChanageUserExpand(session.GetUserId(), update); err != nil { + if conf.Active > 0 { + //更新活跃度 + ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId()) + if err != nil { code = pb.ErrorCode_DBError return } + if ue != nil { + update := make(map[string]interface{}) + if comm.TaskTag(req.TaskTag) == comm.TASK_DAILY { + update["activeday"] = ue.Activeday + conf.Active + } else if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY { + update["activeweek"] = ue.Activeweek + conf.Active + } + if len(update) > 0 { + if err = this.moduleTask.ModuleUser.ChanageUserExpand(session.GetUserId(), update); err != nil { + code = pb.ErrorCode_DBError + return + } + } + } } //奖励