go_dreamfactory/modules/mline/api_getlist.go
2023-01-06 12:02:46 +08:00

39 lines
860 B
Go

package mline
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.MlineGetListReq) (code pb.ErrorCode) {
return
}
///获取主线关卡信息
func (this *apiComp) GetList(session comm.IUserSession, req *pb.MlineGetListReq) (code pb.ErrorCode, data proto.Message) {
rsp := &pb.MlineGetListResp{}
code = this.GetListCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
list, err := this.module.modelMline.getMainlineList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
for _, v := range list {
if v.CType == req.CType {
rsp.Data = append(rsp.Data, v)
}
}
session.SendMsg(string(this.module.GetType()), MlineGetListResp, rsp)
return
}