Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
4034a37282
@ -91,7 +91,9 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin
|
||||
model := db.NewDBModelByExpired(comm.TableVikingRank, conn_)
|
||||
|
||||
// 写入排行榜
|
||||
record := &pb.DBVikingRecord{}
|
||||
record := &pb.DBVikingRecord{
|
||||
Data: map[int32]*pb.ScoreData{},
|
||||
}
|
||||
if err = model.Get(uid, record); err == mgo.MongodbNil {
|
||||
record.Id = primitive.NewObjectID().Hex()
|
||||
record.Data = make(map[int32]*pb.ScoreData, 0)
|
||||
@ -111,7 +113,7 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin
|
||||
tmp := make(map[int32]int32, 0)
|
||||
tmp[difficulty] = costTime
|
||||
|
||||
if record.Data[boosID] == nil {
|
||||
if _, ok := record.Data[boosID]; !ok {
|
||||
record.Data[boosID] = &pb.ScoreData{
|
||||
Costime: tmp,
|
||||
Maxnandu: difficulty,
|
||||
@ -137,20 +139,18 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin
|
||||
}
|
||||
update := make(map[string]interface{}, 0)
|
||||
update["uinfo"] = record.Uinfo
|
||||
if record.Data == nil {
|
||||
record.Data = make(map[int32]*pb.ScoreData)
|
||||
}
|
||||
|
||||
if _, ok := record.Data[boosID]; !ok {
|
||||
tmp := make(map[int32]int32, 0)
|
||||
tmp[difficulty] = costTime
|
||||
mpLine := make(map[int32]*pb.LineData, 0)
|
||||
mpLine[difficulty] = line
|
||||
record.Data[boosID] = &pb.ScoreData{
|
||||
Costime: map[int32]int32{},
|
||||
Maxnandu: 0,
|
||||
Line: map[int32]*pb.LineData{},
|
||||
}
|
||||
}
|
||||
if record.Data[boosID] == nil {
|
||||
record.Data[boosID].Costime = make(map[int32]int32, 0)
|
||||
record.Data[boosID].Line = make(map[int32]*pb.LineData, 0)
|
||||
Costime: tmp,
|
||||
Maxnandu: difficulty,
|
||||
Line: mpLine,
|
||||
}
|
||||
} else {
|
||||
if record.Data[boosID].Maxnandu < difficulty {
|
||||
record.Data[boosID].Maxnandu = difficulty
|
||||
} else {
|
||||
@ -158,6 +158,8 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
record.Data[boosID].Costime[difficulty] = costTime
|
||||
record.Data[boosID].Line[difficulty] = line
|
||||
update["data"] = record.Data
|
||||
|
@ -122,8 +122,7 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
||||
record = &pb.DBVSeasonRecord{
|
||||
Id: "",
|
||||
Uinfo: &pb.BaseUserInfo{},
|
||||
Data: map[int32]*pb.HuiheData{},
|
||||
//Line: &pb.LineData{},
|
||||
Data: make(map[int32]*pb.HuiheData, 0),
|
||||
}
|
||||
if err = model.Get(uid, record); err == mgo.MongodbNil {
|
||||
record.Id = primitive.NewObjectID().Hex()
|
||||
@ -144,7 +143,7 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
||||
tmp := make(map[int32]int32, 0)
|
||||
tmp[difficulty] = huihe
|
||||
|
||||
if record.Data[boosID] == nil {
|
||||
if _, ok := record.Data[boosID]; !ok {
|
||||
record.Data[boosID] = &pb.HuiheData{
|
||||
Huihe: tmp,
|
||||
Maxnandu: difficulty,
|
||||
@ -158,7 +157,6 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
||||
|
||||
model.Add(uid, record)
|
||||
} else if err == nil {
|
||||
|
||||
record.Uinfo = &pb.BaseUserInfo{
|
||||
Uid: uid,
|
||||
Sid: user.Sid,
|
||||
@ -170,11 +168,17 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
||||
Lv: user.Lv,
|
||||
}
|
||||
update["uinfo"] = record.Uinfo
|
||||
if record.Data[boosID] == nil {
|
||||
record.Data[boosID].Huihe = make(map[int32]int32, 0)
|
||||
record.Data[boosID].Line = make(map[int32]*pb.LineData, 0)
|
||||
if _, ok := record.Data[boosID]; !ok {
|
||||
mpLine := make(map[int32]*pb.LineData, 0)
|
||||
mpLine[difficulty] = line
|
||||
tmp := make(map[int32]int32, 0)
|
||||
tmp[difficulty] = huihe
|
||||
record.Data[boosID] = &pb.HuiheData{
|
||||
Huihe: tmp,
|
||||
Maxnandu: difficulty,
|
||||
Line: mpLine,
|
||||
}
|
||||
|
||||
} else {
|
||||
if record.Data[boosID].Maxnandu < difficulty {
|
||||
record.Data[boosID].Maxnandu = difficulty
|
||||
} else {
|
||||
@ -182,6 +186,7 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
record.Data[boosID].Huihe[difficulty] = huihe
|
||||
record.Data[boosID].Line[difficulty] = line
|
||||
update["data"] = record.Data
|
||||
|
Loading…
Reference in New Issue
Block a user