QOR是首个使用Go语言开发的电商系统、CMS的SDK。
github:https://github.com/qor/qor
按照github上的说明,下载源码
# Get example app
$ go get -u github.com/qor/qor-example
# Setup database
$ mysql -uroot -p
mysql> CREATE DATABASE qor_example;
# Run Application
$ cd $GOPATH/src/github.com/qor/qor-example
$ go run main.go
下载完之后修改数据库配置文件config/database.example.yml
db:
adapter: 数据库类型(postgres,mysql等)
name: 数据库名
user: 数据库用户名
password: 数据库密码
host: 数据库地址
这是没有任何数据的,官方给了一个生成模拟数据的命令
go run config/db/seeds/main.go config/db/seeds/seeds.go
要从国外下载数据,估计比较慢,再次运行
2019/03/04 10:47:14 SUCCESS ▶ 0003 Built Successfully!
2019/03/04 10:47:14 INFO ▶ 0004 Restarting 'qor-example'...
2019/03/04 10:47:14 SUCCESS ▶ 0005 './qor-example' is running...
Failed to find configuration config/application.yml, using example file config/application.example.yml
Failed to find configuration config/smtp.yml, using example file config/smtp.example.yml
Failed to find configuration config/database.yml, using example file config/database.example.yml
WARNING: AssetFS is used before overwrite it!
goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0xc00000e018, 0xc0002ffd18, 0x1)
/usr/local/Cellar/go/1.11.4/libexec/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
/usr/local/Cellar/go/1.11.4/libexec/src/runtime/debug/stack.go:16 +0x22
github.com/qor/assetfs.SetAssetFS(0x32d5a38, 0x234d1e0)
/opt/goHome/src/github.com/qor/assetfs/assetfs.go:33 +0xb0
github.com/qor/qor-example/config/bindatafs.init.0()
/opt/goHome/src/github.com/qor/qor-example/config/bindatafs/bindatafs.go:26 +0x5d
Enterprise features not enabled...
Listening on: 2001
有些错误,我们不管,直接访问127.0.0.1:7000(我的改为2001)
登录,默认账号密码dev@getqor.com / testing,但是不知为何说密码错误,点击忘记密码,后台可以,要求输入邮箱就输入,后台可以看到修改密码的授权链接
密码修改授权链接
2019.03.12更新
使用管理员账号登录提示密码错误,bugfix
提示:
(pq: missing FROM-clause entry for table "basics")
[2019-03-11 16:22:25]
(pq: missing FROM-clause entry for table "basics")
[2019-03-11 16:22:25]
failed to find template: auth/confirmation.text
failed to find template: auth/confirmation.html
failed to find template: auth/confirmation
TO: <dev@getqor.com>
修改/go/src/github.com/qor/auth/providers/password/handlers.go
if tx.Model(context.Auth.AuthIdentityModel).Where(authInfo).Scan(&authInfo).RecordNotFound() {
return nil, auth.ErrInvalidAccount
}
为:
if tx.Model(context.Auth.AuthIdentityModel).Where(
map[string]interface{}{
"provider": authInfo.Provider,
"uid": authInfo.UID,
}).Scan(&authInfo).RecordNotFound() {
return nil, auth.ErrInvalidAccount
}