51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package pagoda
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.PagodaGetListReq) (code pb.ErrorCode) {
|
|
|
|
return
|
|
}
|
|
|
|
///获取主线关卡信息
|
|
func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq) (code pb.ErrorCode, data proto.Message) {
|
|
var (
|
|
list *pb.DBPagoda
|
|
)
|
|
this.GetListCheck(session, req)
|
|
expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
|
if err != nil {
|
|
code = pb.ErrorCode_DBError
|
|
return
|
|
}
|
|
list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId())
|
|
if !expand.CompletePagoda { // 普通塔
|
|
if list == nil { // redis没有数据
|
|
list = &pb.DBPagoda{}
|
|
list.Id = primitive.NewObjectID().Hex()
|
|
|
|
list.Uid = session.GetUserId()
|
|
list.PagodaId = 0 // 初始数据0层
|
|
list.Type = comm.PagodaType
|
|
this.module.modelPagoda.addNewPagoda(session.GetUserId(), list)
|
|
}
|
|
} else {
|
|
season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
|
if season.Id == "" {
|
|
list.Complete = true
|
|
} else {
|
|
list = season
|
|
}
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list})
|
|
return
|
|
}
|