|
@@ -2,6 +2,7 @@ package engine
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
|
|
+ "git.qianqiusoft.com/qianqiusoft/light-apiengine/middleware/logger"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
//"github.com/gin-contrib/sessions"
|
|
//"github.com/gin-contrib/sessions"
|
|
@@ -51,6 +52,9 @@ func NewApiEngine(driverName, dataSourceName string, addr string) *ApiEngine {
|
|
|
engine.PlatformOrmEngine, err = xorm.NewEngine(driverName, dataSourceName)
|
|
engine.PlatformOrmEngine, err = xorm.NewEngine(driverName, dataSourceName)
|
|
|
printError(err)
|
|
printError(err)
|
|
|
|
|
|
|
|
|
|
+ engine.PlatformOrmEngine.ShowSQL(true)
|
|
|
|
|
+ engine.PlatformOrmEngine.ShowExecTime(true)
|
|
|
|
|
+
|
|
|
initOrmEngine(engine.PlatformOrmEngine, driverName)
|
|
initOrmEngine(engine.PlatformOrmEngine, driverName)
|
|
|
if config.AppConfig.SyncDb {
|
|
if config.AppConfig.SyncDb {
|
|
|
|
|
|
|
@@ -59,6 +63,7 @@ func NewApiEngine(driverName, dataSourceName string, addr string) *ApiEngine {
|
|
|
engine.GinEngine = gin.Default()
|
|
engine.GinEngine = gin.Default()
|
|
|
|
|
|
|
|
engine.GinEngine.Use(gzip.Gzip(gzip.DefaultCompression))
|
|
engine.GinEngine.Use(gzip.Gzip(gzip.DefaultCompression))
|
|
|
|
|
+ engine.GinEngine.Use(logger.LoggerMiddleware())
|
|
|
|
|
|
|
|
//启动session
|
|
//启动session
|
|
|
//store := sessions.NewCookieStore([]byte("secret"))
|
|
//store := sessions.NewCookieStore([]byte("secret"))
|