package mainline import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) //参数校验 func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.MainlineGetRewardReq) (code pb.ErrorCode) { if req.ChapterObj == "" { code = pb.ErrorCode_ReqParameterError } return } ///获取主线关卡信息 func (this *apiComp) GetReward(session comm.IUserSession, req *pb.MainlineGetRewardReq) (code pb.ErrorCode, data proto.Message) { rsp := &pb.MainlineGetRewardResp{} code = this.GetRewardCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 } _obj := this.module.modelMainline.getOneChapterInfo(session.GetUserId(), req.ChapterObj) if _obj != nil { code = pb.ErrorCode_DBError return } rsp.Data = _obj session.SendMsg(string(this.module.GetType()), MainlineGetRewardResp, rsp) return }