28 lines
555 B
Go
28 lines
555 B
Go
package paymentconfig
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"hfb_sys/backend/internal/model"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func appendAuditLog(tx *gorm.DB, actorID uint64, action string, bizID uint64, meta AuditMeta, detail map[string]any) error {
|
|
detailJSON, err := json.Marshal(detail)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
log := model.AuditLog{
|
|
ActorType: "admin",
|
|
ActorID: actorID,
|
|
Action: action,
|
|
BizType: "payment_config",
|
|
BizID: &bizID,
|
|
IP: meta.IP,
|
|
UserAgent: meta.UserAgent,
|
|
Detail: detailJSON,
|
|
}
|
|
return tx.Create(&log).Error
|
|
}
|