Comments (2)
很抱歉,该部分代码存在问题,我会在下一个版本中修复。
出现问题的原因为:gorm
设置 mysql
时区参数 loc
的值时需进行 UrlEncode
。
解决办法为:对时区参数 loc
的值进行 Url 编码,需要手动修改项目路径下的 config/db/db.go
中的相关代码:
import "net/url"
// 获取数据库连接
func getDataSource() string {
dataSource := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?parseTime=true&loc=%s",
setting.Config.Database.UserName,
setting.Config.Database.Password,
setting.Config.Database.Host,
setting.Config.Database.Port,
setting.Config.Database.Database,
url.QueryEscape(setting.Config.Database.TimeZone), // 对时区进行 Url 编码
)
return dataSource
}
from aries.
修改完代码之后,在 develop.yaml
配置文件中将时区 timezone
设置为 Asia/Shanghai
即可。
from aries.
Related Issues (10)
- Comment
- 大佬评论推荐使用这个 感觉比你现在用的那个编辑器更好 HOT 6
- 大佬 请教下 如果要实现 加密博文要怎么实现 HOT 2
- 静态文件源无法访问 HOT 1
- 文章里只能插图片? HOT 1
- 关于后台系统的一些问题 HOT 1
- 本地评论组件不显示 HOT 1
- 请问 博客主页显示有问题怎么回事 HOT 3
- 本地评论有问题 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aries.