Procházet zdrojové kódy

增加“获取所有外部交易所信息”接口

zhou.xiaoning před 4 roky
rodič
revize
f2d02b7f94
6 změnil soubory, kde provedl 6177 přidání a 5161 odebrání
  1. 24 0
      controllers/market/market.go
  2. 2620 2509
      docs/docs.go
  3. 2620 2509
      docs/swagger.json
  4. 900 143
      docs/swagger.yaml
  5. 11 0
      models/market.go
  6. 2 0
      routers/router.go

+ 24 - 0
controllers/market/market.go

@@ -127,3 +127,27 @@ func QueryGoodsesByLoginID(c *gin.Context) {
 	logger.GetLogger().Debugln("QueryGoodsesByLoginID successed: %v", goodses)
 	appG.Response(http.StatusOK, e.SUCCESS, goodses)
 }
+
+// GetAllExExchanges 获取所有外部交易所信息
+// @Summary 获取所有外部交易所信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Success 200 {object} models.Goods
+// @Failure 500 {object} app.Response
+// @Router /Market/GetAllExExchanges [get]
+// @Tags 通用市场
+func GetAllExExchanges(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	rst, err := models.GetAllExExchanges()
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("GetAllExExchanges failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Debugln("GetAllExExchanges successed: %v", rst)
+	appG.Response(http.StatusOK, e.SUCCESS, rst)
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2620 - 2509
docs/docs.go


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2620 - 2509
docs/swagger.json


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 900 - 143
docs/swagger.yaml


+ 11 - 0
models/market.go

@@ -462,3 +462,14 @@ func GetExExchangeByIDs(exchangeIDs []int) ([]Externalexchange, error) {
 
 	return exExchanges, nil
 }
+
+// GetAllExExchanges 获取所有外部交易所信息
+func GetAllExExchanges() ([]Externalexchange, error) {
+	exExchanges := make([]Externalexchange, 0)
+
+	if err := db.GetEngine().Find(&exExchanges); err != nil {
+		return nil, err
+	}
+
+	return exExchanges, nil
+}

+ 2 - 0
routers/router.go

@@ -133,6 +133,8 @@ func InitRouter() *gin.Engine {
 		marketR.GET("/QueryMarketsByLoginID", market.QueryMarketsByLoginID)
 		// 获取登录账号有权限的商品信息
 		marketR.GET("/QueryGoodsesByLoginID", market.QueryGoodsesByLoginID)
+		// 获取所有外部交易所信息
+		marketR.GET("/GetAllExExchanges", market.GetAllExExchanges)
 	}
 	// ************************ 通用单据 ************************
 	orderR := apiR.Group("Order")

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů