From 8d022cf4749d5fec2f5955d98992ddfba17a3fd9 Mon Sep 17 00:00:00 2001 From: huanghai <10402852@qq.com> Date: Thu, 9 Jul 2020 08:35:55 +0800 Subject: [PATCH] 'commit' --- dsSso/Dao/DaoJoinApp/DaoJoinApp.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dsSso/Dao/DaoJoinApp/DaoJoinApp.go b/dsSso/Dao/DaoJoinApp/DaoJoinApp.go index fc48609a..53bf61fb 100644 --- a/dsSso/Dao/DaoJoinApp/DaoJoinApp.go +++ b/dsSso/Dao/DaoJoinApp/DaoJoinApp.go @@ -19,6 +19,8 @@ import ( var joinModel Model.Selector var tableName = "t_join_app" +var db = DbUtil.Engine + func init() { _, joinModel = joinModel.Get(tableName) } @@ -55,7 +57,7 @@ func AddJoinApp(appName string, redirectUri string) bool { t := time.Now().UTC() entropy := rand.New(rand.NewSource(t.UnixNano())) appSecret = strings.ToLower(ulid.MustNew(ulid.Timestamp(t), entropy).String()) - _, err := DbUtil.Engine.Exec(sql, appKey, appSecret, appName, redirectUri) + _, err := db.Exec(sql, appKey, appSecret, appName, redirectUri) if err != nil { LogUtil.Error(ErrorConst.SqlUpdateError, "插入统一认证表信息出错:"+err.Error()) return false @@ -82,7 +84,7 @@ func UpdateJoinApp(appId string, appName string, redirectUri string) bool { var secret string //获取id对应的密码 sql := "select app_secret from t_join_app where app_id=?" - _map, err := DbUtil.Engine.QueryString(sql, appId) + _map, err :=db.QueryString(sql, appId) if err != nil { LogUtil.Error(ErrorConst.SqlQueryError, "查询统一认证表信息出错!") return false @@ -95,7 +97,7 @@ func UpdateJoinApp(appId string, appName string, redirectUri string) bool { } //更新语句 sql = "update t_join_app set app_name=?,redirect_uri=? where app_id=?" - _, err = DbUtil.Engine.Exec(sql, appName, redirectUri, appId) + _, err = db.Exec(sql, appName, redirectUri, appId) if err != nil { LogUtil.Error(ErrorConst.SqlUpdateError, "更新统一认证表信息出错!") return false @@ -119,7 +121,7 @@ func UpdateJoinApp(appId string, appName string, redirectUri string) bool { func DeleteJoinAppById(appId string) bool { //更新语句 sql := "delete from t_join_app where app_id=?" - DbUtil.Engine.Exec(sql, appId) + db.Exec(sql, appId) //删除缓存 RedisUtil.DEL(joinModel.RedisPrefix + "_" + appId) //删除OAuth2的redis缓存