feat: add the admin panel

This commit is contained in:
chris
2025-03-24 13:39:47 +08:00
parent 274409fcdf
commit 7f7b241724
8 changed files with 18 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2023-2024 Nunu Copyright (c) 2023-2025 Nunu
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -35,6 +35,8 @@ Nunu is a scaffolding tool for building Go applications. Its name comes from a g
- **Gomock**: https://github.com/golang/mock - **Gomock**: https://github.com/golang/mock
- **Swaggo**: https://github.com/swaggo/swag - **Swaggo**: https://github.com/swaggo/swag
- **Pitaya**: https://github.com/topfreegames/pitaya - **Pitaya**: https://github.com/topfreegames/pitaya
- **Casbin**: https://github.com/casbin/casbin
- More... - More...
## Key Features ## Key Features

View File

@@ -31,6 +31,8 @@ Nunuは、Goアプリケーションを構築するためのスキャフォー
- **Gomock**: https://github.com/golang/mock - **Gomock**: https://github.com/golang/mock
- **Swaggo**: https://github.com/swaggo/swag - **Swaggo**: https://github.com/swaggo/swag
- **Pitaya**: https://github.com/topfreegames/pitaya - **Pitaya**: https://github.com/topfreegames/pitaya
- **Casbin**: https://github.com/casbin/casbin
- その他多数... - その他多数...
## 主な特徴 ## 主な特徴

View File

@@ -31,6 +31,7 @@ Nunu é uma ferramenta de geração de estrutura (scaffolding) para construir ap
- **Gomock**: https://github.com/golang/mock - **Gomock**: https://github.com/golang/mock
- **Swaggo**: https://github.com/swaggo/swag - **Swaggo**: https://github.com/swaggo/swag
- **Pitaya**: https://github.com/topfreegames/pitaya - **Pitaya**: https://github.com/topfreegames/pitaya
- **Casbin**: https://github.com/casbin/casbin
- Mais... - Mais...
## Funcionalidades Principais ## Funcionalidades Principais

View File

@@ -31,6 +31,7 @@ Nunu是一个基于Golang的应用脚手架它的名字来自于英雄联盟
- **Gomock**: https://github.com/golang/mock - **Gomock**: https://github.com/golang/mock
- **Swaggo**: https://github.com/swaggo/swag - **Swaggo**: https://github.com/swaggo/swag
- **Pitaya**: https://github.com/topfreegames/pitaya - **Pitaya**: https://github.com/topfreegames/pitaya
- **Casbin**: https://github.com/casbin/casbin
- More... - More...
## 特性 ## 特性
* **超低学习成本和定制**Nunu封装了Gopher最熟悉的一些流行库。您可以轻松定制应用程序以满足特定需求。 * **超低学习成本和定制**Nunu封装了Gopher最熟悉的一些流行库。您可以轻松定制应用程序以满足特定需求。

View File

@@ -16,7 +16,7 @@ var CmdRoot = &cobra.Command{
Use: "nunu", Use: "nunu",
Example: "nunu new demo-api", Example: "nunu new demo-api",
Short: "\n _ _ \n| \\ | |_ _ _ __ _ _ \n| \\| | | | | '_ \\| | | |\n| |\\ | |_| | | | | |_| |\n|_| \\_|\\__,_|_| |_|\\__,_| \n \n" + "\x1B[38;2;66;211;146mA\x1B[39m \x1B[38;2;67;209;149mC\x1B[39m\x1B[38;2;68;206;152mL\x1B[39m\x1B[38;2;69;204;155mI\x1B[39m \x1B[38;2;70;201;158mt\x1B[39m\x1B[38;2;71;199;162mo\x1B[39m\x1B[38;2;72;196;165mo\x1B[39m\x1B[38;2;73;194;168ml\x1B[39m \x1B[38;2;74;192;171mf\x1B[39m\x1B[38;2;75;189;174mo\x1B[39m\x1B[38;2;76;187;177mr\x1B[39m \x1B[38;2;77;184;180mb\x1B[39m\x1B[38;2;78;182;183mu\x1B[39m\x1B[38;2;79;179;186mi\x1B[39m\x1B[38;2;80;177;190ml\x1B[39m\x1B[38;2;81;175;193md\x1B[39m\x1B[38;2;82;172;196mi\x1B[39m\x1B[38;2;83;170;199mn\x1B[39m\x1B[38;2;83;167;202mg\x1B[39m \x1B[38;2;84;165;205mg\x1B[39m\x1B[38;2;85;162;208mo\x1B[39m \x1B[38;2;86;160;211ma\x1B[39m\x1B[38;2;87;158;215mp\x1B[39m\x1B[38;2;88;155;218ml\x1B[39m\x1B[38;2;89;153;221mi\x1B[39m\x1B[38;2;90;150;224mc\x1B[39m\x1B[38;2;91;148;227ma\x1B[39m\x1B[38;2;92;145;230mt\x1B[39m\x1B[38;2;93;143;233mi\x1B[39m\x1B[38;2;94;141;236mo\x1B[39m\x1B[38;2;95;138;239mn\x1B[39m\x1B[38;2;96;136;243m.\x1B[39m", Short: "\n _ _ \n| \\ | |_ _ _ __ _ _ \n| \\| | | | | '_ \\| | | |\n| |\\ | |_| | | | | |_| |\n|_| \\_|\\__,_|_| |_|\\__,_| \n \n" + "\x1B[38;2;66;211;146mA\x1B[39m \x1B[38;2;67;209;149mC\x1B[39m\x1B[38;2;68;206;152mL\x1B[39m\x1B[38;2;69;204;155mI\x1B[39m \x1B[38;2;70;201;158mt\x1B[39m\x1B[38;2;71;199;162mo\x1B[39m\x1B[38;2;72;196;165mo\x1B[39m\x1B[38;2;73;194;168ml\x1B[39m \x1B[38;2;74;192;171mf\x1B[39m\x1B[38;2;75;189;174mo\x1B[39m\x1B[38;2;76;187;177mr\x1B[39m \x1B[38;2;77;184;180mb\x1B[39m\x1B[38;2;78;182;183mu\x1B[39m\x1B[38;2;79;179;186mi\x1B[39m\x1B[38;2;80;177;190ml\x1B[39m\x1B[38;2;81;175;193md\x1B[39m\x1B[38;2;82;172;196mi\x1B[39m\x1B[38;2;83;170;199mn\x1B[39m\x1B[38;2;83;167;202mg\x1B[39m \x1B[38;2;84;165;205mg\x1B[39m\x1B[38;2;85;162;208mo\x1B[39m \x1B[38;2;86;160;211ma\x1B[39m\x1B[38;2;87;158;215mp\x1B[39m\x1B[38;2;88;155;218ml\x1B[39m\x1B[38;2;89;153;221mi\x1B[39m\x1B[38;2;90;150;224mc\x1B[39m\x1B[38;2;91;148;227ma\x1B[39m\x1B[38;2;92;145;230mt\x1B[39m\x1B[38;2;93;143;233mi\x1B[39m\x1B[38;2;94;141;236mo\x1B[39m\x1B[38;2;95;138;239mn\x1B[39m\x1B[38;2;96;136;243m.\x1B[39m",
Version: fmt.Sprintf("\n _ _ \n| \\ | |_ _ _ __ _ _ \n| \\| | | | | '_ \\| | | |\n| |\\ | |_| | | | | |_| |\n|_| \\_|\\__,_|_| |_|\\__,_| \n \nNunu %s - Copyright (c) 2023-2024 Nunu\nReleased under the MIT License.\n\n", config.Version), Version: fmt.Sprintf("\n _ _ \n| \\ | |_ _ _ __ _ _ \n| \\| | | | | '_ \\| | | |\n| |\\ | |_| | | | | |_| |\n|_| \\_|\\__,_|_| |_|\\__,_| \n \nNunu %s - Copyright (c) 2023-2025 Nunu\nReleased under the MIT License.\n\n", config.Version),
} }
func init() { func init() {

View File

@@ -1,11 +1,12 @@
package config package config
var ( var (
Version = "1.1.0" Version = "1.1.1"
WireCmd = "github.com/google/wire/cmd/wire@latest" WireCmd = "github.com/google/wire/cmd/wire@latest"
NunuCmd = "github.com/go-nunu/nunu@latest" NunuCmd = "github.com/go-nunu/nunu@latest"
RepoBase = "https://github.com/go-nunu/nunu-layout-base.git" RepoBase = "https://github.com/go-nunu/nunu-layout-base.git"
RepoAdvanced = "https://github.com/go-nunu/nunu-layout-advanced.git" RepoAdvanced = "https://github.com/go-nunu/nunu-layout-advanced.git"
RepoAdmin = "https://github.com/go-nunu/nunu-layout-admin.git"
RepoChat = "https://github.com/go-nunu/nunu-layout-chat.git" RepoChat = "https://github.com/go-nunu/nunu-layout-chat.git"
RunExcludeDir = ".git,.idea,tmp,vendor" RunExcludeDir = ".git,.idea,tmp,vendor"
RunIncludeExt = "go,html,yaml,yml,toml,ini,json,xml,tpl,tmpl" RunIncludeExt = "go,html,yaml,yml,toml,ini,json,xml,tpl,tmpl"

View File

@@ -110,15 +110,19 @@ func (p *Project) cloneTemplate() (bool, error) {
Message: "Please select a layout:", Message: "Please select a layout:",
Options: []string{ Options: []string{
"Advanced", "Advanced",
"Admin",
"Basic", "Basic",
"Chat", "Chat",
}, },
Description: func(value string, index int) string { Description: func(value string, index int) string {
if index == 1 { if index == 1 {
return "A basic project structure" return "A admin template for quick backend setup."
} }
if index == 2 { if index == 2 {
return "A simple chat room containing websocket/tcp" return "A basic project structure."
}
if index == 3 {
return "A simple chat room containing websocket/tcp."
} }
return "It has rich functions such as db, jwt, cron, migration, test, etc" return "It has rich functions such as db, jwt, cron, migration, test, etc"
}, },
@@ -131,6 +135,8 @@ func (p *Project) cloneTemplate() (bool, error) {
repo = config.RepoAdvanced repo = config.RepoAdvanced
} else if layout == "Chat" { } else if layout == "Chat" {
repo = config.RepoChat repo = config.RepoChat
} else if layout == "Admin" {
repo = config.RepoAdmin
} }
err = os.RemoveAll(p.ProjectName) err = os.RemoveAll(p.ProjectName)
if err != nil { if err != nil {