Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
7d115768a5
@ -90,6 +90,7 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
||||
}
|
||||
preLv = dragon.Lv
|
||||
preType = conf.Type
|
||||
curType = conf.Type
|
||||
dragon.Exp += playConf.Exp // 加经验
|
||||
for {
|
||||
var addexp int32
|
||||
@ -106,13 +107,13 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
||||
dragon.Exp += addexp
|
||||
break
|
||||
}
|
||||
curType = conf.Type
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
update["exp"] = dragon.Exp
|
||||
update["lv"] = dragon.Lv
|
||||
curType = conf.Type
|
||||
curLv = dragon.Lv
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
|
@ -185,7 +185,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e
|
||||
session.SendMsg(string(this.module.GetType()), FriendSubTypeAgree, resp)
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.maincity.AddMainCityFriends(session.GetUserId(), req.FriendIds)
|
||||
//this.module.maincity.AddMainCityFriends(session.GetUserId(), req.FriendIds)
|
||||
if len(tasks) > 0 {
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -33,7 +33,7 @@ func NewModule() core.IModule {
|
||||
|
||||
type Friend struct {
|
||||
modules.ModuleBase
|
||||
maincity comm.IMainCity
|
||||
//maincity comm.IMainCity
|
||||
api *apiComp
|
||||
modelFriend *ModelFriend
|
||||
ModelFriendQiecuo *ModelFriendQiecuo
|
||||
@ -74,11 +74,11 @@ func (this *Friend) Start() (err error) {
|
||||
if this.globalConf == nil {
|
||||
err = errors.New("global config not found")
|
||||
}
|
||||
var module core.IModule
|
||||
if module, err = this.service.GetModule(comm.ModuleMaincity); err != nil {
|
||||
return
|
||||
}
|
||||
this.maincity = module.(comm.IMainCity)
|
||||
// var module core.IModule
|
||||
// if module, err = this.service.GetModule(comm.ModuleMaincity); err != nil {
|
||||
// return
|
||||
// }
|
||||
// this.maincity = module.(comm.IMainCity)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/event"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
@ -52,8 +51,8 @@ func (this *MainCity) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.sociaty = module.(comm.ISociaty)
|
||||
event.Register(comm.EventUserLogin, this.EventUserLogin)
|
||||
event.Register(comm.EventUserOffline, this.EventUserOffline)
|
||||
// event.Register(comm.EventUserLogin, this.EventUserLogin)
|
||||
// event.Register(comm.EventUserOffline, this.EventUserOffline)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -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(),
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
|
@ -131,7 +131,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
this.module.maincity.AddMainCityFriends(req.Uid, uids)
|
||||
//this.module.maincity.AddMainCityFriends(req.Uid, uids)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ var _ comm.ISociaty = (*Sociaty)(nil)
|
||||
|
||||
type Sociaty struct {
|
||||
modules.ModuleBase
|
||||
maincity comm.IMainCity
|
||||
//maincity comm.IMainCity
|
||||
api *apiComp
|
||||
service base.IRPCXService
|
||||
modelSociaty *ModelSociaty
|
||||
@ -89,11 +89,11 @@ func (this *Sociaty) Start() (err error) {
|
||||
if err = this.checkSociatyConf(); err != nil {
|
||||
return err
|
||||
}
|
||||
var module core.IModule
|
||||
if module, err = this.service.GetModule(comm.ModuleMaincity); err != nil {
|
||||
return
|
||||
}
|
||||
this.maincity = module.(comm.IMainCity)
|
||||
// var module core.IModule
|
||||
// if module, err = this.service.GetModule(comm.ModuleMaincity); err != nil {
|
||||
// return
|
||||
// }
|
||||
// this.maincity = module.(comm.IMainCity)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,6 @@ import (
|
||||
"go_dreamfactory/modules/library"
|
||||
"go_dreamfactory/modules/linestory"
|
||||
"go_dreamfactory/modules/mail"
|
||||
"go_dreamfactory/modules/maincity"
|
||||
"go_dreamfactory/modules/mainline"
|
||||
"go_dreamfactory/modules/monkey"
|
||||
"go_dreamfactory/modules/moonfantasy"
|
||||
@ -186,7 +185,7 @@ func main() {
|
||||
jielong.NewModule(),
|
||||
entertainment.NewModule(),
|
||||
dcolor.NewModule(),
|
||||
maincity.NewModule(),
|
||||
//maincity.NewModule(),
|
||||
treasuremap.NewModule(),
|
||||
gameinvite.NewModule(),
|
||||
caninerabbit.NewModule(),
|
||||
|
Loading…
Reference in New Issue
Block a user