fix: 修复日志记录应用列为空的问题
- 添加LogOperationWithApp方法支持传入ApplicationID - 创建/更新/删除卡密类型时记录ApplicationID - 创建/更新应用时记录ApplicationID
This commit is contained in:
@@ -242,7 +242,7 @@ func handleCreateApplication(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
service.LogOperation(c, "create", "application", &app.ID, fmt.Sprintf("创建应用: %s", app.Name), nil)
|
||||
service.LogOperationWithApp(c, &app.ID, "create", "application", &app.ID, fmt.Sprintf("创建应用: %s", app.Name), nil)
|
||||
|
||||
response.Success(c, gin.H{
|
||||
"application": app,
|
||||
@@ -405,7 +405,7 @@ func handleUpdateApplication(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
service.LogOperation(c, "update", "application", &app.ID, fmt.Sprintf("更新应用: %s", app.Name), nil)
|
||||
service.LogOperationWithApp(c, &app.ID, "update", "application", &app.ID, fmt.Sprintf("更新应用: %s", app.Name), nil)
|
||||
|
||||
response.Success(c, app)
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ func handleCreateCardType(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
service.LogOperation(c, "create", "card_type", &cardType.ID, fmt.Sprintf("创建卡密类型: %s", cardType.Name), nil)
|
||||
service.LogOperationWithApp(c, &cardType.ApplicationID, "create", "card_type", &cardType.ID, fmt.Sprintf("创建卡密类型: %s", cardType.Name), nil)
|
||||
|
||||
response.Success(c, cardType)
|
||||
}
|
||||
@@ -329,7 +329,7 @@ func handleUpdateCardType(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
service.LogOperation(c, "update", "card_type", &cardType.ID, fmt.Sprintf("更新卡密类型: %s", cardType.Name), nil)
|
||||
service.LogOperationWithApp(c, &cardType.ApplicationID, "update", "card_type", &cardType.ID, fmt.Sprintf("更新卡密类型: %s", cardType.Name), nil)
|
||||
|
||||
response.Success(c, cardType)
|
||||
}
|
||||
@@ -349,7 +349,7 @@ func handleDeleteCardType(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
service.LogOperation(c, "delete", "card_type", &cardType.ID, fmt.Sprintf("删除卡密类型: %s", cardType.Name), nil)
|
||||
service.LogOperationWithApp(c, &cardType.ApplicationID, "delete", "card_type", &cardType.ID, fmt.Sprintf("删除卡密类型: %s", cardType.Name), nil)
|
||||
|
||||
response.Success(c, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user