时区更改
This commit is contained in:
parent
5ee88c0261
commit
c80b439ff3
|
@ -26,6 +26,7 @@ FROM alpine
|
||||||
#设置时区
|
#设置时区
|
||||||
RUN apk add --no-cache tzdata
|
RUN apk add --no-cache tzdata
|
||||||
ENV TZ=Asia/Shanghai
|
ENV TZ=Asia/Shanghai
|
||||||
|
ENV LANG=C.UTF-8
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
# 将编译好的二进制文件从构建阶段复制到运行阶段
|
# 将编译好的二进制文件从构建阶段复制到运行阶段
|
||||||
|
|
9
main.go
9
main.go
|
@ -11,6 +11,7 @@ import (
|
||||||
"qteam/config"
|
"qteam/config"
|
||||||
_ "qteam/docs"
|
_ "qteam/docs"
|
||||||
"qteam/rpc"
|
"qteam/rpc"
|
||||||
|
"time"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/qit-team/snow-core/cache/rediscache"
|
_ "github.com/qit-team/snow-core/cache/rediscache"
|
||||||
|
@ -101,7 +102,13 @@ func startServer(opts *config.Options) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 加载上海时区
|
||||||
|
shanghaiTimeZone, err := time.LoadLocation("Asia/Shanghai")
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("无法加载上海时区: %v", err))
|
||||||
|
}
|
||||||
|
// 设置时区(例如,用于处理时间)
|
||||||
|
time.Local = shanghaiTimeZone // 这会改变默认的本地时区
|
||||||
pidFile := opts.GenPidFile()
|
pidFile := opts.GenPidFile()
|
||||||
//根据启动命令行参数,决定启动哪种服务模式
|
//根据启动命令行参数,决定启动哪种服务模式
|
||||||
switch opts.App {
|
switch opts.App {
|
||||||
|
|
Loading…
Reference in New Issue