diff --git a/app/console/commands/panel.go b/app/console/commands/panel.go index 334f5b8f..ebdfd425 100644 --- a/app/console/commands/panel.go +++ b/app/console/commands/panel.go @@ -114,14 +114,14 @@ func (receiver *Panel) Handle(ctx console.Context) error { var user models.User err := facades.Orm().Query().Where("id", 1).FirstOrFail(&user) if err != nil { - color.Redln("获取管理员信息失败") + color.Redln(translate.Get("commands.panel.getInfo.adminGetFail")) return nil } password := tools.RandomString(16) hash, err := facades.Hash().Make(password) if err != nil { - color.Redln("生成密码失败") + color.Redln(translate.Get("commands.panel.getInfo.passwordGenerationFail")) return nil } user.Username = tools.RandomString(8) @@ -132,13 +132,13 @@ func (receiver *Panel) Handle(ctx console.Context) error { err = facades.Orm().Query().Save(&user) if err != nil { - color.Redln("保存管理员信息失败") + color.Redln(translate.Get("commands.panel.getInfo.adminSaveFail")) return nil } port, err := tools.Exec(`cat /www/panel/panel.conf | grep APP_PORT | awk -F '=' '{print $2}' | tr -d '\n'`) if err != nil { - color.Redln("获取面板端口失败") + color.Redln(translate.Get("commands.panel.getInfo.portFail")) return nil } ip, err := tools.GetPublicIP() @@ -150,11 +150,11 @@ func (receiver *Panel) Handle(ctx console.Context) error { protocol = "https" } - color.Greenln("用户名: " + user.Username) - color.Greenln("密码: " + password) - color.Greenln("面板端口: " + port) - color.Greenln("面板入口: " + facades.Config().GetString("http.entrance")) - color.Greenln("面板地址: " + protocol + "://" + ip + ":" + port + facades.Config().GetString("http.entrance")) + color.Greenln(translate.Get("commands.panel.getInfo.username") + ": " + user.Username) + color.Greenln(translate.Get("commands.panel.getInfo.password") + ": " + password) + color.Greenln(translate.Get("commands.panel.getInfo.port") + ": " + port) + color.Greenln(translate.Get("commands.panel.getInfo.entrance") + ": " + facades.Config().GetString("http.entrance")) + color.Greenln(translate.Get("commands.panel.getInfo.address") + ": " + protocol + "://" + ip + ":" + port + facades.Config().GetString("http.entrance")) case "getPort": port, err := tools.Exec(`cat /www/panel/panel.conf | grep APP_PORT | awk -F '=' '{print $2}' | tr -d '\n'`) diff --git a/lang/en.json b/lang/en.json index b6e93e2d..056a8c9b 100644 --- a/lang/en.json +++ b/lang/en.json @@ -19,7 +19,16 @@ "success": "update completed" }, "getInfo": { - "description": "reinitialize panel account information" + "description": "reinitialize panel account information", + "adminGetFail": "failed to get administrator information", + "adminSaveFail": "failed to save administrator information", + "passwordGenerationFail": "failed to generate password", + "portFail": "failed to get panel port", + "username": "Username", + "password": "Password", + "port": "Panel port", + "entrance": "Panel entrance", + "address": "Panel address" }, "getPort": { "description": "get the panel access port", diff --git a/lang/zh_CN.json b/lang/zh_CN.json index a1a45e2f..382a28c6 100644 --- a/lang/zh_CN.json +++ b/lang/zh_CN.json @@ -19,7 +19,16 @@ "success": "更新成功" }, "getInfo": { - "description": "重新初始化面板账号信息" + "description": "重新初始化面板账号信息", + "adminGetFail": "获取管理员信息失败", + "adminSaveFail": "保存管理员信息失败", + "passwordGenerationFail": "生成密码失败", + "portFail": "获取面板端口失败", + "username": "用户名", + "password": "密码", + "port": "面板端口", + "entrance": "面板入口", + "address": "面板地址" }, "getPort": { "description": "获取面板访问端口",