feat: Go 重写后端,替换 Python FastAPI
用 Go (Gin + GORM + SQLite) 重写整个后端: - 单二进制部署,不依赖 Python/pip/SDK - net/http 原生客户端,无 Cloudflare TLS 指纹问题 - 多阶段 Dockerfile:Node 构建前端 + Go 构建后端 + Alpine 运行 - 内存占用从 ~95MB 降至 ~3MB - 完整保留所有 API 路由、JWT 认证、API Key 权限、审计日志
This commit is contained in:
34
services/audit.go
Normal file
34
services/audit.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"airwallex-admin/models"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// CreateAuditLog creates a new audit log entry.
|
||||
func CreateAuditLog(db *gorm.DB, action, resourceType, operator, resourceID, ipAddress, details string) {
|
||||
log := models.AuditLog{
|
||||
Action: action,
|
||||
ResourceType: resourceType,
|
||||
ResourceID: resourceID,
|
||||
Operator: operator,
|
||||
IPAddress: ipAddress,
|
||||
Details: details,
|
||||
}
|
||||
db.Create(&log)
|
||||
}
|
||||
|
||||
// CreateCardLog creates a new card operation log entry.
|
||||
func CreateCardLog(db *gorm.DB, action, status, operator, cardID, cardholderID, requestData, responseData string) {
|
||||
log := models.CardLog{
|
||||
CardID: cardID,
|
||||
CardholderID: cardholderID,
|
||||
Action: action,
|
||||
Status: status,
|
||||
Operator: operator,
|
||||
RequestData: requestData,
|
||||
ResponseData: responseData,
|
||||
}
|
||||
db.Create(&log)
|
||||
}
|
||||
Reference in New Issue
Block a user