From 0e6074f673b9adae23141dcf449916c43bba022d Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Tue, 28 Jul 2020 15:08:20 +0800 Subject: [PATCH] 'commit' --- dsSso/Config/Config.ini | 68 +++++++++---------- .../ControllerOauth2/ControllerOauth2.go | 15 +++- 2 files changed, 45 insertions(+), 38 deletions(-) diff --git a/dsSso/Config/Config.ini b/dsSso/Config/Config.ini index 017042cc..bf564e85 100644 --- a/dsSso/Config/Config.ini +++ b/dsSso/Config/Config.ini @@ -1,37 +1,33 @@ -[mysql] # mysql1的配置项 -#ip = 10.10.14.220 -ip = 10.10.6.200 -port = 22066 -database = base_db_dev -#database = base_db -user = root -pwd = DsideaL147258369 - -[distribute] #发布功能的配置 -#ip = 10.10.14.220 -ip = 10.10.6.200 -port = 26611 -user = root -pwd = dsideal -remotePath = /usr/local/dsMin/dsSso/ -localPath = E:\Work\dsMin\dsSso\build - -[redis] -#ip = 10.10.14.220 -ip = 10.10.6.200 -port = 18890 -db = 0 - -[kafka] -#KafkaAddress = 10.10.14.222:9092 -KafkaAddress = 10.10.6.202:9092 -KafkaAccessLogTopic = dsAccessLog -# ---------------------------------------------------------------------------------------------------- - -[server] #gin服务器的端口 -port = 8000 -# 验证码的有效时间,单位:秒 -CaptchaExpireTime = 120 - -[install_area] +[mysql] # mysql1的配置项 +ip = 10.10.14.187 +port = 22066 +database = base_db_dev +#database = base_db +user = root +pwd = DsideaL147258369 + +[distribute] #发布功能的配置 +ip = 10.10.14.187 +port = 22 +user = root +pwd = dsideal +remotePath = /usr/local/dsMin/dsSso/ +localPath = E:\Work\dsMin\dsSso\build + +[redis] +ip = 10.10.14.187 +port = 18890 +db = 0 + +[kafka] +KafkaAddress = 10.10.6.202:9092 +KafkaAccessLogTopic = dsAccessLog +# ---------------------------------------------------------------------------------------------------- + +[server] #gin服务器的端口 +port = 8000 +# 验证码的有效时间,单位:秒 +CaptchaExpireTime = 120 + +[install_area] code = changchun \ No newline at end of file diff --git a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go index 71e7b8c1..80bea501 100644 --- a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go +++ b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go @@ -424,14 +424,25 @@ func logout(context *gin.Context) { } //清除cookie SsoUtil.DeleteSsoCookie(context) + + //判断来源是内网还是外网,是指客户端的IP地址,即浏览器的IP + ipStart := strings.Split(context.Request.Host, ".")[0] + isIntranetIP := strings.Index("10,192,172", ipStart) + //外网 + var s string + if isIntranetIP < 0 { + s = "defaultIndexWwUrl" + } else { //内网 + s = "defaultIndexNwUrl" + } //跳转回去,系统默认统一的回调首页 - list, err := DaoBaseGlobal.GetGlobalInfoByValue(`defaultIndexUrl`) + list, err := DaoBaseGlobal.GetGlobalInfoByValue(s) if err != nil || len(list) == 0 { msg := "获取全局变量defaultIndexUrl失败!" context.JSON(http.StatusOK, map[string]interface{}{"success": false, "msg": msg}) return } globalValue := list[0]["global_value"].(string) - context.Redirect(302, string(globalValue)) + context.Redirect(302, globalValue) return }