@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); }
@Override public List<Map<String, Object>> queryInputStat(Date from, Date to) { ClientContext context = ClientContext.getCurrentContext(); return captchaService.queryInputStat(context.getClientId(), from, to); }