package com.buy507.mall.controller;

import java.util.List;

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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.buy507.mall.common.api.CommonResult;
import com.buy507.mall.dto.MemberMonthRewardResult;
import com.buy507.mall.service.UmsMemberMonthRewardService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 会员月度奖励Controller
 */
@Controller
@Api(tags = "UmsMemberMonthRewardController", description = "会员月度奖励管理")
@RequestMapping("/member/monthReward")
public class UmsMemberMonthRewardController {
	
	@Autowired
	private UmsMemberMonthRewardService service;
	
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation("查询会员的月度奖励")
    @ResponseBody
    public CommonResult<List<MemberMonthRewardResult>> list(@RequestParam Integer month, @RequestParam(required = false) String nickname) {
    	
    	return CommonResult.success(service.list(nickname, month));
    }
    
    @RequestMapping(value = "/compute", method = RequestMethod.POST)
    @ApiOperation("计算会员的月度奖励")
    @ResponseBody
    public CommonResult<String> computeMonthReward(@RequestParam Integer month) {
    	
    	return service.computeMonthReward(month);
       
    }
    
}
