package org.cs.ws.user.ctl;

import java.util.Map;

import org.cs.core.ctl.BaseCtl;
import org.cs.mgr.admin.service.ITbNewsService;
import org.cs.mgr.setting.service.ISysAdvService;
import org.cs.util.Pager;
import org.cs.ws.inteceptor.Valid;
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.alibaba.fastjson.JSONObject;

@Controller
@RequestMapping("/rest/adv")
public class AdvApi extends BaseCtl{

	@Autowired
	private ISysAdvService sysAdvService;
	
	@RequestMapping(value="/advList",method = RequestMethod.POST)
	@ResponseBody
	public String msgList(String data){
		Map<String, String> map = getMapFromJson(data);
		Integer page = Integer.valueOf(map.get("page"));
		Pager pageData = sysAdvService.getSysAdvs(new Pager(page));
		
		return JSONObject.toJSONString(getJson(1, pageData, "1"));
	}
	
}
