package com.jxy.marketall.controller;

import com.jxy.common.core.web.Result.AjaxResult;
import com.jxy.common.security.annotation.RequiresLogin;
import com.jxy.marketall.service.CoinPriceService;
import com.jxy.marketall.service.MarketallService;
import com.jxy.marketall.service.NDAQService;
import com.jxy.marketall.vo.CoinVo;
import com.jxy.marketall.vo.RequestVo;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description 统一请求接口
 * @Date 2022/5/27 9:54
 * @Author 杜懿
 */
@RestController
@RequestMapping("/list")
@Api(tags = "marketall接口")
public class MarketallController {

    @Autowired
    private MarketallService marketallService;


    @GetMapping("/interface")
    @ApiOperation(value = "interface",response = List.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "req", value = "具体接口名", dataType = "string", paramType = "query", required = true),
            @ApiImplicitParam(name = "radius", value = "查询范围", dataType = "string", paramType = "query", required = true),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult list(RequestVo requestVo){

        return  marketallService.findResultByRequestVo(requestVo);

    }


    @GetMapping("/coinmarket")
    @ApiOperation(value = "24小时币价查询",response = List.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "coin", value = " ", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false)})
    //@RequiresLogin
    public AjaxResult coinmarket(CoinVo coinVo){

        return  marketallService.findCoinMarketPrice(coinVo);

    }

    @GetMapping("/coinmarket/all")
    @ApiOperation(value = "币价当前市值排名    前一百",response = List.class)
    //@RequiresLogin
    public AjaxResult coinmarketAll(){

        return  marketallService.findCoinMarketAll();
    }
}
