|
@@ -7,6 +7,7 @@ import (
|
|
|
//"github.com/gin-contrib/sessions/cookie"
|
|
//"github.com/gin-contrib/sessions/cookie"
|
|
|
|
|
|
|
|
"os"
|
|
"os"
|
|
|
|
|
+ "time"
|
|
|
|
|
|
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/config"
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/config"
|
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/utils"
|
|
"git.qianqiusoft.com/qianqiusoft/light-apiengine/utils"
|
|
@@ -63,7 +64,7 @@ func NewApiEngine(driverName, dataSourceName string, addr string) *ApiEngine {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func initOrmEngine(orm *xorm.Engine, driverName string) {
|
|
func initOrmEngine(orm *xorm.Engine, driverName string) {
|
|
|
- path,_:=utils.GetCurrentPath()
|
|
|
|
|
|
|
+ path, _ := utils.GetCurrentPath()
|
|
|
sqldir := path + "/sqlconfig"
|
|
sqldir := path + "/sqlconfig"
|
|
|
//注册SqlMap配置,xml格式
|
|
//注册SqlMap配置,xml格式
|
|
|
err := orm.RegisterSqlMap(xorm.Xml(sqldir, ".xml"))
|
|
err := orm.RegisterSqlMap(xorm.Xml(sqldir, ".xml"))
|
|
@@ -78,6 +79,11 @@ func initOrmEngine(orm *xorm.Engine, driverName string) {
|
|
|
err = orm.RegisterSqlTemplate(xorm.Default(sqldir, "_"+driverName+".tpl"))
|
|
err = orm.RegisterSqlTemplate(xorm.Default(sqldir, "_"+driverName+".tpl"))
|
|
|
printError(err)
|
|
printError(err)
|
|
|
|
|
|
|
|
|
|
+ //设置时区
|
|
|
|
|
+ orm.DatabaseTZ = time.Local // 必须
|
|
|
|
|
+ orm.TZLocation = time.Local // 必须
|
|
|
|
|
+ time.LoadLocation("Asia/Shanghai")
|
|
|
|
|
+
|
|
|
orm.StartFSWatcher()
|
|
orm.StartFSWatcher()
|
|
|
|
|
|
|
|
orm.ShowSQL(true)
|
|
orm.ShowSQL(true)
|