diff --git a/dsSupport/Model/Res.go b/dsSupport/Model/Res.go index 95dea1a5..e9c98b2e 100644 --- a/dsSupport/Model/Res.go +++ b/dsSupport/Model/Res.go @@ -9,5 +9,6 @@ type Res struct { StudentFlag interface{} `json:"studentFlag,omitempty"` //omitempty有值就输出,没值则不输出 ParentFlag interface{} `json:"parentFlag,omitempty"` //omitempty有值就输出,没值则不输出 PositionList interface{} `json:"positionList,omitempty"` //omitempty有值就输出,没值则不输出 - AppId interface{} `json:"app_id,omitempty"` //omitempty有值就输出,没值则不输出 + AppId interface{} `json:"app_id,omitempty"` //omitempty有值就输出,没值则不输出 + AppIcon interface{} `json:"app_icon,omitempty"` //omitempty有值就输出,没值则不输出 } diff --git a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go index 8cedbc2f..e3107fc0 100644 --- a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go +++ b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go @@ -30,6 +30,7 @@ func Routers(r *gin.RouterGroup) { rr.POST("/SettingAccessSystemSsoInfo", SettingAccessSystemSsoInfo) rr.POST("/EmptyAccessSystemSsoInfo", EmptyAccessSystemSsoInfo) rr.GET("/GetAccessSystemIntegratedInfo", GetAccessSystemIntegratedInfo) + rr.POST("/UploadIconFile", UploadIconFile) rr.POST("/SettingAccessSystemIntegratedInfo", SettingAccessSystemIntegratedInfo) rr.POST("/EmptyAccessSystemIntegratedInfo", EmptyAccessSystemIntegratedInfo) rr.GET("/GetPositionTreeInfo", GetPositionTreeInfo) @@ -440,19 +441,54 @@ func GetAccessSystemIntegratedInfo(c *gin.Context) { }) } +// @Summary 上传图标 +// @Description 上传图标 +// @Tags 接入系统 +// @Accept multipart/form-data +// @Produce json +// @Param appIcon formData file true "图标" +// @Success 200 {object} Model.Res +// @Router /support/accessSystem/UploadIconFile [post] +func UploadIconFile(c *gin.Context) { + //接入系统在集成页面的图标 + header, _ := c.FormFile("appIcon") + rootPath, _ := os.Getwd() + iconDir := rootPath + "/Html/Icon/" + //生成图标的ID + iconFileId := CommonUtil.GetUUID() + iconFileName := iconFileId + "." + strings.Split(header.Filename, ".")[1] + iconPath := iconDir + iconFileName + //保存图标 + err := c.SaveUploadedFile(header, iconPath) + + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: err.Error(), + }) + return + } + + c.JSON(http.StatusOK, Model.Res{ + Success: true, + Message: "操作成功!", + AppIcon: "/dsSupport/Icon/" + iconFileName, + }) + +} + // @Summary 设置接入系统的集成信息 // @Description 设置接入系统的集成信息 // @Tags 接入系统 -// @Accept multipart/form-data +// @Accept application/x-www-form-urlencoded // @Produce json // @Param appId formData string true "系统ID" // @Param appUrl formData string true "接入系统在集成页面的调用地址" -// @Param appIcon formData file true "图标" +// @Param appIcon formData string true "图标" // @Success 200 {object} Model.Res // @Router /support/accessSystem/SettingAccessSystemIntegratedInfo [post] -// @X-EmptyLimit ["appId","appUrl"] +// @X-EmptyLimit ["appId","appUrl","appIcon"] // @X-LengthLimit [{"appId":"36,36"}] -// @X-TableName ["t_app_base"] // @X-Sort [12] func SettingAccessSystemIntegratedInfo(c *gin.Context) { //系统ID @@ -460,17 +496,9 @@ func SettingAccessSystemIntegratedInfo(c *gin.Context) { //接入系统在集成页面的调用地址 appUrl := c.PostForm("appUrl") //接入系统在集成页面的图标 - header, _ := c.FormFile("appIcon") - rootPath, _ := os.Getwd() - iconDir := rootPath + "/Html/Icon/" - //生成图标的ID - iconFileId := CommonUtil.GetUUID() - iconFileName := iconFileId + "." + strings.Split(header.Filename, ".")[1] - iconPath := iconDir + iconFileName - //保存图标 - c.SaveUploadedFile(header, iconPath) + appIcon := c.PostForm("appIcon") - err := AccessSystemDao.UpdateIntegration(appId, appUrl, "/dsSupport/Icon/"+iconFileName) + err := AccessSystemDao.UpdateIntegration(appId, appUrl, appIcon) if err != nil { c.JSON(http.StatusOK, Model.Res{ diff --git a/dsSupport/docs/docs.go b/dsSupport/docs/docs.go index fc201bcb..9375fb5b 100644 --- a/dsSupport/docs/docs.go +++ b/dsSupport/docs/docs.go @@ -1,5 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag +// This file was generated by swaggo/swag at +// 2020-09-28 09:53:17.7730006 +0800 CST m=+0.143916401 package docs @@ -908,7 +909,7 @@ var doc = `{ "post": { "description": "设置接入系统的集成信息", "consumes": [ - "multipart/form-data" + "application/x-www-form-urlencoded" ], "produces": [ "application/json" @@ -933,7 +934,7 @@ var doc = `{ "required": true }, { - "type": "file", + "type": "string", "description": "图标", "name": "appIcon", "in": "formData", @@ -950,7 +951,8 @@ var doc = `{ }, "x-emptylimit": [ "appId", - "appUrl" + "appUrl", + "appIcon" ], "x-lengthlimit": [ { @@ -959,9 +961,6 @@ var doc = `{ ], "x-sort": [ 12 - ], - "x-tablename": [ - "t_app_base" ] } }, @@ -1227,6 +1226,38 @@ var doc = `{ ] } }, + "/support/accessSystem/UploadIconFile": { + "post": { + "description": "上传图标", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "接入系统" + ], + "summary": "上传图标", + "parameters": [ + { + "type": "file", + "description": "图标", + "name": "appIcon", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Model.Res" + } + } + } + } + }, "/v1/openapi/account/currentUser": { "post": { "consumes": [ @@ -2419,6 +2450,10 @@ var doc = `{ "Model.Res": { "type": "object", "properties": { + "app_icon": { + "description": "omitempty有值就输出,没值则不输出", + "type": "object" + }, "app_id": { "description": "omitempty有值就输出,没值则不输出", "type": "object" @@ -2891,13 +2926,28 @@ var doc = `{ "MySwagger.Result": { "type": "object", "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "fail": { + "type": "boolean", + "example": false + }, "message": { "type": "string", - "example": "接入系统票据验证失败" + "example": "操作成功" }, "success": { "type": "boolean", - "example": false + "example": true + }, + "total": { + "type": "integer", + "example": 120 } } } diff --git a/dsSupport/docs/swagger.json b/dsSupport/docs/swagger.json index 1cb98413..549b98d7 100644 --- a/dsSupport/docs/swagger.json +++ b/dsSupport/docs/swagger.json @@ -892,7 +892,7 @@ "post": { "description": "设置接入系统的集成信息", "consumes": [ - "multipart/form-data" + "application/x-www-form-urlencoded" ], "produces": [ "application/json" @@ -917,7 +917,7 @@ "required": true }, { - "type": "file", + "type": "string", "description": "图标", "name": "appIcon", "in": "formData", @@ -934,7 +934,8 @@ }, "x-emptylimit": [ "appId", - "appUrl" + "appUrl", + "appIcon" ], "x-lengthlimit": [ { @@ -943,9 +944,6 @@ ], "x-sort": [ 12 - ], - "x-tablename": [ - "t_app_base" ] } }, @@ -1211,6 +1209,38 @@ ] } }, + "/support/accessSystem/UploadIconFile": { + "post": { + "description": "上传图标", + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "接入系统" + ], + "summary": "上传图标", + "parameters": [ + { + "type": "file", + "description": "图标", + "name": "appIcon", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Model.Res" + } + } + } + } + }, "/v1/openapi/account/currentUser": { "post": { "consumes": [ @@ -2403,6 +2433,10 @@ "Model.Res": { "type": "object", "properties": { + "app_icon": { + "description": "omitempty有值就输出,没值则不输出", + "type": "object" + }, "app_id": { "description": "omitempty有值就输出,没值则不输出", "type": "object" @@ -2875,13 +2909,28 @@ "MySwagger.Result": { "type": "object", "properties": { + "data": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": true + } + }, + "fail": { + "type": "boolean", + "example": false + }, "message": { "type": "string", - "example": "接入系统票据验证失败" + "example": "操作成功" }, "success": { "type": "boolean", - "example": false + "example": true + }, + "total": { + "type": "integer", + "example": 120 } } } diff --git a/dsSupport/docs/swagger.yaml b/dsSupport/docs/swagger.yaml index 8ee4fdc7..6f964ebd 100644 --- a/dsSupport/docs/swagger.yaml +++ b/dsSupport/docs/swagger.yaml @@ -1,6 +1,9 @@ definitions: Model.Res: properties: + app_icon: + description: omitempty有值就输出,没值则不输出 + type: object app_id: description: omitempty有值就输出,没值则不输出 type: object @@ -346,12 +349,23 @@ definitions: type: object MySwagger.Result: properties: + data: + items: + additionalProperties: true + type: object + type: array + fail: + example: false + type: boolean message: - example: 接入系统票据验证失败 + example: 操作成功 type: string success: - example: false + example: true type: boolean + total: + example: 120 + type: integer type: object host: 127.0.0.1:8005 info: @@ -928,7 +942,7 @@ paths: /support/accessSystem/SettingAccessSystemIntegratedInfo: post: consumes: - - multipart/form-data + - application/x-www-form-urlencoded description: 设置接入系统的集成信息 parameters: - description: 系统ID @@ -945,7 +959,7 @@ paths: in: formData name: appIcon required: true - type: file + type: string produces: - application/json responses: @@ -959,12 +973,11 @@ paths: x-emptylimit: - appId - appUrl + - appIcon x-lengthlimit: - appId: 36,36 x-sort: - 12 - x-tablename: - - t_app_base /support/accessSystem/SettingAccessSystemRangeInfo: post: consumes: @@ -1128,6 +1141,27 @@ paths: - 2 x-tablename: - t_app_base + /support/accessSystem/UploadIconFile: + post: + consumes: + - multipart/form-data + description: 上传图标 + parameters: + - description: 图标 + in: formData + name: appIcon + required: true + type: file + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/Model.Res' + summary: 上传图标 + tags: + - 接入系统 /v1/openapi/account/currentUser: post: consumes: @@ -1851,7 +1885,8 @@ paths: post: consumes: - application/json - description: '`*`json:"index_name" xorm:"not null comment(''ES Index Name'') VARCHAR(50)" example:"org_tree"' + description: '`*`json:"index_name" xorm:"not null comment(''ES Index Name'') + VARCHAR(50)" example:"org_tree"' operationId: createMetadataES parameters: - description: ES元数据