vip 特权 额外增加购买次数
This commit is contained in:
parent
973f325c75
commit
dcbc9b5490
@ -653,14 +653,14 @@ const (
|
||||
|
||||
// 特权类型
|
||||
const (
|
||||
PrivilegeType1 = iota + 1 //每日获得
|
||||
PrivilegeType2 //金币商店每日免费刷新次数
|
||||
PrivilegeType3 //维京远征每日可购买挑战次数
|
||||
PrivilegeType4 //狩猎每日可购买挑战次数
|
||||
PrivilegeType5 //竞技场每日可购买挑战次数
|
||||
PrivilegeType6 //梦境每日可购买挑战次数
|
||||
PrivilegeType7 //巨怪商队背包容量
|
||||
PrivilegeType8 //美食馆每日最大制作时间
|
||||
PrivilegeType9 //武馆每日最大练功时间
|
||||
PrivilegeType10 //铁匠铺每日最大锻造时间
|
||||
PrivilegeType1 int32 = iota + 1 //每日获得
|
||||
PrivilegeType2 //金币商店每日免费刷新次数
|
||||
PrivilegeType3 //维京远征每日可购买挑战次数
|
||||
PrivilegeType4 //狩猎每日可购买挑战次数
|
||||
PrivilegeType5 //竞技场每日可购买挑战次数
|
||||
PrivilegeType6 //梦境每日可购买挑战次数
|
||||
PrivilegeType7 //巨怪商队背包容量
|
||||
PrivilegeType8 //美食馆每日最大制作时间
|
||||
PrivilegeType9 //武馆每日最大练功时间
|
||||
PrivilegeType10 //铁匠铺每日最大锻造时间
|
||||
)
|
||||
|
@ -21,12 +21,13 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.HuntingBuyReq)
|
||||
|
||||
func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
curByCount int32
|
||||
costRes *cfg.Gameatn // 门票atn 类型 只取T
|
||||
mapData map[string]interface{}
|
||||
szCostRes []*cfg.Gameatn // 购买累计消耗
|
||||
curCount int32 // 当前门票数量
|
||||
addCount int32 //获得数量
|
||||
curByCount int32
|
||||
costRes *cfg.Gameatn // 门票atn 类型 只取T
|
||||
mapData map[string]interface{}
|
||||
szCostRes []*cfg.Gameatn // 购买累计消耗
|
||||
curCount int32 // 当前门票数量
|
||||
addCount int32 //获得数量
|
||||
PrivilegeBuyCount int32 // 特权购买次数
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
code = this.BuyCheck(session, req)
|
||||
@ -48,8 +49,10 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code
|
||||
} else {
|
||||
curByCount = list.BuyCount
|
||||
}
|
||||
|
||||
PrivilegeBuyCount = this.module.ModulePrivilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType4)
|
||||
curByCount += req.Count // 当前需要购买的数量
|
||||
if this.configure.GetMaxBuyChallengeCount() < curByCount {
|
||||
if this.configure.GetMaxBuyChallengeCount()+PrivilegeBuyCount < curByCount {
|
||||
code = pb.ErrorCode_HuntingBuyMaxCount
|
||||
return
|
||||
}
|
||||
@ -97,8 +100,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HuntingBuyReq) (code
|
||||
for i := list.BuyCount + 1; i <= curByCount; i++ {
|
||||
_cfg := this.configure.GetBuyChallengeCount(i)
|
||||
if _cfg == nil {
|
||||
code = pb.ErrorCode_HuntingBuyMaxCount
|
||||
return
|
||||
// 取最后一条
|
||||
_cfg = this.configure.GetLastBuyChallenge()
|
||||
}
|
||||
szCostRes = append(szCostRes, _cfg.Need...)
|
||||
}
|
||||
|
@ -110,3 +110,17 @@ func (this *configureComp) GetMaxBuyChallengeCount() int32 {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// 获取最后一条数据
|
||||
func (this *configureComp) GetLastBuyChallenge() (data *cfg.GameHuntingChallengeData) {
|
||||
if v, err := this.GetConfigure(game_challenge); err == nil {
|
||||
if configure, ok := v.(*cfg.GameHuntingChallenge); ok && len(configure.GetDataList()) > 0 {
|
||||
data = configure.GetDataList()[len(configure.GetDataList())-1]
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_challenge conf err:%v", err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user