func (z *ZJGSUJudger) Submit(user vjudger.UserInterface) error { z.compile(user) if user.GetResult() != config.JudgeCE { user.SetResult(config.JudgeRJ) logger.Println("compile success") user.UpdateSolution() cmd := exec.Command("cp", "-r", dataPath+"/"+strconv.Itoa(user.GetVid()), runPath+"/"+strconv.Itoa(user.GetSid())) err := cmd.Run() if err != nil { log.Println(err) } } else { b, err := ioutil.ReadFile(z.workdir + "/ce.txt") if err != nil { log.Println(err) } log.Println(string(b)) user.SetErrorInfo(string(b)) logger.Println("compiler error") log.Println("compiler error") return ErrCompile } return nil }
//Get problem Info func (z *ZJGSUJudger) Login(user vjudger.UserInterface) error { proModel := &model.ProblemModel{} logger.Println(user.GetVid()) pro, _ := proModel.Detail(user.GetVid()) z.time = pro.Time z.mem = pro.Memory return nil }
func (z *ZJGSUJudger) Init(user vjudger.UserInterface) error { z.token = ZJGSUToken z.workdir = runPath + "/" + strconv.Itoa(user.GetSid()) + "/" + strconv.Itoa(user.GetVid()) logger.Println("workdir is ", z.workdir) log.Println(z.workdir) cmd := exec.Command("mkdir", "-p", z.workdir) cmd.Run() z.files(user, z.workdir) return nil }