@Override public String getResult(Long id) { Captcha captcha = captchaService.get(id); if (captcha == null) { logger.warn("captcha's id not exists:" + id); return null; } if (!Captcha.TYPE_FINISH.equals(captcha.getType())) { return null; } return captcha.getResult(); }
@Override public Long postCaptcha(byte[] data, String typeStr, Long taskId, Integer seq) { CaptchaType type = CaptchaType.valueOf(typeStr); // TODO type是自动处理类型的处理 Captcha captcha = new Captcha(); captcha.setData(data); captcha.setType(type.type); captcha.setExpireTime(new Date(System.currentTimeMillis() + EXPIRED_TIME)); captcha.setPostClient(ClientContext.getCurrentContext().getClientId()); captcha.setTaskId(taskId); captcha.setSeq(seq); return captchaService.save(captcha); }