获取图片验证码
1 /** 2 * 获取图片验证码 3 * 4 * @return ResultModel<JSONObject> 5 * @author zh 6 * @date 2019-09-02 7 */ 8 @ApiOperation("获取图片验证码") 9 @GetMapping("getCodeImg") 10 public ResultModel<JSONObject> getCodeImg(HttpServletResponse response) { 11 response.setHeader("Access-Control-Allow-Origin", "*"); 12 13 String result = CodeImgCreator.getCodeImgString(); 14 String[] array = result.split("@"); 15 String imgString = array[0]; 16 String codeString = array[1]; 17 JSONObject object = new JSONObject(); 18 19 object.put("imgString", imgString); 20 object.put("codeString", codeString); 21 22 return ResultUtil.success(object, "查询成功"); 23 }