Compare commits
2 Commits
8a19cd642f
...
2f74e5bfab
Author | SHA1 | Date |
---|---|---|
|
2f74e5bfab | |
|
c20f0fa69c |
|
@ -63,9 +63,14 @@ const (
|
|||
const (
|
||||
ShopTypeCoin = iota + 1 // 金币
|
||||
ShopTypeDiamond // 钻石
|
||||
ShopTypeItem // 道具
|
||||
ShopTypeFangKa // 房卡
|
||||
ShopTypeMax
|
||||
)
|
||||
|
||||
// 商品参数类型
|
||||
const (
|
||||
ShopParamCoin = iota // 金币
|
||||
ShopParamDiamond // 钻石
|
||||
ShopParamUnKnown // 未定义
|
||||
ShopParamMax // 参数数量
|
||||
)
|
||||
|
||||
// 兑换商品状态
|
||||
|
@ -139,7 +144,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 := int64(si.Amount)
|
||||
amount := si.Amount
|
||||
isBuy := false
|
||||
if si.Page == ShopPageVip {
|
||||
shopData := p.GetVipShopData(si.Id, vipShopId)
|
||||
|
@ -705,7 +710,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
|
|||
})
|
||||
}
|
||||
|
||||
amount := [3]int32{} // 获得含义:金币,钻石,经验
|
||||
amount := [ShopParamMax]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)
|
||||
|
@ -720,7 +725,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
|
|||
|
||||
switch shopInfo.Type {
|
||||
case ShopTypeCoin:
|
||||
amount[0] = int32(addTotal)
|
||||
amount[ShopParamCoin] = int32(addTotal)
|
||||
p.AddCoin(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
|
||||
if shopInfo.Ad > 0 { //观看广告
|
||||
if !p.IsRob {
|
||||
|
@ -737,7 +742,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
|
|||
|
||||
case ShopTypeDiamond:
|
||||
//增加钻石
|
||||
amount[1] = int32(addTotal)
|
||||
amount[ShopParamDiamond] = int32(addTotal)
|
||||
p.AddDiamond(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
|
||||
if shopInfo.Ad > 0 { //观看广告
|
||||
if !p.IsRob {
|
||||
|
@ -904,7 +909,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 [ShopTypeItem]int32
|
||||
var amount [ShopParamMax]int32
|
||||
//保存db
|
||||
dbShop := this.NewDbShop(p, 0, amount[:], ExchangeConsumeCash, info.Cash*num,
|
||||
common.GainWay_ShopBuy, itemInfo, cdata.Id, cdata.Name, 0, "", []int32{})
|
||||
|
@ -1196,7 +1201,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 [ShopTypeItem]int32
|
||||
var amount [ShopParamMax]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]
|
||||
|
@ -1215,7 +1220,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
|||
|
||||
switch shopInfo.Type {
|
||||
case ShopTypeDiamond:
|
||||
amount[ShopTypeDiamond-1] = int32(shopInfo.AmountFinal)
|
||||
amount[ShopParamDiamond] = int32(shopInfo.AmountFinal)
|
||||
default:
|
||||
|
||||
}
|
||||
|
@ -1253,14 +1258,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, [ShopTypeItem]int32{0, 0, 0}, info.Cash*cdata.ExchangeNum, nil, orderId, p.Channel, p.ChannelId)
|
||||
p.DeviceId, cdata.Name, amount, info.Cash*cdata.ExchangeNum, nil, orderId, p.Channel, p.ChannelId)
|
||||
} else if bbd, ok := data.(*webapi_proto.BlindBoxData); ok {
|
||||
if bbd.Type == 1 {
|
||||
if bbd.Type == ShopTypeCoin {
|
||||
//金币
|
||||
amount[0] = bbd.Grade
|
||||
} else if bbd.Type == 2 {
|
||||
amount[ShopParamCoin] = bbd.Grade
|
||||
} else if bbd.Type == ShopTypeDiamond {
|
||||
//钻石
|
||||
amount[1] = bbd.Grade
|
||||
amount[ShopParamDiamond] = 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)
|
||||
|
@ -1274,9 +1279,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[0] = it.Grade
|
||||
amount[ShopParamCoin] = it.Grade
|
||||
} else if it.Type == 2 {
|
||||
amount[1] = it.Grade
|
||||
amount[ShopParamDiamond] = it.Grade
|
||||
} else if it.Type == 3 {
|
||||
items = append(items, model.ItemInfo{
|
||||
ItemId: it.Item_Id,
|
||||
|
|
Loading…
Reference in New Issue