package trade_analysis import ( "eta/eta_api/controllers" "eta/eta_api/models" trade_analysisModel "eta/eta_api/models/data_manage/trade_analysis" "eta/eta_api/services/data/trade_analysis" ) // TradeAnalysisController 供应分析 type TradeAnalysisController struct { controllers.BaseAuthController } // GetClassifyName // @Title 获取交易所合约列表 // @Description 获取交易所合约列表 // @Param request body saModel.SaCompareSaveReq true "type json string" // @Success 200 {object} trade_analysis.TradeClassifyNameListSort // @router /classify [get] func (c *TradeAnalysisController) GetClassifyName() { br := new(models.BaseResponse).Init() defer func() { if br.ErrMsg == "" { br.IsSendEmail = false } c.Data["json"] = br c.ServeJSON() }() //userinfo := userService.GetInfoByClaims(c) list, err, errMsg := trade_analysis.GetClassifyName() if err != nil { br.Msg = errMsg br.ErrMsg = "获取失败, ErrMsg: " + err.Error() return } br.Data = list br.Ret = 200 br.Success = true br.Msg = "获取成功" } // GetPositionTop // @Title 获取合约榜单详情 // @Description 获取合约榜单详情 // @Param Exchange query string false "交易所" // @Param ClassifyName query string false "分类名称" // @Param ClassifyType query string false "具体合约名称" // @Param DataTime query string false "请求日期,如果为空,则返回最新的榜单日期" // @Success 200 {object} trade_analysis.GetPositionTopResp // @Success 200 Ret=200 操作成功 // @router /top [get] func (c *TradeAnalysisController) GetPositionTop() { br := new(models.BaseResponse).Init() defer func() { if br.ErrMsg == "" { br.IsSendEmail = false } c.Data["json"] = br c.ServeJSON() }() req := trade_analysisModel.GetPositionTopReq{ Exchange: c.GetString("Exchange"), ClassifyName: c.GetString("ClassifyName"), ClassifyType: c.GetString("ClassifyType"), DataTime: c.GetString("DataTime"), } if req.ClassifyName == "" { br.Msg = "请输入分类名称" br.IsSendEmail = false return } if req.ClassifyType == "" { br.Msg = "请输入合约名称" br.IsSendEmail = false return } list, err, errMsg := trade_analysis.GetPositionTopDetail(req) if err != nil { br.Msg = errMsg br.ErrMsg = err.Error() return } br.Data = list br.Ret = 200 br.Success = true return }