优化
This commit is contained in:
parent
7400744e09
commit
9c8c866d9d
@ -33,6 +33,7 @@ type Timer struct {
|
|||||||
caravan *CaravanRank
|
caravan *CaravanRank
|
||||||
activity *Activity
|
activity *Activity
|
||||||
stone *StoneComp
|
stone *StoneComp
|
||||||
|
viking *VikingRank
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模块名
|
// 模块名
|
||||||
@ -73,6 +74,7 @@ func (this *Timer) OnInstallComp() {
|
|||||||
this.caravan = this.RegisterComp(new(CaravanRank)).(*CaravanRank)
|
this.caravan = this.RegisterComp(new(CaravanRank)).(*CaravanRank)
|
||||||
this.activity = this.RegisterComp(new(Activity)).(*Activity)
|
this.activity = this.RegisterComp(new(Activity)).(*Activity)
|
||||||
this.stone = this.RegisterComp(new(StoneComp)).(*StoneComp)
|
this.stone = this.RegisterComp(new(StoneComp)).(*StoneComp)
|
||||||
|
this.viking = this.RegisterComp(new(VikingRank)).(*VikingRank)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跨服对象获取数据操作对象
|
// 跨服对象获取数据操作对象
|
||||||
|
@ -46,7 +46,6 @@ func (this *VikingRank) Start() (err error) {
|
|||||||
// 0 0 0 ? * MON // 每周一零点
|
// 0 0 0 ? * MON // 每周一零点
|
||||||
cron.AddFunc("0 0 0 ? * MON", this.TimerSeason)
|
cron.AddFunc("0 0 0 ? * MON", this.TimerSeason)
|
||||||
|
|
||||||
//this.TimerSeason()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,29 +121,7 @@ func (this *configureComp) GetVikingRewardConf() (conf []*cfg.GameVikingRewardDa
|
|||||||
|
|
||||||
if v, err := this.GetConfigure(viking_reward); err == nil {
|
if v, err := this.GetConfigure(viking_reward); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameVikingReward); ok {
|
if configure, ok := v.(*cfg.GameVikingReward); ok {
|
||||||
szReward := configure.GetDataList()
|
conf = configure.GetDataList()
|
||||||
var (
|
|
||||||
pos int32
|
|
||||||
rankid int32
|
|
||||||
uids []string // 玩家发奖
|
|
||||||
)
|
|
||||||
for i := 0; i < 50; i++ {
|
|
||||||
rankid = int32(i) + 1 // 排名id
|
|
||||||
if szReward[pos].RankLow <= rankid && szReward[pos].RankUp >= rankid {
|
|
||||||
uids = append(uids, "1")
|
|
||||||
} else {
|
|
||||||
// this.moduleViking.mail.SendNewMail(&pb.DBMailData{
|
|
||||||
// Cid: "SeasonViking1Reward",
|
|
||||||
// Param: []string{fmt.Sprintf("%d-%d", szReward[pos].RankLow, szReward[pos].RankUp)},
|
|
||||||
// CreateTime: uint64(configure.Now().Unix()),
|
|
||||||
// Items: Items,
|
|
||||||
// }, uids...)
|
|
||||||
fmt.Printf("%v,%v", uids, szReward[pos])
|
|
||||||
uids = []string{}
|
|
||||||
pos += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,44 +237,41 @@ func (this *ModelSRank) raceSettlement() {
|
|||||||
Items []*pb.UserAssets
|
Items []*pb.UserAssets
|
||||||
err error
|
err error
|
||||||
szReward []*cfg.GameVikingRewardData
|
szReward []*cfg.GameVikingRewardData
|
||||||
uids []string // 玩家发奖
|
mailCid string
|
||||||
)
|
)
|
||||||
tableName := this.TableName + "1" //strconv.Itoa(int(bossid))
|
for iBossType := 1; iBossType <= 3; iBossType++ {
|
||||||
|
mailCid = fmt.Sprintf("SeasonViking%dReward", iBossType)
|
||||||
|
tableName := this.TableName + strconv.Itoa(int(iBossType))
|
||||||
szReward = this.moduleViking.configure.GetVikingRewardConf()
|
szReward = this.moduleViking.configure.GetVikingRewardConf()
|
||||||
|
|
||||||
if result, err = this.DBModel.Redis.ZRevRange(tableName, 0, comm.MaxRankList).Result(); err != nil {
|
if result, err = this.DBModel.Redis.ZRevRange(tableName, 0, comm.MaxRankList).Result(); err != nil {
|
||||||
this.moduleViking.Errorln(err)
|
this.moduleViking.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.moduleViking.Debugf("uid:%v", uids)
|
|
||||||
var (
|
|
||||||
pos int32
|
|
||||||
rankid int32
|
|
||||||
)
|
|
||||||
// 1-1 2-2 3-3 4-10
|
|
||||||
for i := 0; i < len(result); i++ {
|
|
||||||
|
|
||||||
rankid = int32(i) + 1 // 排名id
|
if len(result) == 0 {
|
||||||
if szReward[pos].RankLow <= rankid && szReward[pos].RankUp >= rankid {
|
continue
|
||||||
uids = append(uids, result[i])
|
}
|
||||||
|
szReward = this.moduleViking.configure.GetVikingRewardConf()
|
||||||
|
for _, v := range szReward {
|
||||||
|
ids := []string{} // 玩家发奖
|
||||||
|
var iEndIndex int32
|
||||||
|
if v.RankUp >= int32(len(result)) {
|
||||||
|
iEndIndex = int32(len(result))
|
||||||
} else {
|
} else {
|
||||||
this.moduleViking.mail.SendNewMail(&pb.DBMailData{
|
iEndIndex = v.RankUp
|
||||||
Cid: "SeasonViking1Reward",
|
}
|
||||||
Param: []string{fmt.Sprintf("%d-%d", szReward[pos].RankLow, szReward[pos].RankUp)},
|
if v.RankLow > int32(len(result)) { // 没这么多人直接返回
|
||||||
|
break
|
||||||
|
}
|
||||||
|
ids = append(result[v.RankLow-1 : iEndIndex])
|
||||||
|
|
||||||
|
this.moduleViking.mail.SendNewMail(&pb.DBMailData{ // //发邮件
|
||||||
|
Cid: mailCid,
|
||||||
|
Param: []string{fmt.Sprintf("%d-%d", v.RankLow, v.RankUp)},
|
||||||
CreateTime: uint64(configure.Now().Unix()),
|
CreateTime: uint64(configure.Now().Unix()),
|
||||||
Items: Items,
|
Items: Items,
|
||||||
}, uids...)
|
}, ids...)
|
||||||
|
}
|
||||||
uids = []string{}
|
|
||||||
pos += 1
|
|
||||||
}
|
|
||||||
// uids = append(uids, result[i])
|
|
||||||
// //发邮件
|
|
||||||
// this.moduleViking.mail.SendNewMail(&pb.DBMailData{
|
|
||||||
// Cid: "SeasonViking1Reward",
|
|
||||||
// Param: []string{fmt.Sprintf("%d-%d", szReward[i].RankLow, szReward[i].RankUp)},
|
|
||||||
// CreateTime: uint64(configure.Now().Unix()),
|
|
||||||
// Items: Items,
|
|
||||||
// }, result[i])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user