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