package com.uas.platform.b2b.mobile.controller;

import com.uas.platform.b2b.mobile.service.MobileReleaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by dongbw
 * 17/03/28 9:09.
 */
@Controller("mobile.ReleaseController")
@RequestMapping(value = "/mobile/release")
public class ReleaseController {

    @Autowired
    private MobileReleaseService mobileReleaseService;

    /**
     * 获取消息条数
     *
     * @param vendUseruu
     * @param venduu
     * @return
     */
    @RequestMapping(value = "/count", method = RequestMethod.GET)
    @ResponseBody
    public ModelMap getReleaseCounts (Long vendUseruu, Long venduu) {
        return mobileReleaseService.getReleaseCounts(vendUseruu, venduu);
    }

    /**
     * 修改已经统计的消息状态
     *
     * @param ids
     * @return
     */
    @RequestMapping(value = "/count/back", method = RequestMethod.POST)
    @ResponseBody
    public void changeReleaseCounts (String ids) {
        mobileReleaseService.changeReleaseCounts(ids);
    }


    /**
     * 获取消息详细列表
     *
     * @param vendUseruu
     * @param venduu
     * @param type
     * @return
     */
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    @ResponseBody
    public ModelMap getReleaseDetails (Long vendUseruu, Long venduu, String type) {
        return mobileReleaseService.getReleaseDetails(vendUseruu, venduu, type);
    }

    /**
     * 修改已经获取的消息状态
     *
     * @param ids
     * @return
     */
    @RequestMapping(value = "/detail/back", method = RequestMethod.POST)
    @ResponseBody
    public ModelMap changeReleaseDetails (String ids) {
        return mobileReleaseService.changeReleaseDetails(ids);
    }

//    /**
//     *  推送消息
//     *
//     * @param vendUseruu
//     * @param vendUU
//     * @return
//     * @throws Exception
//     */
//    @RequestMapping(value = "/push", method = RequestMethod.POST)
//    @ResponseBody
//    public ResponseEntity<ModelMap> pushRelease (Long vendUseruu, Long vendUU) throws Exception {
//        return mobileReleaseService.pushRelease(vendUseruu, vendUU);
//    }

}
