庆典活动

This commit is contained in:
meixiongfeng 2023-08-08 12:51:14 +08:00
parent eb835f6ae7
commit ad79b477e6
3 changed files with 25 additions and 24 deletions

View File

@ -55,7 +55,7 @@ func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdD
// 获取开服庆典活动
if activity.Itype == comm.HdCelebration {
// key := fmt.Sprintf("%s-%s", session.GetUserId(), id)
if data, err := this.module.modelhdData.getHddataByOid(session.GetUserId(), id); err != nil {
if data, err := this.module.modelhdData.getHddataByOid(session.GetUserId(), id); err == nil {
// 注意 Gotarr:map[int32]int32 key value 已经挑战的次数
if !utils.IsToday(data.Lasttime) { // 不是今天重置
data.Lasttime = configure.Now().Unix()
@ -67,6 +67,13 @@ func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdD
update["val"] = data.Val
update["gotarr"] = data.Gotarr
this.module.modelhdData.ModifyActivityList(session.GetUserId(), data.Id, update)
result = append(result, data)
} else { // 第一次进入
_sub := (configure.Now().Unix() - activity.Stime)
data.Val = int32(_sub/(24*3600)) + 1
update := make(map[string]interface{})
update["val"] = data.Val
this.module.modelhdData.ModifyActivityList(session.GetUserId(), data.Id, update)
}
}
}

View File

@ -23,6 +23,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ActivityGetListR
data = append(data, v)
}
}
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ActivityGetListResp{
Data: data,
})

View File

@ -227,35 +227,28 @@ func (this *Activity) HDCelebration(session comm.IUserSession, systemtype int32,
update["gotarr"] = data.Gotarr
bChange = true
}
var pos int32
for index, v := range this.configure.GetHDCelebrationData() {
for i := 0; i < int(v); i++ {
pos++
if data.Val == pos {
if conf, err := this.configure.GetHDCelebration(int32(index) + 1); err != nil {
if conf, err := this.configure.GetHDCelebration(data.Val); err != nil {
if conf.Systemtype == systemtype {
data.Gotarr[bosstype] += 1
// 天数
var idays int32
for i, v1 := range conf.Bosstype {
if v1 == systemtype || v1 == 0 { // bosstype 为0 表示所有的boss 类型都算
idays = conf.Num[i]
break
}
}
// 更新信息
update["gotarr"] = data.Gotarr
bChange = true
if data.Gotarr[bosstype] <= idays {
bDouble = true
}
}
if conf.Systemtype == systemtype {
data.Gotarr[bosstype] += 1
// 天数
var idays int32
for i, v1 := range conf.Bosstype {
if v1 == systemtype || v1 == 0 { // bosstype 为0 表示所有的boss 类型都算
idays = conf.Num[i]
break
}
}
// 更新信息
update["gotarr"] = data.Gotarr
bChange = true
if data.Gotarr[bosstype] <= idays {
bDouble = true
}
}
}
if bChange {
this.modelhdData.ModifyActivityList(session.GetUserId(), data.Id, update)
// 推送活动数据进度变化