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 067d94e8..c2e93e3a 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:50:02.8518639 +0800 CST m=+0.337807601 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,42 +1226,33 @@ var doc = `{ ] } }, - "/support/login/account": { + "/support/accessSystem/UploadIconFile": { "post": { - "description": "json:\"datasource_name\" xorm:\"not null comment('数据源名称') VARCHAR(100)\" example:\"组织机构信息\"\njson:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"", + "description": "上传图标", "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "登录" + "接入系统" ], - "summary": "登录", - "operationId": "Account", + "summary": "上传图标", "parameters": [ { - "description": "登录", - "name": "input", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MySwagger.AccountSwag" - } + "type": "file", + "description": "图标", + "name": "appIcon", + "in": "formData", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/MySwagger.Result" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/MySwagger.Result" + "$ref": "#/definitions/Model.Res" } } } @@ -1681,7 +1671,7 @@ var doc = `{ }, "/v1/openapi/datasource/ReadESDoc": { "post": { - "description": "` + "`" + `*` + "`" + `json:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"\njson:\"` + "`" + `orgids` + "`" + `\" xorm:\"not null comment('提供数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') VARCHAR(36)\" example:\"[F38BD0DB-0142-4356-8F2B-623813FC2578,F38BD0DB-0142-4356-8F2B-623813FC2578]\"\njson:\"begin_time\" example:\"2020-06-22 17:26:53\"` + "`" + `\njson:\"conditions\" example:\"\"\njson:\"sort\" example:\"\"\njson:\"data_id\" example:\"CfBQnRJPyXMEI5nqLT0\"\njson:\"page\" example:\"1\"", + "description": "json:\"username\" xorm:\"not null comment('账号') VARCHAR(100)\" example:\"example\"\njson:\"password\" xorm:\"not null comment('密码') VARCHAR(100)\" example:\"123456\"", "consumes": [ "application/json" ], @@ -1689,18 +1679,18 @@ var doc = `{ "application/json" ], "tags": [ - "datasource" + "account" ], - "summary": "获取es数据列表", - "operationId": "readESDoc", + "summary": "后台登陆", + "operationId": "loginAccount", "parameters": [ { - "description": "es数据", + "description": "账号密码", "name": "input", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MySwagger.DatasourceESSwag" + "$ref": "#/definitions/MySwagger.AccountSwag" } } ], @@ -2351,6 +2341,10 @@ var doc = `{ "Model.Res": { "type": "object", "properties": { + "app_icon": { + "description": "omitempty有值就输出,没值则不输出", + "type": "object" + }, "app_id": { "description": "omitempty有值就输出,没值则不输出", "type": "object" @@ -2858,6 +2852,10 @@ var doc = `{ { "description": "机构目录", "name": "orgtree" + }, + { + "description": "后台登陆", + "name": "account" } ] }` diff --git a/dsSupport/docs/swagger.json b/dsSupport/docs/swagger.json index 4df5116b..6401fe85 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,42 +1209,33 @@ ] } }, - "/support/login/account": { + "/support/accessSystem/UploadIconFile": { "post": { - "description": "json:\"datasource_name\" xorm:\"not null comment('数据源名称') VARCHAR(100)\" example:\"组织机构信息\"\njson:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"", + "description": "上传图标", "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "登录" + "接入系统" ], - "summary": "登录", - "operationId": "Account", + "summary": "上传图标", "parameters": [ { - "description": "登录", - "name": "input", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/MySwagger.AccountSwag" - } + "type": "file", + "description": "图标", + "name": "appIcon", + "in": "formData", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/MySwagger.Result" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/MySwagger.Result" + "$ref": "#/definitions/Model.Res" } } } @@ -1665,7 +1654,7 @@ }, "/v1/openapi/datasource/ReadESDoc": { "post": { - "description": "`*`json:\"datasource_code\" xorm:\"not null comment('数据源编码') VARCHAR(8)\" example:\"org_tree\"\njson:\"`orgids`\" xorm:\"not null comment('提供数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') VARCHAR(36)\" example:\"[F38BD0DB-0142-4356-8F2B-623813FC2578,F38BD0DB-0142-4356-8F2B-623813FC2578]\"\njson:\"begin_time\" example:\"2020-06-22 17:26:53\"`\njson:\"conditions\" example:\"\"\njson:\"sort\" example:\"\"\njson:\"data_id\" example:\"CfBQnRJPyXMEI5nqLT0\"\njson:\"page\" example:\"1\"", + "description": "json:\"username\" xorm:\"not null comment('账号') VARCHAR(100)\" example:\"example\"\njson:\"password\" xorm:\"not null comment('密码') VARCHAR(100)\" example:\"123456\"", "consumes": [ "application/json" ], @@ -1673,18 +1662,18 @@ "application/json" ], "tags": [ - "datasource" + "account" ], - "summary": "获取es数据列表", - "operationId": "readESDoc", + "summary": "后台登陆", + "operationId": "loginAccount", "parameters": [ { - "description": "es数据", + "description": "账号密码", "name": "input", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/MySwagger.DatasourceESSwag" + "$ref": "#/definitions/MySwagger.AccountSwag" } } ], @@ -2335,6 +2324,10 @@ "Model.Res": { "type": "object", "properties": { + "app_icon": { + "description": "omitempty有值就输出,没值则不输出", + "type": "object" + }, "app_id": { "description": "omitempty有值就输出,没值则不输出", "type": "object" @@ -2842,6 +2835,10 @@ { "description": "机构目录", "name": "orgtree" + }, + { + "description": "后台登陆", + "name": "account" } ] } \ No newline at end of file diff --git a/dsSupport/docs/swagger.yaml b/dsSupport/docs/swagger.yaml index af68c59d..f87d972f 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 @@ -925,7 +928,7 @@ paths: /support/accessSystem/SettingAccessSystemIntegratedInfo: post: consumes: - - multipart/form-data + - application/x-www-form-urlencoded description: 设置接入系统的集成信息 parameters: - description: 系统ID @@ -942,7 +945,7 @@ paths: in: formData name: appIcon required: true - type: file + type: string produces: - application/json responses: @@ -956,12 +959,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: @@ -1125,35 +1127,27 @@ paths: - 2 x-tablename: - t_app_base - /support/login/account: + /support/accessSystem/UploadIconFile: post: consumes: - - application/json - description: |- - json:"datasource_name" xorm:"not null comment('数据源名称') VARCHAR(100)" example:"组织机构信息" - json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree" - operationId: Account + - multipart/form-data + description: 上传图标 parameters: - - description: 登录 - in: body - name: input + - description: 图标 + in: formData + name: appIcon required: true - schema: - $ref: '#/definitions/MySwagger.AccountSwag' + type: file produces: - application/json responses: "200": description: OK schema: - $ref: '#/definitions/MySwagger.Result' - "400": - description: Bad Request - schema: - $ref: '#/definitions/MySwagger.Result' - summary: 登录 + $ref: '#/definitions/Model.Res' + summary: 上传图标 tags: - - 登录 + - 接入系统 /v1/openapi/dataaccess/CreateDataaccess: post: consumes: @@ -1516,21 +1510,16 @@ paths: consumes: - application/json description: |- - `*`json:"datasource_code" xorm:"not null comment('数据源编码') VARCHAR(8)" example:"org_tree" - json:"`orgids`" xorm:"not null comment('提供数据范围【1:本机构,2:本机构以及下属机构,-1:不限制】') VARCHAR(36)" example:"[F38BD0DB-0142-4356-8F2B-623813FC2578,F38BD0DB-0142-4356-8F2B-623813FC2578]" - json:"begin_time" example:"2020-06-22 17:26:53"` - json:"conditions" example:"" - json:"sort" example:"" - json:"data_id" example:"CfBQnRJPyXMEI5nqLT0" - json:"page" example:"1" - operationId: readESDoc + json:"username" xorm:"not null comment('账号') VARCHAR(100)" example:"example" + json:"password" xorm:"not null comment('密码') VARCHAR(100)" example:"123456" + operationId: loginAccount parameters: - - description: es数据 + - description: 账号密码 in: body name: input required: true schema: - $ref: '#/definitions/MySwagger.DatasourceESSwag' + $ref: '#/definitions/MySwagger.AccountSwag' produces: - application/json responses: @@ -1542,9 +1531,9 @@ paths: description: Bad Request schema: $ref: '#/definitions/MySwagger.Result' - summary: 获取es数据列表 + summary: 后台登陆 tags: - - datasource + - account /v1/openapi/datasource/UpdateDatasource/{id}: post: consumes: @@ -1803,7 +1792,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元数据 @@ -2121,3 +2111,5 @@ tags: name: metadata - description: 机构目录 name: orgtree +- description: 后台登陆 + name: account