package io.renren.application.common.controller;

import io.renren.application.common.dto.ChaoXiangParamDto;
import io.renren.application.common.dto.ChaoXiangTimeDto;
import io.renren.application.common.service.SysPublicParamService;
import io.renren.application.common.vo.ChaoXiangParamVo;
import io.renren.application.common.vo.Results;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/chaoXiang/")
@Api(tags = "超翔相关",value = "超翔相关")
@RequiredArgsConstructor
public class ChaoXiangController {

    final SysPublicParamService sysPublicParamService;

    @PostMapping("/modeifyWeekParam")
    public Results modeifyParam(@RequestBody ChaoXiangParamDto dto){
        return sysPublicParamService.modeifyParam(dto);
    }

    @GetMapping("/getAllWeekParam")
    public Results<ChaoXiangParamVo> getAllWeekParam(){
        return sysPublicParamService.getAllWeekParam();
    }

    @GetMapping("/getWeekParam")
    public Results<String> getWeekParam(){
        return sysPublicParamService.getWeekParam();
    }

    @GetMapping("/getAdsTime")
    public Results<Integer> getAdsTime(){
        return sysPublicParamService.getAdsTime();
    }

    @PostMapping("/modifyAdsTime")
    public Results modifyAdsTime(@RequestBody ChaoXiangTimeDto dto){
        return sysPublicParamService.modifyAdsTime(dto);
    }
    @GetMapping("/hasStock")
    @ApiOperation("查询领券库存情况 data>0 有库存看广告 data=0 不看广告 data<0 无库存 ")
    public Results hasStock(Integer checkTime){
        return sysPublicParamService.hasStock(checkTime);
    }
}
