34 lines
949 B
Go
34 lines
949 B
Go
package rtask
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/pb"
|
|
|
|
"github.com/pkg/errors"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
func (this *apiComp) RtestCheck(session comm.IUserSession, req *pb.RtaskTestReq) (code pb.ErrorCode) {
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (code pb.ErrorCode, data proto.Message) {
|
|
rsp := &pb.RtaskTestResp{Flag: true}
|
|
if req.CondiId != 0 {
|
|
if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), req.CondiId); !ok {
|
|
rsp.Flag = false
|
|
log.Errorf("%v", errors.WithMessage(err, session.GetUserId()))
|
|
}
|
|
} else {
|
|
if code = this.moduleRtask.SendToRtask(session, comm.TaskType(req.RtaskType), req.Params...); code != pb.ErrorCode_Success {
|
|
rsp.Flag = false
|
|
}
|
|
}
|
|
|
|
if err := session.SendMsg(string(this.moduleRtask.GetType()), "rtest", rsp); err != nil {
|
|
code = pb.ErrorCode_SystemError
|
|
}
|
|
return
|
|
}
|