没创角 不创建掠夺数据

This commit is contained in:
meixiongfeng 2024-02-07 14:58:01 +08:00
parent abc9861335
commit f5a253f6ab
2 changed files with 11 additions and 5 deletions

View File

@ -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 {

View File

@ -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(),