Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
7452b09940
@ -96,10 +96,12 @@ func (this *Library) GetLibraryListByHid(uid string, hid string) *pb.DBLibrary {
|
||||
|
||||
//
|
||||
func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibrary, fetter []*pb.DBHeroFetter) {
|
||||
|
||||
var (
|
||||
oid *pb.DBHeroFetter
|
||||
)
|
||||
oid = this.CheckHeroFetter(uid, hid) // 校验羁绊数据
|
||||
szFid := this.configure.GetHeroFetterID(hid)
|
||||
for fid := range szFid {
|
||||
|
||||
if list := this.GetLibraryListByFid(uid, fid); list == nil { // 没有这条羁绊数据
|
||||
tmp := &pb.DBLibrary{ // 创建一条羁绊数据
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
@ -109,9 +111,9 @@ func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibr
|
||||
Prize: map[int32]int32{},
|
||||
}
|
||||
|
||||
if _d := this.CheckHeroFetter(uid, hid); _d != nil { // check DBHeroFetter
|
||||
tmp.Herofetter[hid] = _d.Id
|
||||
fetter = append(fetter, _d)
|
||||
if oid != nil { // check DBHeroFetter
|
||||
tmp.Herofetter[hid] = oid.Id
|
||||
fetter = append(fetter, oid)
|
||||
}
|
||||
|
||||
if err := this.modelLibrary.createLibrary(uid, tmp); err != nil {
|
||||
@ -120,11 +122,10 @@ func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibr
|
||||
}
|
||||
dbLibrary = append(dbLibrary, tmp)
|
||||
} else { // 有这条羁绊数据
|
||||
|
||||
if _, ok := list.Herofetter[hid]; !ok {
|
||||
if _d := this.CheckHeroFetter(uid, hid); _d != nil {
|
||||
list.Herofetter[hid] = _d.Id
|
||||
fetter = append(fetter, _d)
|
||||
if oid != nil {
|
||||
list.Herofetter[hid] = oid.Id
|
||||
fetter = append(fetter, oid)
|
||||
}
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["herofetter"] = list.Herofetter
|
||||
|
Loading…
Reference in New Issue
Block a user