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_)
|
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 {
|
if err = model.Get(uid, record); err == mgo.MongodbNil {
|
||||||
record.Id = primitive.NewObjectID().Hex()
|
record.Id = primitive.NewObjectID().Hex()
|
||||||
record.Data = make(map[int32]*pb.ScoreData, 0)
|
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 := make(map[int32]int32, 0)
|
||||||
tmp[difficulty] = costTime
|
tmp[difficulty] = costTime
|
||||||
|
|
||||||
if record.Data[boosID] == nil {
|
if _, ok := record.Data[boosID]; !ok {
|
||||||
record.Data[boosID] = &pb.ScoreData{
|
record.Data[boosID] = &pb.ScoreData{
|
||||||
Costime: tmp,
|
Costime: tmp,
|
||||||
Maxnandu: difficulty,
|
Maxnandu: difficulty,
|
||||||
@ -137,20 +139,18 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin
|
|||||||
}
|
}
|
||||||
update := make(map[string]interface{}, 0)
|
update := make(map[string]interface{}, 0)
|
||||||
update["uinfo"] = record.Uinfo
|
update["uinfo"] = record.Uinfo
|
||||||
if record.Data == nil {
|
|
||||||
record.Data = make(map[int32]*pb.ScoreData)
|
|
||||||
}
|
|
||||||
if _, ok := record.Data[boosID]; !ok {
|
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{
|
record.Data[boosID] = &pb.ScoreData{
|
||||||
Costime: map[int32]int32{},
|
Costime: tmp,
|
||||||
Maxnandu: 0,
|
Maxnandu: difficulty,
|
||||||
Line: map[int32]*pb.LineData{},
|
Line: mpLine,
|
||||||
}
|
|
||||||
}
|
|
||||||
if record.Data[boosID] == nil {
|
|
||||||
record.Data[boosID].Costime = make(map[int32]int32, 0)
|
|
||||||
record.Data[boosID].Line = make(map[int32]*pb.LineData, 0)
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if record.Data[boosID].Maxnandu < difficulty {
|
if record.Data[boosID].Maxnandu < difficulty {
|
||||||
record.Data[boosID].Maxnandu = difficulty
|
record.Data[boosID].Maxnandu = difficulty
|
||||||
} else {
|
} else {
|
||||||
@ -158,6 +158,8 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
record.Data[boosID].Costime[difficulty] = costTime
|
record.Data[boosID].Costime[difficulty] = costTime
|
||||||
record.Data[boosID].Line[difficulty] = line
|
record.Data[boosID].Line[difficulty] = line
|
||||||
update["data"] = record.Data
|
update["data"] = record.Data
|
||||||
|
@ -122,8 +122,7 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
|||||||
record = &pb.DBVSeasonRecord{
|
record = &pb.DBVSeasonRecord{
|
||||||
Id: "",
|
Id: "",
|
||||||
Uinfo: &pb.BaseUserInfo{},
|
Uinfo: &pb.BaseUserInfo{},
|
||||||
Data: map[int32]*pb.HuiheData{},
|
Data: make(map[int32]*pb.HuiheData, 0),
|
||||||
//Line: &pb.LineData{},
|
|
||||||
}
|
}
|
||||||
if err = model.Get(uid, record); err == mgo.MongodbNil {
|
if err = model.Get(uid, record); err == mgo.MongodbNil {
|
||||||
record.Id = primitive.NewObjectID().Hex()
|
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 := make(map[int32]int32, 0)
|
||||||
tmp[difficulty] = huihe
|
tmp[difficulty] = huihe
|
||||||
|
|
||||||
if record.Data[boosID] == nil {
|
if _, ok := record.Data[boosID]; !ok {
|
||||||
record.Data[boosID] = &pb.HuiheData{
|
record.Data[boosID] = &pb.HuiheData{
|
||||||
Huihe: tmp,
|
Huihe: tmp,
|
||||||
Maxnandu: difficulty,
|
Maxnandu: difficulty,
|
||||||
@ -158,7 +157,6 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
|||||||
|
|
||||||
model.Add(uid, record)
|
model.Add(uid, record)
|
||||||
} else if err == nil {
|
} else if err == nil {
|
||||||
|
|
||||||
record.Uinfo = &pb.BaseUserInfo{
|
record.Uinfo = &pb.BaseUserInfo{
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
Sid: user.Sid,
|
Sid: user.Sid,
|
||||||
@ -170,11 +168,17 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
|||||||
Lv: user.Lv,
|
Lv: user.Lv,
|
||||||
}
|
}
|
||||||
update["uinfo"] = record.Uinfo
|
update["uinfo"] = record.Uinfo
|
||||||
if record.Data[boosID] == nil {
|
if _, ok := record.Data[boosID]; !ok {
|
||||||
record.Data[boosID].Huihe = make(map[int32]int32, 0)
|
mpLine := make(map[int32]*pb.LineData, 0)
|
||||||
record.Data[boosID].Line = 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 {
|
if record.Data[boosID].Maxnandu < difficulty {
|
||||||
record.Data[boosID].Maxnandu = difficulty
|
record.Data[boosID].Maxnandu = difficulty
|
||||||
} else {
|
} else {
|
||||||
@ -182,6 +186,7 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
record.Data[boosID].Huihe[difficulty] = huihe
|
record.Data[boosID].Huihe[difficulty] = huihe
|
||||||
record.Data[boosID].Line[difficulty] = line
|
record.Data[boosID].Line[difficulty] = line
|
||||||
update["data"] = record.Data
|
update["data"] = record.Data
|
||||||
|
Loading…
Reference in New Issue
Block a user