package com.wechat.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wechat.global.message.InfoMsg;
import com.wechat.model.responseDto.ResultEntity;
import com.wechat.service.CaptchaService;

@Controller
@RequestMapping("captcha")
public class CaptchaController {

	@Autowired
	private CaptchaService captchaService;

	/**
	 * 获取图形验证码
	 * 
	 * @param response
	 * @return
	 * @throws IOException
	 */
	@RequestMapping(value = "getNext", method = RequestMethod.GET)
	@ResponseBody
	public ResultEntity<String> next(HttpServletResponse response) throws IOException {
		
		return new ResultEntity<String>(InfoMsg.SUCCESS_REQUEST,captchaService.next(response));
	}
}
