feat(gateway): /tenants/current 带上积分余额 + 硬拦截开关(桌面端租户感知用)
面向用户自己的租户(非 admin 口径):返回 credit_balance_micro + credit_enforce, 供桌面端顶栏显余额、并据 enforce 判断是否会因余额不足被拦。复用已有 GetTenant/CreditEnforceEnabled。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -544,6 +544,9 @@ func (h *Handler) TenantCurrent(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"tenant": gin.H{"id": t.ID, "name": t.Name, "slug": t.Slug, "plan": t.Plan, "status": t.Status},
|
"tenant": gin.H{"id": t.ID, "name": t.Name, "slug": t.Slug, "plan": t.Plan, "status": t.Status},
|
||||||
"role": h.db.MemberRole(c.Request.Context(), tid, userID(c)),
|
"role": h.db.MemberRole(c.Request.Context(), tid, userID(c)),
|
||||||
|
// 计费可见性:用户自己租户的积分余额 + 平台是否开了硬拦截(桌面端据此显余额/提示充值)。
|
||||||
|
"credit_balance_micro": t.CreditBalanceMicro,
|
||||||
|
"credit_enforce": h.db.CreditEnforceEnabled(c.Request.Context()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user