feat(common): 设置时区为亚洲/上海

- 在 cool.go 中添加了 gtime.SetTimeZone("Asia/Shanghai")
- 在 config.yaml 中添加了 timezone: "Asia/Shanghai"
This commit is contained in:
2025-08-30 01:10:38 +08:00
parent 7b5ec208fc
commit 2ed5c2db27
2 changed files with 6 additions and 0 deletions

View File

@@ -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{}

View File

@@ -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"