package com.yihu.wlyy.web.common.advert;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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.yihu.wlyy.service.common.advert.AdvertService;
import com.yihu.wlyy.web.BaseController;

@Controller
@RequestMapping(value = "common", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "广告")
public class AdvertController extends BaseController {
	
	@Autowired
	private AdvertService advertService;


	@RequestMapping(value = "advert")
	@ResponseBody
	public String list(int type) {
		try {
			return write(200, "查询成功", "list" , advertService.findByType(type));
		} catch (Exception e) {
			error(e);
			return error(-1, "查询失败");
		}
	}
}
