Ver código fonte

增加接口 /Market/GetMarketSections 查询新板块设置

zhou.xiaoning 2 anos atrás
pai
commit
7943ddc558

+ 6 - 6
config/config.xml

@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.88"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test132"/>
+    <DbUser value="mtp2_test204"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.132"/>
+    <Address value="192.168.31.204"/>
     <Port value="5007"/>
     <Timeout value="3"/>
     <ConnNum value="1"/>
@@ -25,11 +25,11 @@
     <Pwd value=""/>
   </RedisSetting>
   <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.132:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.31.204:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.132"/>
+    <HostName value="192.168.31.204"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.72"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test132"/>
-    <Username value="quote_test132"/>
+    <DBName value="historyquote_test204"/>
+    <Username value="quote_test204"/>
     <Password value="123456"/>
   </MySQLSetting>
   <Tencent>

+ 4 - 4
controllers/guangzuan/tradeService.go

@@ -18,8 +18,8 @@ import (
 // @Security Group
 // @Param    userid   query    int    true  "用户ID"
 // @Param    executestatus query    int false "执行状态 - 1:未生效 2:进行中 3:已结束"
-// @Param    page          query    int false "页码"
-// @Param    pagesize      query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200           {array}  models.GzcjjcorderM
 // @Failure  500     {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrder [get]
@@ -39,8 +39,8 @@ func QueryGZCJJCOrder(c *gin.Context) {
 // @Security Group
 // @Param    userid        query    int true  "用户ID"
 // @Param    orderid  query    string false "单据ID"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page          query    int false "页码"
+// @Param    pagesize      query    int false "每页条数"
 // @Success  200      {array}  models.GzcjjcorderdetailM
 // @Failure  500           {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrderDetail [get]

+ 26 - 3
controllers/market/market.go

@@ -153,13 +153,13 @@ type QueryMarketsByLoginIDReq struct {
 
 // QueryMarketsByLoginID 获取登录账号有权限的市场信息
 // @Summary  获取登录账号有权限的市场信息
-// @Produce  json
+// @Produce json
 // @Security ApiKeyAuth
 // @Param    loginID query    int true "登录账号"
 // @Success  200     {object} models.Market
 // @Failure  500     {object} app.Response
 // @Router   /Market/QueryMarketsByLoginID [get]
-// @Tags     通用市场
+// @Tags    通用市场
 func QueryMarketsByLoginID(c *gin.Context) {
 	appG := app.Gin{C: c}
 
@@ -229,7 +229,7 @@ func QueryGoodsesByLoginID(c *gin.Context) {
 // @Produce  json
 // @Security ApiKeyAuth
 // @Success  200 {object} models.Goods
-// @Failure  500 {object} app.Response
+// @Failure 500 {object} app.Response
 // @Router   /Market/GetAllExExchanges [get]
 // @Tags     通用市场
 func GetAllExExchanges(c *gin.Context) {
@@ -247,3 +247,26 @@ func GetAllExExchanges(c *gin.Context) {
 	logger.GetLogger().Debugln("GetAllExExchanges successed: %v", rst)
 	appG.Response(http.StatusOK, e.SUCCESS, rst)
 }
+
+// GetMarketSections 查询新板块设置
+// @Summary 查询新板块设置
+// @Produce  json
+// @Success 200 {array}  models.GetMarketSectionsRsp
+// @Failure  500 {object} app.Response
+// @Router  /Market/GetMarketSections [get]
+// @Tags     通用市场
+func GetMarketSections(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	rst, err := models.GetMarketSections()
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("GetMarketSections failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功返回
+	logger.GetLogger().Debugln("GetMarketSections successed: %v", rst)
+	appG.Response(http.StatusOK, e.SUCCESS, rst)
+}

+ 112 - 0
docs/docs.go

@@ -13386,6 +13386,34 @@ const docTemplate = `{
                 }
             }
         },
+        "/Market/GetMarketSections": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用市场"
+                ],
+                "summary": "查询新板块设置",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.GetMarketSectionsRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Market/QueryGoodsesByLoginID": {
             "get": {
                 "security": [
@@ -37536,6 +37564,65 @@ const docTemplate = `{
                 }
             }
         },
+        "models.GetMarketSectionsRsp": {
+            "type": "object",
+            "properties": {
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人ID",
+                    "type": "integer"
+                },
+                "creatorsrc": {
+                    "description": "创建人来源 - 1:管理端 2:终端 3:交易",
+                    "type": "integer"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "marketsectionconfignews": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.Marketsectionconfignew"
+                    }
+                },
+                "marketsectionid": {
+                    "description": "市场版块ID(SEQ_MARKETSECTION)",
+                    "type": "integer"
+                },
+                "marketsectionname": {
+                    "description": "市场版块名称",
+                    "type": "string"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "modifiersrc": {
+                    "description": "修改人来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "modifytime": {
+                    "description": "修改时间",
+                    "type": "string"
+                },
+                "orderindex": {
+                    "description": "排序",
+                    "type": "integer"
+                },
+                "pictureurl": {
+                    "description": "显示图片(90*90)",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                }
+            }
+        },
         "models.Goods": {
             "type": "object",
             "required": [
@@ -41309,6 +41396,31 @@ const docTemplate = `{
                 }
             }
         },
+        "models.Marketsectionconfignew": {
+            "type": "object",
+            "properties": {
+                "displayname": {
+                    "description": "显示名称",
+                    "type": "string"
+                },
+                "marketids": {
+                    "description": "市场IDs - 逗号分隔",
+                    "type": "string"
+                },
+                "marketsectionid": {
+                    "description": "市场版块ID(SEQ_MARKETSECTION)",
+                    "type": "integer"
+                },
+                "orderindex": {
+                    "description": "排序",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.Mduserswapprotocol": {
             "type": "object",
             "properties": {

+ 112 - 0
docs/swagger.json

@@ -13377,6 +13377,34 @@
                 }
             }
         },
+        "/Market/GetMarketSections": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用市场"
+                ],
+                "summary": "查询新板块设置",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.GetMarketSectionsRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Market/QueryGoodsesByLoginID": {
             "get": {
                 "security": [
@@ -37527,6 +37555,65 @@
                 }
             }
         },
+        "models.GetMarketSectionsRsp": {
+            "type": "object",
+            "properties": {
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "creatorid": {
+                    "description": "创建人ID",
+                    "type": "integer"
+                },
+                "creatorsrc": {
+                    "description": "创建人来源 - 1:管理端 2:终端 3:交易",
+                    "type": "integer"
+                },
+                "isvalid": {
+                    "description": "是否有效 - 0:无效 1:有效",
+                    "type": "integer"
+                },
+                "marketsectionconfignews": {
+                    "type": "array",
+                    "items": {
+                        "$ref": "#/definitions/models.Marketsectionconfignew"
+                    }
+                },
+                "marketsectionid": {
+                    "description": "市场版块ID(SEQ_MARKETSECTION)",
+                    "type": "integer"
+                },
+                "marketsectionname": {
+                    "description": "市场版块名称",
+                    "type": "string"
+                },
+                "modifierid": {
+                    "description": "修改人",
+                    "type": "integer"
+                },
+                "modifiersrc": {
+                    "description": "修改人来源 - 1:管理端 2:终端",
+                    "type": "integer"
+                },
+                "modifytime": {
+                    "description": "修改时间",
+                    "type": "string"
+                },
+                "orderindex": {
+                    "description": "排序",
+                    "type": "integer"
+                },
+                "pictureurl": {
+                    "description": "显示图片(90*90)",
+                    "type": "string"
+                },
+                "remark": {
+                    "description": "备注",
+                    "type": "string"
+                }
+            }
+        },
         "models.Goods": {
             "type": "object",
             "required": [
@@ -41300,6 +41387,31 @@
                 }
             }
         },
+        "models.Marketsectionconfignew": {
+            "type": "object",
+            "properties": {
+                "displayname": {
+                    "description": "显示名称",
+                    "type": "string"
+                },
+                "marketids": {
+                    "description": "市场IDs - 逗号分隔",
+                    "type": "string"
+                },
+                "marketsectionid": {
+                    "description": "市场版块ID(SEQ_MARKETSECTION)",
+                    "type": "integer"
+                },
+                "orderindex": {
+                    "description": "排序",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                }
+            }
+        },
         "models.Mduserswapprotocol": {
             "type": "object",
             "properties": {

+ 79 - 0
docs/swagger.yaml

@@ -11125,6 +11125,49 @@ definitions:
       type:
         type: integer
     type: object
+  models.GetMarketSectionsRsp:
+    properties:
+      createtime:
+        description: 创建时间
+        type: string
+      creatorid:
+        description: 创建人ID
+        type: integer
+      creatorsrc:
+        description: 创建人来源 - 1:管理端 2:终端 3:交易
+        type: integer
+      isvalid:
+        description: 是否有效 - 0:无效 1:有效
+        type: integer
+      marketsectionconfignews:
+        items:
+          $ref: '#/definitions/models.Marketsectionconfignew'
+        type: array
+      marketsectionid:
+        description: 市场版块ID(SEQ_MARKETSECTION)
+        type: integer
+      marketsectionname:
+        description: 市场版块名称
+        type: string
+      modifierid:
+        description: 修改人
+        type: integer
+      modifiersrc:
+        description: 修改人来源 - 1:管理端 2:终端
+        type: integer
+      modifytime:
+        description: 修改时间
+        type: string
+      orderindex:
+        description: 排序
+        type: integer
+      pictureurl:
+        description: 显示图片(90*90)
+        type: string
+      remark:
+        description: 备注
+        type: string
+    type: object
   models.Goods:
     properties:
       agreeunit:
@@ -13974,6 +14017,24 @@ definitions:
     - tradedate
     - tradedate2
     type: object
+  models.Marketsectionconfignew:
+    properties:
+      displayname:
+        description: 显示名称
+        type: string
+      marketids:
+        description: 市场IDs - 逗号分隔
+        type: string
+      marketsectionid:
+        description: 市场版块ID(SEQ_MARKETSECTION)
+        type: integer
+      orderindex:
+        description: 排序
+        type: integer
+      updatetime:
+        description: 更新时间
+        type: string
+    type: object
   models.Mduserswapprotocol:
     properties:
       areauserid:
@@ -38805,6 +38866,24 @@ paths:
       summary: 获取所有外部交易所信息
       tags:
       - 通用市场
+  /Market/GetMarketSections:
+    get:
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.GetMarketSectionsRsp'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      summary: 查询新板块设置
+      tags:
+      - 通用市场
   /Market/QueryGoodsesByLoginID:
     get:
       parameters:

+ 26 - 0
models/market.go

@@ -504,3 +504,29 @@ func GetAvalidExchangeId(userId int64) []int64 {
 	}
 	return sId
 }
+
+type GetMarketSectionsRsp struct {
+	Marketsection
+	Marketsectionconfignews []Marketsectionconfignew `xorm:"-"`
+}
+
+func GetMarketSections() (datas []GetMarketSectionsRsp, err error) {
+	datas = make([]GetMarketSectionsRsp, 0)
+
+	m := make([]Marketsection, 0)
+	if err = db.GetEngine().Table("MARKETSECTION").OrderBy("ORDERINDEX").Find(&m); err != nil {
+		return
+	}
+
+	for i := range m {
+		item := &m[i]
+		details := make([]Marketsectionconfignew, 0)
+		if err = db.GetEngine().Table("MARKETSECTIONCONFIGNEW").Where("MARKETSECTIONID = ?", item.MARKETSECTIONID).OrderBy("MARKETSECTIONID,ORDERINDEX").Find(&details); err != nil {
+			return
+		}
+
+		datas = append(datas, GetMarketSectionsRsp{Marketsection: *item, Marketsectionconfignews: details})
+	}
+
+	return
+}

+ 35 - 0
models/ori.go

@@ -759,3 +759,38 @@ type Esigntemplateconfig struct {
 func (r *Esigntemplateconfig) TableName() string {
 	return "ESIGNTEMPLATECONFIG"
 }
+
+// Marketsection MarketSection
+type Marketsection struct {
+	MARKETSECTIONID   int64     `json:"marketsectionid" xorm:"MARKETSECTIONID"`     // 市场版块ID(SEQ_MARKETSECTION)
+	MARKETSECTIONNAME string    `json:"marketsectionname" xorm:"MARKETSECTIONNAME"` // 市场版块名称
+	ORDERINDEX        int32     `json:"orderindex" xorm:"ORDERINDEX"`               // 排序
+	REMARK            string    `json:"remark" xorm:"REMARK"`                       // 备注
+	CREATETIME        time.Time `json:"createtime" xorm:"CREATETIME"`               // 创建时间
+	CREATORSRC        int32     `json:"creatorsrc" xorm:"CREATORSRC"`               // 创建人来源 - 1:管理端 2:终端 3:交易
+	CREATORID         int64     `json:"creatorid" xorm:"CREATORID"`                 // 创建人ID
+	MODIFIERSRC       int32     `json:"modifiersrc" xorm:"MODIFIERSRC"`             // 修改人来源 - 1:管理端 2:终端
+	MODIFIERID        int64     `json:"modifierid" xorm:"MODIFIERID"`               // 修改人
+	MODIFYTIME        time.Time `json:"modifytime" xorm:"MODIFYTIME"`               // 修改时间
+	ISVALID           int32     `json:"isvalid" xorm:"ISVALID"`                     // 是否有效 - 0:无效 1:有效
+	PICTUREURL        string    `json:"pictureurl" xorm:"PICTUREURL"`               // 显示图片(90*90)
+}
+
+// TableName is MARKETSECTION
+func (r *Marketsection) TableName() string {
+	return "MARKETSECTION"
+}
+
+// Marketsectionconfignew 市场版块配置表(新) - 脚本初始化
+type Marketsectionconfignew struct {
+	MARKETSECTIONID int64     `json:"marketsectionid" xorm:"MARKETSECTIONID"` // 市场版块ID(SEQ_MARKETSECTION)
+	ORDERINDEX      int32     `json:"orderindex" xorm:"ORDERINDEX"`           // 排序
+	DISPLAYNAME     string    `json:"displayname" xorm:"DISPLAYNAME"`         // 显示名称
+	MARKETIDS       string    `json:"marketids" xorm:"MARKETIDS"`             // 市场IDs - 逗号分隔
+	UPDATETIME      time.Time `json:"updatetime" xorm:"UPDATETIME"`           // 更新时间
+}
+
+// TableName is MARKETSECTIONCONFIGNEW
+func (r *Marketsectionconfignew) TableName() string {
+	return "MARKETSECTIONCONFIGNEW"
+}

+ 1 - 0
routers/router.go

@@ -176,6 +176,7 @@ func InitRouter() *gin.Engine {
 	{
 		// 查询市场运行信息
 		marketR.GET("/QueryMarketRun", market.QueryMarketRun)
+		marketR.GET("/GetMarketSections", market.GetMarketSections)
 		// 获取登录账号有权限的市场信息
 		marketR.Use(token.Auth()).GET("/QueryMarketsByLoginID", market.QueryMarketsByLoginID)
 		// 获取登录账号有权限的商品信息