房卡默认加成

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 {
ret = append(ret, ItemInfo{
ItemId: this.ItemId,
ItemNum: this.Amount,
ItemNum: this.AmountFinal,
})
}
for _, v := range this.AddItemInfo {

View File

@ -52,6 +52,7 @@ const (
ShopPageGift = 7 //礼包页面
ShopPageDiamondBank = 8 //钻石存储罐
ShopPagePermit = 9 //赛季通行证
ShopPageFangKa = 10 //房卡页面
ShopPagePhoneScore = 61 //手机积分商城
ShopPagePhoneScoreGoogle = 62
@ -646,6 +647,7 @@ func (this *ShopMgr) GetAmountFinal(p *Player, shopId, vipShopId int32) int64 {
}
}
default:
addTotal += addNormal
}
return addTotal
}
@ -1197,37 +1199,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
var amount [ShopTypeItem]int32
var dbShop *model.DbShop
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]
/* 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 webItemInfo []*webapi_proto.ItemInfo
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,
common.GainWay_ShopBuy, itemInfo, shopInfo.Id, shopInfo.Name, 0, remark, []int32{})
err := model.InsertDbShopLog(dbShop)
@ -1249,7 +1228,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
return nil
}
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 {
var info *shop.ExchangeType