package com.goafanti.admin.controller;


import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.goafanti.admin.service.NoticeService;
import com.goafanti.common.bo.Result;
import com.goafanti.common.controller.CertifyApiController;

@RestController
@RequestMapping(value = "/api/admin/notice")
public class AdminNoticeApiController extends CertifyApiController{
	
	@Resource
	private NoticeService noticeService;
	
	/**
	 * 未读通知数量
	 * @return
	 */
	@RequestMapping(value = "/unreadCount", method = RequestMethod.GET)
	public Result unreadCount(){
		Result res = new Result();
		res.setData(noticeService.findUnreadNoticeCount());
		return res;
	}
	
	/**
	 * 
	 * 未读通知列表
	 * @return
	 */
	@RequestMapping(value = "/unread", method = RequestMethod.GET)
	public Result unread(Integer type){
		Result res = new Result();
		res.setData(noticeService.updateListUnreadNoticeByAid());
		return res;
	}
	
	/**
	 * 
	 * 未读通知列表
	 * @return
	 */
	@RequestMapping(value = "/publicReleaseUnread", method = RequestMethod.GET)
	public Result publicReleaseUnread(){
		Result res = new Result();
		res.setData(noticeService.pushPublicReleaseUnread());
		return res;
	}
	
	/**
	 * 已读通知列表
	 * @return
	 */
	@RequestMapping(value = "/readed", method = RequestMethod.GET)
	public Result readed(Integer type,Integer pageNo, Integer pageSize){
		Result res = new Result();
		res.setData(noticeService.ListReadedNoticeByAid(type,pageNo, pageSize));
		return res;
	}
}
