mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-27 16:49:37 +08:00
【优化】租户功能,框架优化
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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配置信息")
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user