#45032 任务 【梦工场系统】 <-前端-> 【掠夺】 - 玩家姓名丢失

This commit is contained in:
meixiongfeng 2024-02-01 11:18:42 +08:00
parent 8fabb4a0fc
commit dff9353ec8
7 changed files with 51 additions and 5 deletions

View File

@ -48,6 +48,9 @@ func (this *ModelFriend) GetFriend(uid string) (info *pb.DBFriend, err error) {
this.moduole.Errorln(err)
return
}
if !user.Created {
return
}
info = &pb.DBFriend{
Id: primitive.NewObjectID().Hex(),
Uid: uid,
@ -79,6 +82,9 @@ func (this *ModelFriend) GetFriend(uid string) (info *pb.DBFriend, err error) {
this.moduole.Errorln(err)
return
}
if !user.Created {
return
}
info = &pb.DBFriend{
Id: primitive.NewObjectID().Hex(),
Uid: uid,

View File

@ -116,7 +116,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha
}
return
}
if lock, err = this.module.modelLand.landMutexLock(list.Landid); err != nil {
lock, err = this.module.modelLand.landMutexLock(list.Landid)
lock.Lock()
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),

View File

@ -4,9 +4,11 @@ import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"go_dreamfactory/utils"
"reflect"
"go.mongodb.org/mongo-driver/bson"
)
@ -103,6 +105,36 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
update["ctime"] = list.Ctime
update["freecount"] = list.Freecount
}
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
uinfo := comm.GetUserBaseInfo(user)
if !reflect.DeepEqual(uinfo, list.Uinfo) {
update["uinfo"] = uinfo
// 同步岛屿上的信息
var lock *redis.RedisMutex
lock, err = this.module.modelLand.landMutexLock(list.Landid)
lock.Lock()
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
defer lock.Unlock()
for _, v := range land.Uinfo {
if v == list.Uinfo {
v = uinfo
this.module.modelLand.changePlunderLandData(list.Landid, map[string]interface{}{
"uinfo": land.Uinfo,
})
break
}
}
list.Uinfo = uinfo
}
}
if len(update) > 0 {
this.module.modelPlunder.changePlunderData(session.GetUserId(), update)
}

View File

@ -66,7 +66,9 @@ func (this *apiComp) PvpChallenge(session comm.IUserSession, req *pb.PlunderPvpC
return
}
if lock, err = this.module.modelLand.landMutexLock(list.Landid); err != nil {
lock, err = this.module.modelLand.landMutexLock(list.Landid)
lock.Lock()
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),

View File

@ -46,7 +46,9 @@ func (this *apiComp) PvpChallengeOver(session comm.IUserSession, req *pb.Plunder
}
return
}
if lock, err = this.module.modelLand.landMutexLock(list.Landid); err != nil {
lock, err = this.module.modelLand.landMutexLock(list.Landid)
lock.Lock()
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),

View File

@ -46,7 +46,9 @@ func (this *apiComp) Reach(session comm.IUserSession, req *pb.PlunderReachReq) (
}
return
}
if lock, err = this.module.modelLand.landMutexLock(list.Landid); err != nil {
lock, err = this.module.modelLand.landMutexLock(list.Landid)
lock.Lock()
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),

View File

@ -169,7 +169,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
if user.Name != "" { // 没创角就没必要通知
if !user.Created { // 没创角就没必要通知
event.TriggerEvent(comm.EventUserLogin, session)
}