feat(common): 设置时区为亚洲/上海
- 在 cool.go 中添加了 gtime.SetTimeZone("Asia/Shanghai")
- 在 config.yaml 中添加了 timezone: "Asia/Shanghai"
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/gogf/gf/v2/os/gbuild"
|
"github.com/gogf/gf/v2/os/gbuild"
|
||||||
"github.com/gogf/gf/v2/os/gcache"
|
"github.com/gogf/gf/v2/os/gcache"
|
||||||
"github.com/gogf/gf/v2/os/gctx"
|
"github.com/gogf/gf/v2/os/gctx"
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
"github.com/gogf/gf/v2/util/guid"
|
"github.com/gogf/gf/v2/util/guid"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -24,6 +25,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
err := gtime.SetTimeZone("Asia/Shanghai")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
var (
|
var (
|
||||||
ctx = gctx.GetInitCtx()
|
ctx = gctx.GetInitCtx()
|
||||||
redisConfig = &gredis.Config{}
|
redisConfig = &gredis.Config{}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ database:
|
|||||||
pass: "hCnKjZRp3jnewzbS"
|
pass: "hCnKjZRp3jnewzbS"
|
||||||
name: "seer"
|
name: "seer"
|
||||||
debug: true
|
debug: true
|
||||||
|
timezone: "Asia/Shanghai"
|
||||||
createdAt: "createTime"
|
createdAt: "createTime"
|
||||||
updatedAt: "updateTime"
|
updatedAt: "updateTime"
|
||||||
# deletedAt: "deleteTime"
|
# deletedAt: "deleteTime"
|
||||||
|
|||||||
Reference in New Issue
Block a user