房卡默认加成

This commit is contained in:
sk 2024-09-06 10:01:10 +08:00
parent 40966b52cb
commit 32e8b2f22e
2 changed files with 19 additions and 40 deletions

View File

@ -77,7 +77,7 @@ func (this *ShopInfo) GetItems() []ItemInfo {
if this.ItemId > 0 { if this.ItemId > 0 {
ret = append(ret, ItemInfo{ ret = append(ret, ItemInfo{
ItemId: this.ItemId, ItemId: this.ItemId,
ItemNum: this.Amount, ItemNum: this.AmountFinal,
}) })
} }
for _, v := range this.AddItemInfo { for _, v := range this.AddItemInfo {

View File

@ -44,14 +44,15 @@ const (
// page类型 // page类型
const ( const (
ShopPageCoin = 1 //金币页面 ShopPageCoin = 1 //金币页面
ShopPageDiamond = 2 //钻石页面 ShopPageDiamond = 2 //钻石页面
ShopPageItem = 3 //道具页面 ShopPageItem = 3 //道具页面
ShopPageVip = 4 //VIP页面 ShopPageVip = 4 //VIP页面
ShopPagePrivilege = 5 //VIP特权礼包 ShopPagePrivilege = 5 //VIP特权礼包
ShopPageGift = 7 //礼包页面 ShopPageGift = 7 //礼包页面
ShopPageDiamondBank = 8 //钻石存储罐 ShopPageDiamondBank = 8 //钻石存储罐
ShopPagePermit = 9 //赛季通行证 ShopPagePermit = 9 //赛季通行证
ShopPageFangKa = 10 //房卡页面
ShopPagePhoneScore = 61 //手机积分商城 ShopPagePhoneScore = 61 //手机积分商城
ShopPagePhoneScoreGoogle = 62 ShopPagePhoneScoreGoogle = 62
@ -646,6 +647,7 @@ func (this *ShopMgr) GetAmountFinal(p *Player, shopId, vipShopId int32) int64 {
} }
} }
default: default:
addTotal += addNormal
} }
return addTotal return addTotal
} }
@ -1197,37 +1199,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
var amount [ShopTypeItem]int32 var amount [ShopTypeItem]int32
var dbShop *model.DbShop var dbShop *model.DbShop
if shopInfo, ok := data.(*model.ShopInfo); ok { if shopInfo, ok := data.(*model.ShopInfo); ok {
// 目前现金只能买钻石
var addTotal = int64(shopInfo.Amount)
added := rand.Int31n(shopInfo.AddArea[1]-shopInfo.AddArea[0]+1) + shopInfo.AddArea[0]
costNum := rand.Int31n(shopInfo.CostArea[1]-shopInfo.CostArea[0]+1) + shopInfo.CostArea[0] costNum := rand.Int31n(shopInfo.CostArea[1]-shopInfo.CostArea[0]+1) + shopInfo.CostArea[0]
/* if shopInfo.Page == ShopPageVip {
//暂时这样修改 VIP礼包没有现金支付
shopData := p.GetVipShopData(shopInfo.Id, 0)
if shopData != nil {
added = shopData.AddArea
costNum = shopData.CostArea
}
}*/
vipAdded := int32(0)
if shopInfo.Page == ShopPageDiamond {
//vip加成
vipAdded = VipMgrSington.GetVipDiamondExtra(p.Platform, p.VIP)
logger.Logger.Tracef("商城钻石购买vip加成 vipAdded = %v", vipAdded)
}
if added > 0 || vipAdded > 0 {
addTotal = shopInfo.Amount + int64((float64(shopInfo.Amount)*float64(added+vipAdded))/100.0)
}
// 首充翻倍
if shopInfo.FirstSwitch {
if !slices.Contains(p.ShopID, int(shopInfo.Id)) {
addTotal *= 2
}
}
amount[ShopTypeDiamond-1] = int32(addTotal)
var itemInfo []model.ItemInfo var itemInfo []model.ItemInfo
var webItemInfo []*webapi_proto.ItemInfo var webItemInfo []*webapi_proto.ItemInfo
for _, info := range shopInfo.GetItems() { for _, info := range shopInfo.GetItems() {
@ -1241,6 +1213,13 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
}) })
} }
switch shopInfo.Type {
case ShopTypeDiamond:
amount[ShopTypeDiamond-1] = int32(shopInfo.AmountFinal)
default:
}
dbShop = this.NewDbShop(p, shopInfo.Page, amount[:], ShopConsumeMoney, costNum, dbShop = this.NewDbShop(p, shopInfo.Page, amount[:], ShopConsumeMoney, costNum,
common.GainWay_ShopBuy, itemInfo, shopInfo.Id, shopInfo.Name, 0, remark, []int32{}) common.GainWay_ShopBuy, itemInfo, shopInfo.Id, shopInfo.Name, 0, remark, []int32{})
err := model.InsertDbShopLog(dbShop) err := model.InsertDbShopLog(dbShop)
@ -1249,7 +1228,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
return nil return nil
} }
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, shopInfo.Id, p.Platform, p.PackageID, p.DeviceOS, return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, shopInfo.Id, p.Platform, p.PackageID, p.DeviceOS,
p.DeviceId, shopInfo.Name, [ShopTypeItem]int32{0, int32(addTotal), 0}, costNum, webItemInfo, "", p.Channel, p.ChannelId) p.DeviceId, shopInfo.Name, [ShopTypeItem]int32{0, int32(shopInfo.AmountFinal), 0}, costNum, webItemInfo, "", p.Channel, p.ChannelId)
} else if cdata, ok := data.(*ExchangeShopInfo); ok { } else if cdata, ok := data.(*ExchangeShopInfo); ok {
var info *shop.ExchangeType var info *shop.ExchangeType