feat: add shared media assets and fix credit lifecycle

This commit is contained in:
OpenClaw Agent
2026-09-17 02:30:31 +08:00
parent 7d79d43b61
commit b853a239ff
11 changed files with 351 additions and 19 deletions
+4
View File
@@ -66,6 +66,7 @@ func (a *App) adminCreateRedeemBatch(c *gin.Context) {
c.JSON(500, gin.H{"error": err.Error()})
return
}
a.audit(admin.ID, "redeem.batch.create", "redeem_batch", fmt.Sprint(batch.ID), fmt.Sprintf("credits=%d,count=%d", batch.Credits, batch.Count))
c.JSON(201, gin.H{"batch": batch, "codes": codes})
}
@@ -126,6 +127,7 @@ func (a *App) redeem(c *gin.Context) {
c.JSON(status, gin.H{"error": err.Error()})
return
}
a.audit(user.ID, "redeem.use", "redeem_code", "hash:"+hashRedeemCode(in.Code)[:12], fmt.Sprintf("credits=%d", amount))
c.JSON(200, gin.H{"credits": amount})
}
@@ -135,6 +137,8 @@ func (a *App) adminRevokeRedeemBatch(c *gin.Context) {
c.JSON(500, gin.H{"error": err.Error()})
return
}
admin := c.MustGet("user").(*User)
a.audit(admin.ID, "redeem.batch.revoke", "redeem_batch", id, "unused codes revoked")
c.JSON(200, gin.H{"ok": true})
}