master
wubin 5 years ago
parent 94d6a694b1
commit fe15d70e59

@ -4,6 +4,7 @@ import (
"dsSupport/Model"
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
"dsSupport/Utils/CommonUtil"
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"strings"
@ -19,7 +20,6 @@ func Routers(r *gin.RouterGroup) {
rr.POST("/DeleteAccessSystemInfo", DeleteAccessSystemInfo)
rr.GET("/GetAccessSystemRangeInfo", GetAccessSystemRangeInfo)
rr.POST("/SettingAccessSystemRangeInfo", SettingAccessSystemRangeInfo)
rr.POST("/EmptyAccessSystemRangeInfo", EmptyAccessSystemRangeInfo)
rr.GET("/GetAccessSystemSsoInfo", GetAccessSystemSsoInfo)
rr.POST("/SettingAccessSystemSsoInfo", SettingAccessSystemSsoInfo)
rr.POST("/EmptyAccessSystemSsoInfo", EmptyAccessSystemSsoInfo)
@ -45,9 +45,9 @@ func Routers(r *gin.RouterGroup) {
// @X-Sort [0]
func PageAccessSystemInfo(c *gin.Context) {
//第几页
page := CommonUtil.ConvertStringToInt32(c.Query("page"))
page := CommonUtil.ConvertStringToInt(c.Query("page"))
//一页显示多少条
limit := CommonUtil.ConvertStringToInt32(c.Query("limit"))
limit := CommonUtil.ConvertStringToInt(c.Query("limit"))
res, count, err := AccessSystemDao.ListApp("", page, limit)
if err != nil {
@ -237,6 +237,19 @@ func SettingAccessSystemRangeInfo(c *gin.Context) {
func GetAccessSystemSsoInfo(c *gin.Context) {
//系统ID
appId := c.Query("appId")
res, err := AccessSystemDao.GetApp(appId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
List: CommonUtil.MapKeepFields(res, "redirect_uri", "logout_uri"),
})
}
// @Summary 设置接入系统的统一认证信息
@ -261,7 +274,19 @@ func SettingAccessSystemSsoInfo(c *gin.Context) {
//统一认证登出地址
logoutUri := c.PostForm("logoutUri")
AccessSystemDao.UpdateSso()
err := AccessSystemDao.UpdateSso(appId, redirectUri, logoutUri)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}
@ -280,6 +305,19 @@ func SettingAccessSystemSsoInfo(c *gin.Context) {
func EmptyAccessSystemSsoInfo(c *gin.Context) {
//系统ID
appId := c.PostForm("appId")
err := AccessSystemDao.ClearSso(appId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}
// @Summary 获取接入系统的集成信息
@ -297,6 +335,20 @@ func EmptyAccessSystemSsoInfo(c *gin.Context) {
func GetAccessSystemIntegratedInfo(c *gin.Context) {
//系统ID
appId := c.Query("appId")
res, err := AccessSystemDao.GetApp(appId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
List: CommonUtil.MapKeepFields(res, "app_url", "app_icon"),
})
}
// @Summary 设置接入系统的集成信息
@ -321,7 +373,22 @@ func SettingAccessSystemIntegratedInfo(c *gin.Context) {
//接入系统在集成页面的图标
header, _ := c.FormFile("excelFile")
//生成图标的ID
iconFileId := CommonUtil.GetUUID()
//iconFileId := CommonUtil.GetUUID()
fmt.Println(header)
err := AccessSystemDao.UpdateIntegration(appId, redirectUri, "")
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}
@ -340,4 +407,17 @@ func SettingAccessSystemIntegratedInfo(c *gin.Context) {
func EmptyAccessSystemIntegratedInfo(c *gin.Context) {
//系统ID
appId := c.PostForm("appId")
err := AccessSystemDao.ClearIntegration(appId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}

@ -631,6 +631,7 @@ func CopyFields(sourceStruct interface{}, targetStruct interface{}, fields ...st
}
return
}
// Convert json string to map
func JsonToMap(jsonStr string) (map[string]string, error) {
m := make(map[string]string)
@ -673,4 +674,27 @@ func CompressStr(str string) string {
func ConvertStringToInt32(s string) int32 {
i, _ := strconv.Atoi(s)
return int32(i)
}
}
/**
MAPfields
2020-08-24
*/
func MapKeepFields(m map[string]interface{}, fields ...string) map[string]interface{} {
for s := range m {
if !IsContain(fields, s) {
delete(m, s)
}
}
return m
}
func IsContain(items []string, item string) bool {
for _, eachItem := range items {
if eachItem == item {
return true
}
}
return false
}

@ -8,23 +8,23 @@ require (
github.com/CloudyKit/jet v2.1.2+incompatible // indirect
github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee // indirect
github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4 // indirect
github.com/bluesky335/IDCheck v0.0.0-20200319021444-08ee85bfcb7b // indirect
github.com/bluesky335/IDCheck v0.0.0-20200319021444-08ee85bfcb7b
github.com/bndr/gotabulate v1.1.2 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/go-redis/redis/v7 v7.4.0 // indirect
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/go-redis/redis/v7 v7.4.0
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/snappy v0.0.1 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/rs/xid v1.2.1 // indirect
github.com/oklog/ulid v1.3.1
github.com/rs/xid v1.2.1
github.com/satori/go.uuid v1.2.0
github.com/swaggo/gin-swagger v1.2.0
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tealeg/xlsx v1.0.5 // indirect
github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be // indirect
github.com/xormplus/core v0.0.0-20200308074340-f3bce19d5f31 // indirect
github.com/xormplus/xorm v0.0.0-20200731130200-6811f3bde592 // indirect
github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be
github.com/xormplus/core v0.0.0-20200308074340-f3bce19d5f31
github.com/xormplus/xorm v0.0.0-20200731130200-6811f3bde592
golang.org/x/sys v0.0.0-20200821140526-fda516888d29 // indirect
gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 // indirect
gopkg.in/ini.v1 v1.60.1

@ -139,6 +139,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY=
golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

Loading…
Cancel
Save