Prechádzať zdrojové kódy

更新SWAGGER;修改BUG

Simon Zhou 5 rokov pred
rodič
commit
5eff07e648
4 zmenil súbory, kde vykonal 16 pridanie a 33 odobranie
  1. 16 9
      controllers/common/table.go
  2. 0 10
      docs/docs.go
  3. 0 10
      docs/swagger.json
  4. 0 4
      docs/swagger.yaml

+ 16 - 9
controllers/common/table.go

@@ -70,7 +70,6 @@ type OperationTabMenu struct {
 // QueryTraderMenu 查询交易端菜单
 // @Summary 查询交易端菜单
 // @Produce json
-// @Security ApiKeyAuth
 // @Param loginid query int true "登录账号"
 // @Success 200 {object} QueryTraderMenuRsp
 // @Failure 500 {object} app.Response
@@ -148,9 +147,10 @@ func getQuoteMenu(loginID int) ([]QuotePrimaryMenu, error) {
 	// 构建一级菜单对象
 	for i, v := range datas {
 		quotePrimaryMenu := QuotePrimaryMenu{
-			Index: i,
-			Key:   v.Columnfield,
-			Name:  v.Columntitle,
+			Index:    i,
+			Key:      v.Columnfield,
+			Name:     v.Columntitle,
+			SubMenus: make([]QuoteSecondaryMenu, 0),
 		}
 		// 跳过自选
 		if v.Columnfield == "optional" {
@@ -161,8 +161,15 @@ func getQuoteMenu(loginID int) ([]QuotePrimaryMenu, error) {
 		quotePrimaryMenu.SubTitleType, _ = strconv.Atoi(v.Formatterstring)
 		quotePrimaryMenu.TradeModes = v.Remark
 
+		// 如果传入的LoginID获取不到有权限的市场ID列表(有可能LoginID是错误的),则不构建二级子菜单
+		if len(marketIDs) == 0 {
+			rst = append(rst, quotePrimaryMenu)
+			continue
+		}
+
 		// 构建二级子菜单对象
 		marketIDsStr := utils.JoinItoString(marketIDs, ",")
+
 		if quotePrimaryMenu.SubTitleType == 0 {
 			// 获取目标交易模式的市场信息
 			markets := make([]models.Market, 0)
@@ -172,10 +179,11 @@ func getQuoteMenu(loginID int) ([]QuotePrimaryMenu, error) {
 			// 使用市场名称
 			for mi, mv := range markets {
 				quoteSecondaryMenu := QuoteSecondaryMenu{
-					Index:     mi,
-					MarketID:  int(mv.Marketid),
-					TradeMode: int(mv.Trademode),
-					MenuTitle: mv.Marketname,
+					Index:         mi,
+					MarketID:      int(mv.Marketid),
+					TradeMode:     int(mv.Trademode),
+					MenuTitle:     mv.Marketname,
+					GoodsGroupIDs: make([]int, 0),
 				}
 				quotePrimaryMenu.SubMenus = append(quotePrimaryMenu.SubMenus, quoteSecondaryMenu)
 			}
@@ -280,7 +288,6 @@ type QueryTableColumnConfigReq struct {
 // QueryTableColumnConfig 查询交易端列表头信息
 // @Summary 查询交易端列表头信息
 // @Produce json
-// @Security ApiKeyAuth
 // @Param TableKey query string false "表key"
 // @Success 200 {object} models.Tablecolumnconfig
 // @Failure 500 {object} app.Response

+ 0 - 10
docs/docs.go

@@ -371,11 +371,6 @@ var doc = `{
         },
         "/Common/QueryTableColumnConfig": {
             "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
                 "produces": [
                     "application/json"
                 ],
@@ -409,11 +404,6 @@ var doc = `{
         },
         "/Common/QueryTraderMenu": {
             "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
                 "produces": [
                     "application/json"
                 ],

+ 0 - 10
docs/swagger.json

@@ -355,11 +355,6 @@
         },
         "/Common/QueryTableColumnConfig": {
             "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
                 "produces": [
                     "application/json"
                 ],
@@ -393,11 +388,6 @@
         },
         "/Common/QueryTraderMenu": {
             "get": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
                 "produces": [
                     "application/json"
                 ],

+ 0 - 4
docs/swagger.yaml

@@ -1466,8 +1466,6 @@ paths:
           description: Internal Server Error
           schema:
             $ref: '#/definitions/app.Response'
-      security:
-      - ApiKeyAuth: []
       summary: 查询交易端列表头信息
       tags:
       - 通用
@@ -1490,8 +1488,6 @@ paths:
           description: Internal Server Error
           schema:
             $ref: '#/definitions/app.Response'
-      security:
-      - ApiKeyAuth: []
       summary: 查询交易端菜单
       tags:
       - 通用