上传配置
This commit is contained in:
parent
caee5a30c6
commit
5942706007
@ -75,7 +75,7 @@ func (this *apiComp) ActivityBuy(session comm.IUserSession, req *pb.PayActivityB
|
||||
|
||||
buynum = info.Activitys[conf.Type].Items[conf.Id].Buyunm
|
||||
totalbuy = info.Activitys[conf.Type].Items[conf.Id].Totalbuynum
|
||||
if conf.RepeatNum >= totalbuy || conf.BuyNum >= 0 && buynum >= conf.BuyNum {
|
||||
if conf.RepeatNum <= totalbuy || (conf.BuyNum >= 0 && buynum >= conf.BuyNum) {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
|
@ -3,6 +3,7 @@ package uniongve
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
@ -13,11 +14,44 @@ func (this *apiComp) RouletteCheck(session comm.IUserSession, req *pb.UniongveRo
|
||||
|
||||
// 获取工会 转轮
|
||||
func (this *apiComp) Roulette(session comm.IUserSession, req *pb.UniongveRouletteReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
confs []*cfg.GameGuildBossRouletteData
|
||||
award []*pb.UserAssets = make([]*pb.UserAssets, 0)
|
||||
weight []int32 = make([]int32, 0)
|
||||
index int32
|
||||
err error
|
||||
)
|
||||
|
||||
if errdata = this.RouletteCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if confs, err = this.module.configure.getguildbossroulette(); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range confs {
|
||||
weight = append(weight, v.Weight)
|
||||
}
|
||||
|
||||
index = comm.GetRandW(weight)
|
||||
|
||||
for _, v := range confs[index].Reward {
|
||||
award = append(award, &pb.UserAssets{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
|
||||
if errdata = this.module.DispenseRes(session, confs[index].Reward, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "roulette", &pb.UniongveRouletteResp{})
|
||||
return
|
||||
}
|
||||
|
@ -35,6 +35,25 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com
|
||||
return
|
||||
}
|
||||
|
||||
// 获取所有难度一的boos
|
||||
func (this *MCompConfigure) getguildbossroulette() (results []*cfg.GameGuildBossRouletteData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
|
||||
if v, err = this.GetConfigure(game_guildbossroulette); err != nil {
|
||||
return
|
||||
} else {
|
||||
data, ok := v.(*cfg.GameGuildBossRoulette)
|
||||
if !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v)
|
||||
return
|
||||
}
|
||||
results = data.GetDataList()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 获取所有难度一的boos
|
||||
func (this *MCompConfigure) getguildboss() (results []*cfg.GameGuildBossData, err error) {
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user