获得数据
This commit is contained in:
parent
79bbbbc65c
commit
3c7cd6298d
@ -357,67 +357,70 @@ func (this *Activity) GetHdData(session comm.IUserSession, oids []string) (resul
|
||||
continue
|
||||
}
|
||||
}
|
||||
list, _ = this.modelhdData.getHddataByOid(session.GetUserId(), id)
|
||||
if activity.Itype == pb.HdType_HdTypeSign {
|
||||
if list.Val == 0 || !utils.IsToday(list.Lasttime) {
|
||||
list.Lasttime = curTime
|
||||
list.Val += 1
|
||||
update := make(map[string]interface{})
|
||||
update["lasttime"] = list.Lasttime
|
||||
update["val"] = list.Val
|
||||
this.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
|
||||
}
|
||||
}
|
||||
|
||||
// 开服等级活动
|
||||
if activity.Itype == pb.HdType_HdLevel {
|
||||
if user := this.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
||||
if list.Val != user.Lv {
|
||||
list.Val = user.Lv
|
||||
if activity.Itype == pb.HdType_HdTypeSign || activity.Itype == pb.HdType_HdLevel || activity.Itype == pb.HdType_HdCelebration {
|
||||
list, _ = this.modelhdData.getHddataByOid(session.GetUserId(), id)
|
||||
if activity.Itype == pb.HdType_HdTypeSign {
|
||||
if list.Val == 0 || !utils.IsToday(list.Lasttime) {
|
||||
list.Lasttime = curTime
|
||||
list.Val += 1
|
||||
update := make(map[string]interface{})
|
||||
update["lasttime"] = list.Lasttime
|
||||
update["val"] = list.Val
|
||||
this.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取开服庆典活动
|
||||
if activity.Itype == pb.HdType_HdCelebration {
|
||||
// key := fmt.Sprintf("%s-%s", session.GetUserId(), id)
|
||||
if list, err = this.modelhdData.getHddataByOid(session.GetUserId(), id); err == nil {
|
||||
|
||||
if !utils.IsToday(list.Lasttime) || list.Val == 0 { // 不是今天重置
|
||||
list.Lasttime = configure.Now().Unix()
|
||||
list.Gotarr = make(map[int32]int32)
|
||||
update := make(map[string]interface{})
|
||||
// 计算进度
|
||||
update["lasttime"] = list.Lasttime
|
||||
|
||||
update["gotarr"] = list.Gotarr
|
||||
var maxday int32
|
||||
_days := this.configure.GetHDCelebrationData()
|
||||
for _, v := range _days { // 开启循环
|
||||
maxday += v
|
||||
// 开服等级活动
|
||||
if activity.Itype == pb.HdType_HdLevel {
|
||||
if user := this.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
||||
if list.Val != user.Lv {
|
||||
list.Val = user.Lv
|
||||
list.Lasttime = curTime
|
||||
update := make(map[string]interface{})
|
||||
update["lasttime"] = list.Lasttime
|
||||
update["val"] = list.Val
|
||||
this.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
|
||||
}
|
||||
var pos int32
|
||||
_sub := int32((configure.Now().Unix() - activity.Stime) / (24 * 3600))
|
||||
_sub = _sub%maxday + 1
|
||||
for index, v := range _days {
|
||||
for i := 0; i < int(v); i++ {
|
||||
pos++
|
||||
if _sub == pos {
|
||||
list.Val = int32(index) + 1 // 计算val 值
|
||||
update["val"] = list.Val
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 获取开服庆典活动
|
||||
if activity.Itype == pb.HdType_HdCelebration {
|
||||
// key := fmt.Sprintf("%s-%s", session.GetUserId(), id)
|
||||
if list, err = this.modelhdData.getHddataByOid(session.GetUserId(), id); err == nil {
|
||||
|
||||
if !utils.IsToday(list.Lasttime) || list.Val == 0 { // 不是今天重置
|
||||
list.Lasttime = configure.Now().Unix()
|
||||
list.Gotarr = make(map[int32]int32)
|
||||
update := make(map[string]interface{})
|
||||
// 计算进度
|
||||
update["lasttime"] = list.Lasttime
|
||||
|
||||
update["gotarr"] = list.Gotarr
|
||||
var maxday int32
|
||||
_days := this.configure.GetHDCelebrationData()
|
||||
for _, v := range _days { // 开启循环
|
||||
maxday += v
|
||||
}
|
||||
var pos int32
|
||||
_sub := int32((configure.Now().Unix() - activity.Stime) / (24 * 3600))
|
||||
_sub = _sub%maxday + 1
|
||||
for index, v := range _days {
|
||||
for i := 0; i < int(v); i++ {
|
||||
pos++
|
||||
if _sub == pos {
|
||||
list.Val = int32(index) + 1 // 计算val 值
|
||||
update["val"] = list.Val
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
this.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
|
||||
}
|
||||
this.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if list != nil {
|
||||
result = append(result, list)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user