1.MongoDB、Redis兼容集群模式

2.离线数据接口化访问
This commit is contained in:
flswld
2023-02-26 23:03:13 +08:00
parent 01cb17d4a9
commit 0395dc0bc2
60 changed files with 1298 additions and 464 deletions
+9 -7
View File
@@ -80,19 +80,20 @@ func (g *GameManager) BuyGoodsReq(player *model.Player, payloadMsg pb.Message) {
return
}
if player.GetItemCount(201) < costHcoinCount {
dbItem := player.GetDbItem()
if dbItem.GetItemCount(player, 201) < costHcoinCount {
return
}
g.CostUserItem(player.PlayerID, []*UserItem{{
g.CostUserItem(player.PlayerID, []*ChangeItem{{
ItemId: 201,
ChangeCount: costHcoinCount,
}})
g.AddUserItem(player.PlayerID, []*UserItem{{
g.AddUserItem(player.PlayerID, []*ChangeItem{{
ItemId: buyItemId,
ChangeCount: buyItemCount,
}}, true, constant.ActionReasonShop)
req.Goods.BoughtNum = player.GetItemCount(buyItemId)
req.Goods.BoughtNum = dbItem.GetItemCount(player, buyItemId)
buyGoodsRsp := &proto.BuyGoodsRsp{
ShopType: req.ShopType,
@@ -110,15 +111,16 @@ func (g *GameManager) McoinExchangeHcoinReq(player *model.Player, payloadMsg pb.
}
count := req.Hcoin
if player.GetItemCount(203) < count {
dbItem := player.GetDbItem()
if dbItem.GetItemCount(player, 203) < count {
return
}
g.CostUserItem(player.PlayerID, []*UserItem{{
g.CostUserItem(player.PlayerID, []*ChangeItem{{
ItemId: 203,
ChangeCount: count,
}})
g.AddUserItem(player.PlayerID, []*UserItem{{
g.AddUserItem(player.PlayerID, []*ChangeItem{{
ItemId: 201,
ChangeCount: count,
}}, false, 0)