mirror of
https://github.com/quarkcloudio/quark-go.git
synced 2025-09-27 04:15:54 +08:00
chore: 调整目录结构
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -27,7 +27,7 @@ tmp/
|
||||
install.lock
|
||||
|
||||
# examples web site static files
|
||||
examples/*/website/
|
||||
examples/*/web/
|
||||
|
||||
# examples web site static files
|
||||
# examples web site sqlite files
|
||||
examples/*/data.db
|
@@ -55,8 +55,8 @@ func main() {
|
||||
// 实例化对象
|
||||
b := builder.New(config)
|
||||
|
||||
// 静态文件
|
||||
b.Static("/", "./website")
|
||||
// WEB根目录
|
||||
b.Static("/", "./web/app")
|
||||
|
||||
// 自动构建数据库、拉取静态文件
|
||||
install.Handle()
|
||||
@@ -88,8 +88,7 @@ go run main.go
|
||||
密码:```123456```
|
||||
|
||||
## 特别注意
|
||||
1. **因为众所周知的原因,国内用户拉取静态文件可能会失败;建议您手动下载 [website](https://github.com/quarkcms/quark-go/tree/1.2/website) 静态文件后,将其复制到项目根目录,并在website目录内创建install.lock锁定文件。**
|
||||
2. **后台用户认证使用了AppKey作为JWT的加密密串,生成环境请务必更改**
|
||||
1. **后台用户认证使用了AppKey作为JWT的加密密串,生成环境请务必更改**
|
||||
|
||||
## 相关项目
|
||||
- [QuarkSmart](https://github.com/quarkcms/quark-smart) 单体应用
|
||||
|
@@ -28,8 +28,8 @@ func main() {
|
||||
return c.Next()
|
||||
})
|
||||
|
||||
// 静态资源
|
||||
app.Static("/", "./website", fiber.Static{
|
||||
// WEB根目录
|
||||
app.Static("/", "./web/app", fiber.Static{
|
||||
Compress: true,
|
||||
ByteRange: true,
|
||||
Browse: false,
|
||||
|
@@ -15,8 +15,8 @@ import (
|
||||
func main() {
|
||||
r := gin.Default()
|
||||
|
||||
// 静态文件
|
||||
r.Use(static.Serve("/", static.LocalFile("./website", false)))
|
||||
// WEB根目录
|
||||
r.Use(static.Serve("/", static.LocalFile("./web/app", false)))
|
||||
|
||||
// 数据库配置信息
|
||||
dsn := "root:Bc5HQFJc4bLjZCcC@tcp(127.0.0.1:3306)/quarkgo?charset=utf8&parseTime=True&loc=Local"
|
||||
|
@@ -21,10 +21,10 @@ func main() {
|
||||
register(h)
|
||||
|
||||
// 静态文件
|
||||
h.StaticFile("/admin/", "./website/admin/index.html")
|
||||
h.StaticFile("/admin/", "./web/app/admin/index.html")
|
||||
|
||||
// 静态文件目录
|
||||
fs := &app.FS{Root: "./website", IndexNames: []string{"index.html"}}
|
||||
// WEB根目录
|
||||
fs := &app.FS{Root: "./web/app", IndexNames: []string{"index.html"}}
|
||||
h.StaticFS("/", fs)
|
||||
|
||||
// 数据库配置信息
|
||||
|
@@ -41,8 +41,8 @@ func main() {
|
||||
// 实例化对象
|
||||
b := builder.New(config)
|
||||
|
||||
// 静态文件
|
||||
b.Static("/", "./website")
|
||||
// WEB根目录
|
||||
b.Static("/", "./web/app")
|
||||
|
||||
// 自动构建数据库、拉取静态文件
|
||||
install.Handle()
|
||||
|
@@ -41,8 +41,8 @@ func main() {
|
||||
// 实例化对象
|
||||
b := builder.New(config)
|
||||
|
||||
// 静态文件
|
||||
b.Static("/", "./website")
|
||||
// WEB根目录
|
||||
b.Static("/", "./web/app")
|
||||
|
||||
// 自动构建数据库、拉取静态文件
|
||||
install.Handle()
|
||||
|
@@ -33,8 +33,8 @@ func main() {
|
||||
server := rest.MustNewServer(c.RestConf)
|
||||
defer server.Stop()
|
||||
|
||||
// 加载静态文件
|
||||
staticFile("/", "./website", server)
|
||||
// WEB根目录
|
||||
staticFile("/", "./web/app", server)
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
handler.RegisterHandlers(server, ctx)
|
||||
|
@@ -43,7 +43,7 @@ func (p *File) Init() interface{} {
|
||||
}
|
||||
|
||||
// 设置文件上传路径
|
||||
p.SavePath = "./website/storage/files/" + time.Now().Format("20060102") + "/"
|
||||
p.SavePath = "./web/app/storage/files/" + time.Now().Format("20060102") + "/"
|
||||
|
||||
return p
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ func (p *Image) Init() interface{} {
|
||||
}
|
||||
|
||||
// 设置文件上传路径
|
||||
p.SavePath = "./website/storage/images/" + time.Now().Format("20060102") + "/"
|
||||
p.SavePath = "./web/app/storage/images/" + time.Now().Format("20060102") + "/"
|
||||
|
||||
// 添加路由映射关系
|
||||
p.GET("/api/admin/upload/:resource/getList", p.GetList)
|
||||
|
@@ -44,7 +44,7 @@ func (p *File) Init() interface{} {
|
||||
}
|
||||
|
||||
// 设置文件上传路径
|
||||
p.SavePath = "./website/storage/files/" + time.Now().Format("20060102") + "/"
|
||||
p.SavePath = "./web/app/storage/files/" + time.Now().Format("20060102") + "/"
|
||||
|
||||
return p
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ func (p *Image) Init() interface{} {
|
||||
}
|
||||
|
||||
// 设置文件上传路径
|
||||
p.SavePath = "./website/storage/images/" + time.Now().Format("20060102") + "/"
|
||||
p.SavePath = "./web/app/storage/images/" + time.Now().Format("20060102") + "/"
|
||||
|
||||
return p
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ func (model *File) GetPath(id interface{}) string {
|
||||
return getId
|
||||
}
|
||||
if strings.Contains(getId, "./") && !strings.Contains(getId, "{") {
|
||||
return http + webSiteDomain + strings.Replace(getId, "./website/", "/", -1)
|
||||
return http + webSiteDomain + strings.Replace(getId, "./web/app/", "/", -1)
|
||||
}
|
||||
if strings.Contains(getId, "/") && !strings.Contains(getId, "{") {
|
||||
return http + webSiteDomain + getId
|
||||
@@ -85,7 +85,7 @@ func (model *File) GetPath(id interface{}) string {
|
||||
return path
|
||||
}
|
||||
if strings.Contains(path, "./") {
|
||||
path = strings.Replace(path, "./website/", "/", -1)
|
||||
path = strings.Replace(path, "./web/app/", "/", -1)
|
||||
}
|
||||
if path != "" {
|
||||
return http + webSiteDomain + path
|
||||
@@ -100,7 +100,7 @@ func (model *File) GetPath(id interface{}) string {
|
||||
return path
|
||||
}
|
||||
if strings.Contains(path, "./") {
|
||||
path = strings.Replace(path, "./website/", "/", -1)
|
||||
path = strings.Replace(path, "./web/app/", "/", -1)
|
||||
}
|
||||
if path != "" {
|
||||
return http + webSiteDomain + path
|
||||
@@ -136,7 +136,7 @@ func (model *File) GetPaths(id interface{}) []string {
|
||||
paths = append(paths, v["url"].(string))
|
||||
} else {
|
||||
if strings.Contains(path, "./") {
|
||||
path = strings.Replace(path, "./website/", "/", -1)
|
||||
path = strings.Replace(path, "./web/app/", "/", -1)
|
||||
}
|
||||
if path != "" {
|
||||
path = http + webSiteDomain + path
|
||||
|
@@ -123,7 +123,7 @@ func (model *Picture) GetPath(id interface{}) string {
|
||||
return getId
|
||||
}
|
||||
if strings.Contains(getId, "./") && !strings.Contains(getId, "{") {
|
||||
return http + webSiteDomain + strings.Replace(getId, "./website/", "/", -1)
|
||||
return http + webSiteDomain + strings.Replace(getId, "./web/app/", "/", -1)
|
||||
}
|
||||
if strings.Contains(getId, "/") && !strings.Contains(getId, "{") {
|
||||
return http + webSiteDomain + getId
|
||||
@@ -146,7 +146,7 @@ func (model *Picture) GetPath(id interface{}) string {
|
||||
return path
|
||||
}
|
||||
if strings.Contains(path, "./") {
|
||||
path = strings.Replace(path, "./website/", "/", -1)
|
||||
path = strings.Replace(path, "./web/app/", "/", -1)
|
||||
}
|
||||
if path != "" {
|
||||
// 如果设置域名,则加上域名前缀
|
||||
@@ -162,7 +162,7 @@ func (model *Picture) GetPath(id interface{}) string {
|
||||
return path
|
||||
}
|
||||
if strings.Contains(path, "./") {
|
||||
path = strings.Replace(path, "./website/", "/", -1)
|
||||
path = strings.Replace(path, "./web/app/", "/", -1)
|
||||
}
|
||||
}
|
||||
if path != "" {
|
||||
@@ -199,7 +199,7 @@ func (model *Picture) GetPaths(id interface{}) []string {
|
||||
paths = append(paths, v["url"].(string))
|
||||
} else {
|
||||
if strings.Contains(path, "./") {
|
||||
path = strings.Replace(path, "./website/", "/", -1)
|
||||
path = strings.Replace(path, "./web/app/", "/", -1)
|
||||
}
|
||||
if path != "" {
|
||||
path = http + webSiteDomain + path
|
||||
|
@@ -21,7 +21,7 @@ const (
|
||||
AppName = "QuarkGo"
|
||||
|
||||
// 版本号
|
||||
Version = "1.2.22"
|
||||
Version = "1.2.23"
|
||||
|
||||
// 包名
|
||||
PkgName = "github.com/quarkcms/quark-go"
|
||||
@@ -105,15 +105,15 @@ func New(config *Config) *Engine {
|
||||
config: config,
|
||||
}
|
||||
|
||||
// 默认静态文件目录
|
||||
// 默认WEB资源目录
|
||||
if config.StaticPath == "" {
|
||||
config.StaticPath = "./website"
|
||||
config.StaticPath = "./web"
|
||||
}
|
||||
|
||||
// 下载静态文件
|
||||
_, err := os.Stat(config.StaticPath + "/install.lock")
|
||||
if os.IsNotExist(err) {
|
||||
err := gopkg.New(PkgName, Version).Save("website", config.StaticPath)
|
||||
err := gopkg.New(PkgName, Version).Save("web", config.StaticPath)
|
||||
if err == nil {
|
||||
// 创建锁定文件
|
||||
file, _ := os.Create(config.StaticPath + "/install.lock")
|
||||
|
@@ -163,7 +163,7 @@ func (p *ImportRequest) Handle(ctx *builder.Context, indexRoute string) error {
|
||||
|
||||
f.SetActiveSheet(index)
|
||||
|
||||
filePath := "./website/storage/failImports/"
|
||||
filePath := "./web/app/storage/failImports/"
|
||||
fileName := rand.MakeAlphanumeric(40) + ".xlsx"
|
||||
|
||||
// 不存在路径,则创建
|
||||
|
@@ -52,7 +52,7 @@ func Download(respositoryURL string, path string) {
|
||||
// failedPrint
|
||||
func failedPrint(err error) {
|
||||
if err != nil {
|
||||
fmt.Println("The static file download failed. Please go to the url:" + respositoryDownloadURL + " to download and copy it to the project root directory, and create an install.lock lock file in the website directory.\n\n")
|
||||
fmt.Println("The static file download failed. Please go to the url:" + respositoryDownloadURL + " to download and copy it to the project root directory, and create an install.lock lock file in the web directory.\n\n")
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user