fix: record original expiry in license restoration audit
Some checks failed
Check / delivery-static (push) Has been cancelled
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
2026-10-12 16:23:02 +08:00
parent 09910db251
commit 58278ba6ed
2 changed files with 20 additions and 6 deletions

View File

@@ -368,6 +368,9 @@ func (a *BusinessAPI) operateLicense(c *gin.Context, operation string) {
apiError(c, 500, "internal_error", "操作失败,请使用相同幂等键重试")
return
}
if operation == "restore" {
expires = rec.ExpiresAt
}
details, _ := json.Marshal(map[string]any{"operation": operation, "expires_at": expires, "license_id": id})
if _, err = tx.ExecContext(c, "INSERT INTO audit_events(actor_admin_id,action,resource_type,resource_id,details) VALUES(?,?, 'license',?,?)", adminID, "license."+operation, id, details); err != nil {
apiError(c, 500, "internal_error", "服务暂时不可用")