加注释
This commit is contained in:
@@ -63,7 +63,15 @@ func setAuditDetails(c *gin.Context, actionType, description string, targetResou
|
||||
|
||||
// SendSuccessWithAudit 发送成功的响应,并设置审计日志所需的信息。
|
||||
// 这是控制器中用于记录成功操作并返回响应的首选函数。
|
||||
func SendSuccessWithAudit(ctx *gin.Context, code ResponseCode, message string, data interface{}, actionType, description string, targetResource interface{}) {
|
||||
func SendSuccessWithAudit(
|
||||
ctx *gin.Context, // Gin上下文,用于处理HTTP请求和响应
|
||||
code ResponseCode, // 业务状态码,表示操作结果
|
||||
message string, // 提示信息,向用户展示操作结果的文本描述
|
||||
data interface{}, // 业务数据,操作成功后返回的具体数据
|
||||
actionType string, // 审计操作类型,例如"创建用户", "更新配置"
|
||||
description string, // 审计描述,对操作的详细说明
|
||||
targetResource interface{}, // 审计目标资源,被操作的资源对象或其标识
|
||||
) {
|
||||
// 1. 设置审计信息
|
||||
setAuditDetails(ctx, actionType, description, targetResource)
|
||||
// 2. 发送响应
|
||||
@@ -72,7 +80,14 @@ func SendSuccessWithAudit(ctx *gin.Context, code ResponseCode, message string, d
|
||||
|
||||
// SendErrorWithAudit 发送失败的响应,并设置审计日志所需的信息。
|
||||
// 这是控制器中用于记录失败操作并返回响应的首选函数。
|
||||
func SendErrorWithAudit(ctx *gin.Context, code ResponseCode, message string, actionType, description string, targetResource interface{}) {
|
||||
func SendErrorWithAudit(
|
||||
ctx *gin.Context, // Gin上下文,用于处理HTTP请求和响应
|
||||
code ResponseCode, // 业务状态码,表示操作结果
|
||||
message string, // 提示信息,向用户展示操作结果的文本描述
|
||||
actionType string, // 审计操作类型,例如"登录失败", "删除失败"
|
||||
description string, // 审计描述,对操作的详细说明
|
||||
targetResource interface{}, // 审计目标资源,被操作的资源对象或其标识
|
||||
) {
|
||||
// 1. 设置审计信息
|
||||
setAuditDetails(ctx, actionType, description, targetResource)
|
||||
// 2. 发送响应
|
||||
|
||||
Reference in New Issue
Block a user