fix: operation log text (#14173)

This commit is contained in:
Yuki Guo
2026-10-23 18:19:30 +08:00
committed by GitHub
parent ec998552b9
commit e7b4146e1b
7 changed files with 29 additions and 36 deletions
+3 -2
View File
@@ -61,13 +61,14 @@ func (b *BaseApi) CreateRuntime(c *gin.Context) {
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /runtimes/del [post]
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除运行环境 [id]","formatEN":"Delete runtime [id]"}
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除运行环境 [name]","formatEN":"Delete runtime [name]"}
func (b *BaseApi) DeleteRuntime(c *gin.Context) {
var req request.RuntimeDelete
if err := helper.CheckBindAndValidate(&req, c); err != nil {
return
}
err := runtimeService.Delete(req)
name, err := runtimeService.Delete(req)
helper.SetOperationLogValues(c, map[string]string{"name": name})
if err != nil {
helper.InternalServer(c, err)
return
+1 -1
View File
@@ -402,7 +402,7 @@ func (b *BaseApi) ChangeDefaultServer(c *gin.Context) {
// @Security ApiKeyAuth
// @Security Timestamp
// @Router /websites/php/version [post]
// @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteId","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"php 版本变更 [domain]","formatEN":"php version update [domain]"}
// @x-panel-log {"bodyKeys":["websiteID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteID","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"php 版本变更 [domain]","formatEN":"php version update [domain]"}
func (b *BaseApi) ChangePHPVersion(c *gin.Context) {
var req request.WebsitePHPVersionReq
if err := helper.CheckBindAndValidate(&req, c); err != nil {
+5 -5
View File
@@ -46,7 +46,7 @@ type RuntimeService struct {
type IRuntimeService interface {
Page(req request.RuntimeSearch) (int64, []response.RuntimeDTO, error)
Create(create request.RuntimeCreate) (*model.Runtime, error)
Delete(delete request.RuntimeDelete) error
Delete(delete request.RuntimeDelete) (string, error)
Update(req request.RuntimeUpdate) error
Get(id uint) (res *response.RuntimeDTO, err error)
GetNodePackageRunScript(req request.NodePackageReq) ([]response.PackageScripts, error)
@@ -376,16 +376,16 @@ func (r *RuntimeService) DeleteCheck(runTimeId uint) ([]dto.AppResource, error)
return res, nil
}
func (r *RuntimeService) Delete(runtimeDelete request.RuntimeDelete) error {
func (r *RuntimeService) Delete(runtimeDelete request.RuntimeDelete) (string, error) {
runtime, err := runtimeRepo.GetFirst(context.Background(), repo.WithByID(runtimeDelete.ID))
if err != nil {
return err
return "", err
}
website, _ := websiteRepo.GetFirst(websiteRepo.WithRuntimeID(runtimeDelete.ID))
if website.ID > 0 {
return buserr.New("ErrDelWithWebsite")
return runtime.Name, buserr.New("ErrDelWithWebsite")
}
return startRuntimeDeleteTask(runtimeDelete, runtime)
return runtime.Name, startRuntimeDeleteTask(runtimeDelete, runtime)
}
func startRuntimeDeleteTask(runtimeDelete request.RuntimeDelete, runtime *model.Runtime) error {
+5 -7
View File
@@ -3740,13 +3740,11 @@
"formatEN": "Create runtime [name]"
},
"/runtimes/del": {
"bodyKeys": [
"id"
],
"bodyKeys": [],
"paramKeys": [],
"beforeFunctions": [],
"formatZH": "删除运行环境 [id]",
"formatEN": "Delete runtime [id]"
"formatZH": "删除运行环境 [name]",
"formatEN": "Delete runtime [name]"
},
"/runtimes/operate": {
"bodyKeys": [
@@ -4582,13 +4580,13 @@
},
"/websites/php/version": {
"bodyKeys": [
"websiteId"
"websiteID"
],
"paramKeys": [],
"beforeFunctions": [
{
"input_column": "id",
"input_value": "websiteId",
"input_value": "websiteID",
"isList": false,
"db": "websites",
"output_column": "primary_domain",
+5 -7
View File
@@ -21983,11 +21983,9 @@ const docTemplate = `{
],
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"id"
],
"formatEN": "Delete runtime [id]",
"formatZH": "删除运行环境 [id]",
"bodyKeys": [],
"formatEN": "Delete runtime [name]",
"formatZH": "删除运行环境 [name]",
"paramKeys": []
}
}
@@ -28072,14 +28070,14 @@ const docTemplate = `{
{
"db": "websites",
"input_column": "id",
"input_value": "websiteId",
"input_value": "websiteID",
"isList": false,
"output_column": "primary_domain",
"output_value": "domain"
}
],
"bodyKeys": [
"websiteId"
"websiteID"
],
"formatEN": "php version update [domain]",
"formatZH": "php 版本变更 [domain]",
+5 -7
View File
@@ -21979,11 +21979,9 @@
],
"x-panel-log": {
"BeforeFunctions": [],
"bodyKeys": [
"id"
],
"formatEN": "Delete runtime [id]",
"formatZH": "删除运行环境 [id]",
"bodyKeys": [],
"formatEN": "Delete runtime [name]",
"formatZH": "删除运行环境 [name]",
"paramKeys": []
}
}
@@ -28068,14 +28066,14 @@
{
"db": "websites",
"input_column": "id",
"input_value": "websiteId",
"input_value": "websiteID",
"isList": false,
"output_column": "primary_domain",
"output_value": "domain"
}
],
"bodyKeys": [
"websiteId"
"websiteID"
],
"formatEN": "php version update [domain]",
"formatZH": "php 版本变更 [domain]",
+5 -7
View File
@@ -3740,13 +3740,11 @@
"formatEN": "Create runtime [name]"
},
"/runtimes/del": {
"bodyKeys": [
"id"
],
"bodyKeys": [],
"paramKeys": [],
"beforeFunctions": [],
"formatZH": "删除运行环境 [id]",
"formatEN": "Delete runtime [id]"
"formatZH": "删除运行环境 [name]",
"formatEN": "Delete runtime [name]"
},
"/runtimes/operate": {
"bodyKeys": [
@@ -4582,13 +4580,13 @@
},
"/websites/php/version": {
"bodyKeys": [
"websiteId"
"websiteID"
],
"paramKeys": [],
"beforeFunctions": [
{
"input_column": "id",
"input_value": "websiteId",
"input_value": "websiteID",
"isList": false,
"db": "websites",
"output_column": "primary_domain",