diff --git a/modules/plunder/api_getlist.go b/modules/plunder/api_getlist.go index 9eb100664..c0767fd2c 100644 --- a/modules/plunder/api_getlist.go +++ b/modules/plunder/api_getlist.go @@ -113,11 +113,12 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { uinfo := comm.GetUserBaseInfo(user) if !reflect.DeepEqual(uinfo, list.Uinfo) { + list.Uinfo = uinfo update["uinfo"] = uinfo // 同步岛屿上的信息 var lock *redis.RedisMutex lock, err = this.module.modelLand.landMutexLock(list.Landid) - lock.Lock() + err = lock.Lock() if err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, @@ -128,16 +129,16 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe } defer lock.Unlock() - for _, v := range land.Uinfo { - if v == list.Uinfo { - v = uinfo + for pos, v := range land.Uinfo { + if v.Uid == uinfo.Uid { + land.Uinfo[pos] = uinfo this.module.modelLand.changePlunderLandData(list.Landid, map[string]interface{}{ "uinfo": land.Uinfo, }) break } } - list.Uinfo = uinfo + } } if len(update) > 0 { diff --git a/modules/plunder/model_plunder.go b/modules/plunder/model_plunder.go index 12815d4b5..867034ab0 100644 --- a/modules/plunder/model_plunder.go +++ b/modules/plunder/model_plunder.go @@ -1,6 +1,7 @@ package plunder import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/mgo" @@ -75,6 +76,10 @@ func (this *modelPlunder) getPlunderData(session comm.IUserSession) (info *pb.DB this.module.Errorln(err) return } + if user.Name == "" { // 临时处理没创角不让进 后面走功能开启配置 + err = fmt.Errorf("getPlunderData need create ") + return + } info = &pb.DBPlunder{ Id: primitive.NewObjectID().Hex(), Uid: session.GetUserId(),