优化月之秘境代码
This commit is contained in:
parent
cf91bd07e2
commit
50145884f3
@ -69,7 +69,7 @@ func (this *apiComp) Ask(session comm.IUserSession, req *pb.MoonfantasyAskReq) (
|
||||
return
|
||||
}
|
||||
}
|
||||
if umfantasy, err = this.module.modelUserMF.QueryUsermfantasy(session.GetUserId()); err != nil {
|
||||
if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil {
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
return
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
|
||||
cd = pb.ErrorCode_MoonfantasyNoJoin
|
||||
return
|
||||
}
|
||||
if umfantasy, err = this.module.modelUserMF.QueryUsermfantasy(session.GetUserId()); err != nil {
|
||||
if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil {
|
||||
cd = pb.ErrorCode_CacheReadError
|
||||
}
|
||||
if umfantasy.BattleNum <= 0 {
|
||||
|
@ -21,7 +21,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.MoonfantasyGetLi
|
||||
umfantasy *pb.DBUserMFantasy
|
||||
mfantasys []*pb.DBMoonFantasy = make([]*pb.DBMoonFantasy, 0)
|
||||
)
|
||||
if umfantasy, err = this.module.modelUserMF.QueryUsermfantasy(session.GetUserId()); err != nil && err != mgo.MongodbNil {
|
||||
if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil && err != mgo.MongodbNil {
|
||||
code = pb.ErrorCode_CacheReadError
|
||||
return
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func (this *modelDreamComp) querymfantasy(mid string) (result *pb.DBMoonFantasy,
|
||||
///插叙用户秘境列表
|
||||
func (this *modelDreamComp) querymfantasys(mids []string) (fantasys []*pb.DBMoonFantasy, err error) {
|
||||
fantasys = make([]*pb.DBMoonFantasy, 0)
|
||||
if err = this.Gets(mids, fantasys); err != nil {
|
||||
if err = this.Gets(mids, &fantasys); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
return
|
||||
@ -109,7 +109,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession, source *pb.Battle
|
||||
this.module.Errorf("no found uer:%d", session.GetUserId())
|
||||
return
|
||||
}
|
||||
if umfantasy, err = this.module.modelUserMF.QueryUsermfantasy(session.GetUserId()); err != nil {
|
||||
if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil {
|
||||
return
|
||||
}
|
||||
if mdata, err = this.module.modelDream.addDreamData(&pb.UserInfo{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar}, boss); err != nil {
|
||||
|
@ -31,9 +31,9 @@ func (this *modelUserMF) Init(service core.IService, module core.IModule, comp c
|
||||
}
|
||||
|
||||
///查询用户秘境列表
|
||||
func (this *modelUserMF) QueryUsermfantasy(uId string) (fantasy *pb.DBUserMFantasy, err error) {
|
||||
func (this *modelUserMF) queryUsermfantasy(uId string) (fantasy *pb.DBUserMFantasy, err error) {
|
||||
fantasy = &pb.DBUserMFantasy{}
|
||||
if err = this.Get(uId, &fantasy); err != nil && err != mgo.MongodbNil {
|
||||
if err = this.Get(uId, fantasy); err != nil && err != mgo.MongodbNil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
if err == mgo.MongodbNil {
|
||||
|
Loading…
Reference in New Issue
Block a user