package trade_analysis

import (
	"github.com/gin-gonic/gin"
	"hongze/hongze_yb/controller/response"
	model "hongze/hongze_yb/models/tables/trade_analysis"
	"hongze/hongze_yb/services/trade_analysis"
)

// GetClassifyName 获取交易所合约列表
func GetClassifyName(c *gin.Context) {
	//userinfo := userService.GetInfoByClaims(c)
	list, err, errMsg := trade_analysis.GetClassifyName()
	if err !=nil {
		response.FailMsg(errMsg, err.Error(), c)
		return
	}

	response.OkData("获取成功", list, c)
}

// GetPositionTop 获取合约榜单详情
func GetPositionTop(c *gin.Context) {
	var req model.GetPositionTopReq
	if err := c.Bind(&req); err != nil {
		response.Fail("参数有误", c)
		return
	}
	if req.ClassifyName == "" {
		response.Fail("请输入分类名称", c)
		return
	}
	if req.ClassifyType == "" {
		response.Fail("请输入合约名称", c)
		return
	}

	//userinfo := userService.GetInfoByClaims(c)
	list, err, errMsg := trade_analysis.GetPositionTopDetail(req)
	if err !=nil {
		response.FailMsg(errMsg, err.Error(), c)
		return
	}

	response.OkData("获取成功", list, c)
}
