Pārlūkot izejas kodu

增加接口 /Common/GetSystemParams 获取系统参数信息

zhouxnsz 1 gadu atpakaļ
vecāks
revīzija
f0193674dd

+ 38 - 3
controllers/common/common.go

@@ -236,7 +236,7 @@ func GetAllEnums(c *gin.Context) {
 // @Summary 获取服务器时间
 // @Produce json
 // @Success 200 {object} app.Response
-// @Failure 500 {object} app.Response
+// @Failure 500   {object} app.Response
 // @Router  /Common/GetServerTime [get]
 // @Tags    通用服务
 func GetServerTime(c *gin.Context) {
@@ -310,10 +310,10 @@ func GetWskhOpenAccountConfigs(c *gin.Context) {
 // GetI18nConfigs 获取枚举项字典扩展表信息
 // @Summary 获取枚举项字典扩展表信息
 // @Produce json
-// @Success 200 {array}  models.I18nConfig
+// @Success 200   {array}  models.I18nConfig
 // @Failure 500 {object} app.Response
 // @Router  /Common/GetI18nConfigs [get]
-// @Tags        通用服务
+// @Tags    通用服务
 func GetI18nConfigs(c *gin.Context) {
 	appG := app.Gin{C: c}
 
@@ -328,3 +328,38 @@ func GetI18nConfigs(c *gin.Context) {
 	// 查询成功
 	appG.Response(http.StatusOK, e.SUCCESS, datas)
 }
+
+type GetGetSystemParamsReq struct {
+	Codes string `form:"codes"` // 参数代码,格式:1,2,3
+}
+
+// GetSystemParams 获取系统参数信息
+// @Summary 获取系统参数信息
+// @Produce json
+// @Param   codes query    string false "参数代码,格式:1,2,3"
+// @Success 200 {array}  models.I18nConfig
+// @Failure 500 {object} app.Response
+// @Router  /Common/GetSystemParams [get]
+// @Tags        通用服务
+func GetSystemParams(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req GetGetSystemParamsReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("GetSystemParams failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	datas, err := models.GetSystemParamsByCodes(req.Codes)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("GetSystemParams failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}

+ 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]

+ 36 - 0
docs/docs.go

@@ -1554,6 +1554,42 @@ const docTemplate = `{
                 }
             }
         },
+        "/Common/GetSystemParams": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用服务"
+                ],
+                "summary": "获取系统参数信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "参数代码,格式:1,2,3",
+                        "name": "codes",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.I18nConfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/GetWskhOpenAccountConfigs": {
             "get": {
                 "security": [

+ 36 - 0
docs/swagger.json

@@ -1545,6 +1545,42 @@
                 }
             }
         },
+        "/Common/GetSystemParams": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用服务"
+                ],
+                "summary": "获取系统参数信息",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "参数代码,格式:1,2,3",
+                        "name": "codes",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.I18nConfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/GetWskhOpenAccountConfigs": {
             "get": {
                 "security": [

+ 23 - 0
docs/swagger.yaml

@@ -32592,6 +32592,29 @@ paths:
       summary: 获取服务器时间
       tags:
       - 通用服务
+  /Common/GetSystemParams:
+    get:
+      parameters:
+      - description: 参数代码,格式:1,2,3
+        in: query
+        name: codes
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.I18nConfig'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      summary: 获取系统参数信息
+      tags:
+      - 通用服务
   /Common/GetWskhOpenAccountConfigs:
     get:
       parameters:

+ 15 - 0
models/common.go

@@ -826,6 +826,21 @@ func GetSystemParams() ([]Systemparam, error) {
 	return systemParams, nil
 }
 
+// GetSystemParam 获取系统参数信息
+func GetSystemParamsByCodes(paramcodes string) ([]Systemparam, error) {
+	systemParams := make([]Systemparam, 0)
+	session := db.GetEngine().Where("PARAMTYPE in (0,2,3)")
+	if paramcodes != "" {
+		s := strings.Split(paramcodes, ",")
+		session = session.In("PARAMCODE", s)
+	}
+	if err := session.Find(&systemParams); err != nil {
+		return nil, err
+	}
+
+	return systemParams, nil
+}
+
 // GetRoleFuncMenuLists 获取终端权限(交易所版本)
 func GetRoleFuncMenuLists(loginID int, resourceCode string) ([]Funcmenulist, error) {
 	funcMenuLists := make([]Funcmenulist, 0)

+ 1 - 0
routers/router.go

@@ -157,6 +157,7 @@ func InitRouter() *gin.Engine {
 		commonR.GET("/GetJ10News", common.GetJ10News)
 
 		commonR.GET("/GetI18nConfigs", common.GetI18nConfigs)
+		commonR.GET("/GetSystemParams", common.GetSystemParams)
 
 		// 通知公告系统消息查询
 		commonR.Use(token.Auth()).GET("/QueryNotice", common.QueryNotice)