|
|
@@ -377,6 +377,7 @@ func QueryHistoryTikDatas(c *gin.Context) {
|
|
|
// QueryTSDataReq 分时图数据查询请求参数
|
|
|
type QueryTSDataReq struct {
|
|
|
GoodsCode string `form:"goodsCode" binding:"required"` // 商品代码
|
|
|
+ MarketId int `form:"makretId"` // 关联市场ID
|
|
|
}
|
|
|
|
|
|
// QueryTSDataRsp 分时图数据查询返回模型
|
|
|
@@ -413,7 +414,8 @@ type TSDataRunStep struct {
|
|
|
// @Summary 分时图数据查询
|
|
|
// @Produce json
|
|
|
// @Security ApiKeyAuth
|
|
|
-// @Param goodsCode query string true "商品代码"
|
|
|
+// @Param goodsCode query string true "商品代码"
|
|
|
+// @Param makretId query int false "关联市场ID"
|
|
|
// @Success 200 {object} QueryTSDataRsp
|
|
|
// @Failure 500 {object} app.Response
|
|
|
// @Router /Quote/QueryTSData [get]
|
|
|
@@ -438,12 +440,23 @@ func QueryTSData(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
// 获取市场
|
|
|
- market, err := models.GetMarketByGoodsCode(req.GoodsCode)
|
|
|
- if err != nil {
|
|
|
- logger.GetLogger().Errorf("QueryTSData failed: %s", err.Error())
|
|
|
- appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
- return
|
|
|
+ var market *models.Market
|
|
|
+ if req.MarketId == 0 {
|
|
|
+ market, err = models.GetMarketByGoodsCode(req.GoodsCode)
|
|
|
+ if err != nil {
|
|
|
+ logger.GetLogger().Errorf("QueryTSData failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ market, err = models.GetMarket(req.MarketId)
|
|
|
+ if err != nil {
|
|
|
+ logger.GetLogger().Errorf("QueryTSData failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if market == nil {
|
|
|
logger.GetLogger().Error("QueryTSData failed: not found goodscode")
|
|
|
appG.Response(http.StatusBadRequest, e.ERROR_GET_MARKET_FAILED, nil)
|