【优化】租户功能,框架优化

This commit is contained in:
PandaGoAdmin
2022-07-18 18:17:11 +08:00
parent d33bd39570
commit ae38e7bcef
60 changed files with 861 additions and 647 deletions

View File

@@ -6,8 +6,7 @@ import (
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"pandax/base/config"
"pandax/base/global"
"pandax/pkg/global"
"time"
_ "github.com/lib/pq"
@@ -23,7 +22,7 @@ func GormInit(ty string) *gorm.DB {
return nil
}
func GormMysql() *gorm.DB {
m := config.Conf.Mysql
m := global.Conf.Mysql
if m == nil || m.Dbname == "" {
global.Log.Panic("未找到数据库配置信息")
return nil
@@ -50,7 +49,7 @@ func GormMysql() *gorm.DB {
}
func GormPostgresql() *gorm.DB {
m := config.Conf.Postgresql
m := global.Conf.Postgresql
if m == nil || m.Dbname == "" {
global.Log.Panic("未找到数据库配置信息")
return nil

View File

@@ -2,15 +2,14 @@ package starter
import (
"fmt"
"pandax/base/config"
"pandax/base/global"
"pandax/pkg/global"
"github.com/go-redis/redis"
)
func ConnRedis() *redis.Client {
// 设置redis客户端
redisConf := config.Conf.Redis
redisConf := global.Conf.Redis
if redisConf == nil {
global.Log.Panic("未找到redis配置信息")
}

View File

@@ -1,16 +1,15 @@
package starter
import (
"pandax/base/config"
"pandax/base/global"
"pandax/pkg/global"
"github.com/gin-gonic/gin"
)
func RunWebServer(web *gin.Engine) {
server := config.Conf.Server
server := global.Conf.Server
port := server.GetPort()
if app := config.Conf.App; app != nil {
if app := global.Conf.App; app != nil {
global.Log.Infof("%s- Listening and serving HTTP on %s", app.GetAppInfo(), port)
} else {
global.Log.Infof("Listening and serving HTTP on %s", port)