package org.jeecg.modules.api.controller2;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiBean.PageBean;
import org.jeecg.modules.apiService.ScoreService;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags="积分信息相关接口")
@RestController
@RequestMapping("/employ/score")
@Slf4j
public class ScoreController {

    /******************************************************************************************************************/
    //积分信息
    @Resource
    private ScoreService scoreService;
    /******************************************************************************************************************/

    //会员中心-我的积分
    @ApiOperation(value="会员中心-我的积分", notes="会员中心-我的积分")
    @RequestMapping(value = "/queryScore", method = {RequestMethod.GET})
    public Result<?> queryScore(@RequestHeader("X-Access-Token") String token){
        return scoreService.queryScore(token);
    }

    //会员中心-积分记录
    @ApiOperation(value="会员中心-积分记录", notes="type：0-收入 1-消耗")
    @RequestMapping(value = "/queryScoreRecord", method = {RequestMethod.GET})
    public Result<?> queryScoreRecord(@RequestHeader("X-Access-Token") String token, String type, PageBean pageBean){
        return scoreService.queryScoreRecord(token, type, pageBean);
    }

    //我的服务-获取积分-邀请工友获取积分
    @ApiOperation(value="我的服务-获取积分-邀请工友获取积分", notes="我的服务-获取积分-邀请工友获取积分")
    @RequestMapping(value = "/addScoreByShare", method = {RequestMethod.POST})
    public Result<?> addScoreByShare(@RequestHeader("X-Access-Token") String token, String score){
        return scoreService.addScoreByShare(token, score);
    }

    //我的服务-获取积分-每日签到获取积分
    @ApiOperation(value="我的服务-获取积分-每日签到获取积分", notes="我的服务-获取积分-每日签到获取积分")
    @RequestMapping(value = "/addScoreBySign", method = {RequestMethod.POST})
    public Result<?> addScoreBySign(@RequestHeader("X-Access-Token") String token){
        return scoreService.addScoreBySign(token);
    }

    //我的服务-获取积分-每日签到获取积分
    @ApiOperation(value="是否已签到-已签(true)/未签(false)", notes="是否已签到-已签(true)/未签(false)")
    @RequestMapping(value = "/judgeSign", method = {RequestMethod.GET})
    public Boolean judgeSign(@RequestHeader("X-Access-Token") String token){
        return scoreService.judgeSign(token);
    }

}
