From d5a4670c2ff34bf934f29de44708be4aaf89d7da Mon Sep 17 00:00:00 2001 From: Blizzard Date: Wed, 8 Jul 2026 09:18:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(gateway):=20/tenants/current=20=E5=B8=A6?= =?UTF-8?q?=E4=B8=8A=E7=A7=AF=E5=88=86=E4=BD=99=E9=A2=9D=20+=20=E7=A1=AC?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E5=BC=80=E5=85=B3=EF=BC=88=E6=A1=8C=E9=9D=A2?= =?UTF-8?q?=E7=AB=AF=E7=A7=9F=E6=88=B7=E6=84=9F=E7=9F=A5=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 面向用户自己的租户(非 admin 口径):返回 credit_balance_micro + credit_enforce, 供桌面端顶栏显余额、并据 enforce 判断是否会因余额不足被拦。复用已有 GetTenant/CreditEnforceEnabled。 Co-Authored-By: Claude Opus 4.8 --- sundynix-gateway/internal/handler/task_handler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sundynix-gateway/internal/handler/task_handler.go b/sundynix-gateway/internal/handler/task_handler.go index 2af12c7..9a99457 100644 --- a/sundynix-gateway/internal/handler/task_handler.go +++ b/sundynix-gateway/internal/handler/task_handler.go @@ -544,6 +544,9 @@ func (h *Handler) TenantCurrent(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "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)), + // 计费可见性:用户自己租户的积分余额 + 平台是否开了硬拦截(桌面端据此显余额/提示充值)。 + "credit_balance_micro": t.CreditBalanceMicro, + "credit_enforce": h.db.CreditEnforceEnabled(c.Request.Context()), }) }