mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 23:27:17 +08:00
add translation for panel init command
This commit is contained in:
@@ -59,31 +59,31 @@ func (receiver *Panel) Handle(ctx console.Context) error {
|
||||
var check models.User
|
||||
err := facades.Orm().Query().FirstOrFail(&check)
|
||||
if err == nil {
|
||||
color.Redln("面板已初始化")
|
||||
color.Redln(translate.Get("commands.panel.init.exist"))
|
||||
return nil
|
||||
}
|
||||
|
||||
settings := []models.Setting{{Key: models.SettingKeyName, Value: "耗子 Linux 面板"}, {Key: models.SettingKeyMonitor, Value: "1"}, {Key: models.SettingKeyMonitorDays, Value: "30"}, {Key: models.SettingKeyBackupPath, Value: "/www/backup"}, {Key: models.SettingKeyWebsitePath, Value: "/www/wwwroot"}, {Key: models.SettingKeyVersion, Value: facades.Config().GetString("panel.version")}}
|
||||
err = facades.Orm().Query().Create(&settings)
|
||||
if err != nil {
|
||||
color.Redln("初始化失败")
|
||||
color.Redln(translate.Get("commands.panel.init.fail"))
|
||||
return nil
|
||||
}
|
||||
|
||||
hash, err := facades.Hash().Make(tools.RandomString(32))
|
||||
if err != nil {
|
||||
color.Redln("初始化失败")
|
||||
color.Redln(translate.Get("commands.panel.init.fail"))
|
||||
return nil
|
||||
}
|
||||
|
||||
user := services.NewUserImpl()
|
||||
_, err = user.Create("admin", hash)
|
||||
if err != nil {
|
||||
color.Redln("创建管理员失败")
|
||||
color.Redln(translate.Get("commands.panel.init.adminFail"))
|
||||
return nil
|
||||
}
|
||||
|
||||
color.Greenln("初始化成功")
|
||||
color.Greenln(translate.Get("commands.panel.init.success"))
|
||||
|
||||
case "update":
|
||||
var task models.Task
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
"description": "remove website"
|
||||
},
|
||||
"init": {
|
||||
"description": "initialize the panel"
|
||||
"description": "initialize the panel",
|
||||
"exist": "panel has been initialized",
|
||||
"success": "initialization successful",
|
||||
"adminFound": "failed to create administrator",
|
||||
"fail": "initialization failed"
|
||||
},
|
||||
"writePlugin": {
|
||||
"description": "write plugin installation status"
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
"description": "删除网站"
|
||||
},
|
||||
"init": {
|
||||
"description": "初始化面板"
|
||||
"description": "初始化面板",
|
||||
"exist": "面板已初始化",
|
||||
"success": "初始化成功",
|
||||
"adminFail": "创建管理员失败",
|
||||
"fail": "初始化失败"
|
||||
},
|
||||
"writePlugin": {
|
||||
"description": "写入插件安装状态"
|
||||
|
||||
Reference in New Issue
Block a user