package rtask import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) func (this *apiComp) ChooseCheck(session comm.IUserSession, req *pb.RtaskChooseReq) (code pb.ErrorCode) { return } func (this *apiComp) Choose(session comm.IUserSession, req *pb.RtaskChooseReq) (code pb.ErrorCode, data proto.Message) { if code = this.ChooseCheck(session, req); code != pb.ErrorCode_Success { return } rtask := &pb.DBRtask{} if err := this.moduleRtask.modelRtask.Get(session.GetUserId(), rtask); err != nil { return } // 是否已完成 if _, ok := utils.Findx(rtask.FrtaskIds, req.RtaskId); !ok { code = pb.ErrorCode_RtaskUnFinished return } // 获取当前任务配置 conf := this.moduleRtask.configure.getRtaskById(req.RtaskId) if conf == nil { code = pb.ErrorCode_ConfigNoFound return } // var nextTaskId int32 if req.ChooseId == 0 { //读任务配置中的next taskId // nextTaskId = conf.IdAfter } else { // nextTaskId = } //发奖励 code = this.moduleRtask.DispenseRes(session, conf.Reword, true) rsp := &pb.RtaskChooseResp{} if err := session.SendMsg(string(this.moduleRtask.GetType()), RtaskSubTypeChoose, rsp); err != nil { code = pb.ErrorCode_SystemError } return }