go_dreamfactory/modules/moonfantasy/api_getlist.go
2022-10-12 12:34:23 +08:00

38 lines
1016 B
Go

package moonfantasy
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetlistCheck(session comm.IUserSession, req *pb.MoonfantasyGetListReq) (code pb.ErrorCode) {
return
}
///获取用户装备列表
func (this *apiComp) Getlist(session comm.IUserSession, req *pb.MoonfantasyGetListReq) (code pb.ErrorCode, data proto.Message) {
var (
err error
umfantasy *pb.DBUserMFantasy
mfantasys []*pb.DBMoonFantasy = make([]*pb.DBMoonFantasy, 0)
)
if umfantasy, err = this.module.modelUserMF.QueryUsermfantasy(session.GetUserId()); err != nil && err != mgo.MongodbNil {
code = pb.ErrorCode_CacheReadError
return
}
if len(umfantasy.Mfantasys) > 0 {
mfantasys, err = this.module.modelDream.querymfantasys(umfantasy.Mfantasys)
}
session.SendMsg(string(this.module.GetType()), "getlist", &pb.MoonfantasyGetListResp{
BattleNum: umfantasy.BattleNum,
Dfantasys: mfantasys,
})
return
}