Compare commits

..

No commits in common. "2f74e5bfabe3ebe7f8148ced3c7b2cfb4f831762" and "8a19cd642f49f96fc111d6ce75ddc4a163fed0eb" have entirely different histories.

1 changed files with 17 additions and 22 deletions

View File

@ -63,14 +63,9 @@ const (
const (
ShopTypeCoin = iota + 1 // 金币
ShopTypeDiamond // 钻石
)
// 商品参数类型
const (
ShopParamCoin = iota // 金币
ShopParamDiamond // 钻石
ShopParamUnKnown // 未定义
ShopParamMax // 参数数量
ShopTypeItem // 道具
ShopTypeFangKa // 房卡
ShopTypeMax
)
// 兑换商品状态
@ -144,7 +139,7 @@ func (this *ShopMgr) GetShopInfoProto(si *model.ShopInfo, p *Player, vipShopId i
}
added := int32(rand.Intn(int(si.AddArea[1])-int(si.AddArea[0])+1) + int(si.AddArea[0]))
consumptionAmount := int32(rand.Intn(int(si.CostArea[1])-int(si.CostArea[0])+1) + int(si.CostArea[0]))
amount := si.Amount
amount := int64(si.Amount)
isBuy := false
if si.Page == ShopPageVip {
shopData := p.GetVipShopData(si.Id, vipShopId)
@ -710,7 +705,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
})
}
amount := [ShopParamMax]int32{} // 获得含义:金币,钻石,经验
amount := [3]int32{} // 获得含义:金币,钻石,经验
if shopInfo.Page == ShopPageVip {
if p.VipShopData[vipShopId] == nil {
logger.Logger.Errorf("GainShop 没有找到vip商品 shopId:%v vipShopId:%v snid:%v", shopInfo.Id, vipShopId, p.SnId)
@ -725,7 +720,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
switch shopInfo.Type {
case ShopTypeCoin:
amount[ShopParamCoin] = int32(addTotal)
amount[0] = int32(addTotal)
p.AddCoin(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
if shopInfo.Ad > 0 { //观看广告
if !p.IsRob {
@ -742,7 +737,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
case ShopTypeDiamond:
//增加钻石
amount[ShopParamDiamond] = int32(addTotal)
amount[1] = int32(addTotal)
p.AddDiamond(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
if shopInfo.Ad > 0 { //观看广告
if !p.IsRob {
@ -909,7 +904,7 @@ func (this *ShopMgr) Exchange(p *Player, goodsId int32, username, mobile, commen
if err := proto.Unmarshal(buff, as); err != nil {
logger.Logger.Errorf("API_CreateExchange err: %v %v", err, as.Tag)
}
var amount [ShopParamMax]int32
var amount [ShopTypeItem]int32
//保存db
dbShop := this.NewDbShop(p, 0, amount[:], ExchangeConsumeCash, info.Cash*num,
common.GainWay_ShopBuy, itemInfo, cdata.Id, cdata.Name, 0, "", []int32{})
@ -1201,7 +1196,7 @@ func (this *ShopMgr) NewDbShop(p *Player, pageId int32, amount []int32, consume,
func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any, remark string) {
//三方购买
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
var amount [ShopParamMax]int32
var amount [ShopTypeItem]int32
var dbShop *model.DbShop
if shopInfo, ok := data.(*model.ShopInfo); ok {
costNum := rand.Int31n(shopInfo.CostArea[1]-shopInfo.CostArea[0]+1) + shopInfo.CostArea[0]
@ -1220,7 +1215,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
switch shopInfo.Type {
case ShopTypeDiamond:
amount[ShopParamDiamond] = int32(shopInfo.AmountFinal)
amount[ShopTypeDiamond-1] = int32(shopInfo.AmountFinal)
default:
}
@ -1258,14 +1253,14 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
//兑换 充值订单
logger.Logger.Infof("客户端请求兑换 创建支付订单AppId = %v,SnId = %v,Id = %v,dbShop.LogId.Hex() = %v,cash = %v", common.GetAppId(), p.SnId, cdata.Id, dbShop.LogId.Hex(), info.Cash*cdata.ExchangeNum)
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, cdata.Id, p.Platform, p.PackageID, p.DeviceOS,
p.DeviceId, cdata.Name, amount, info.Cash*cdata.ExchangeNum, nil, orderId, p.Channel, p.ChannelId)
p.DeviceId, cdata.Name, [ShopTypeItem]int32{0, 0, 0}, info.Cash*cdata.ExchangeNum, nil, orderId, p.Channel, p.ChannelId)
} else if bbd, ok := data.(*webapi_proto.BlindBoxData); ok {
if bbd.Type == ShopTypeCoin {
if bbd.Type == 1 {
//金币
amount[ShopParamCoin] = bbd.Grade
} else if bbd.Type == ShopTypeDiamond {
amount[0] = bbd.Grade
} else if bbd.Type == 2 {
//钻石
amount[ShopParamDiamond] = bbd.Grade
amount[1] = bbd.Grade
}
dbShop = this.NewDbShop(p, 0, amount[:], ShopConsumeMoney, int32(bbd.Price2), common.GainWay_ActBlindBox, nil, 0, "", 0, remark, []int32{bbd.Id})
err := model.InsertDbShopLog(dbShop)
@ -1279,9 +1274,9 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
var items []model.ItemInfo
for _, it := range wfs.Item {
if it.Type == 1 {
amount[ShopParamCoin] = it.Grade
amount[0] = it.Grade
} else if it.Type == 2 {
amount[ShopParamDiamond] = it.Grade
amount[1] = it.Grade
} else if it.Type == 3 {
items = append(items, model.ItemInfo{
ItemId: it.Item_Id,