This commit is contained in:
2026-07-06 17:54:56 +08:00
parent 420b9147fe
commit 73c559ed74
5 changed files with 571 additions and 5 deletions
+8
View File
@@ -31,6 +31,7 @@ class CreditRecordChargeKind(str, Enum):
RECHARGE = "recharge"
REFUND = "refund"
ADMIN_ADJUST = "admin_adjust"
TEAM_INTERNAL = "team_internal"
UNKNOWN = "unknown"
@@ -43,6 +44,7 @@ class CreditRecordSubject(str, Enum):
RECHARGE = "recharge"
REFUND = "refund"
ADMIN_ADJUST = "admin_adjust"
TEAM_INTERNAL = "team_internal"
UNKNOWN = "unknown"
@@ -63,6 +65,7 @@ class CreditRecordSourceModule(str, Enum):
SHOT_REPLICATE = "shot_replicate"
PAYMENT = "payment"
ADMIN = "admin"
TEAM = "team"
UNKNOWN = "unknown"
@@ -105,6 +108,7 @@ class CreditRecordBillingScene(str, Enum):
RECHARGE = "recharge"
ADMIN_ADJUST = "admin_adjust"
REFUND = "refund"
TEAM_INTERNAL_TRANSFER = "team_internal_transfer"
UNKNOWN = "unknown"
@@ -124,6 +128,7 @@ CREDIT_RECORD_SUBJECT_LABELS = {
CreditRecordSubject.RECHARGE.value: "充值积分",
CreditRecordSubject.REFUND.value: "回退积分",
CreditRecordSubject.ADMIN_ADJUST.value: "管理员调整",
CreditRecordSubject.TEAM_INTERNAL.value: "团队内部转移",
CreditRecordSubject.UNKNOWN.value: "历史未知",
}
@@ -138,6 +143,7 @@ CREDIT_RECORD_CHARGE_KIND_LABELS = {
CreditRecordChargeKind.RECHARGE.value: "充值",
CreditRecordChargeKind.REFUND.value: "回退",
CreditRecordChargeKind.ADMIN_ADJUST.value: "管理员调整",
CreditRecordChargeKind.TEAM_INTERNAL.value: "团队内部转移",
CreditRecordChargeKind.UNKNOWN.value: "历史未知",
}
@@ -153,6 +159,7 @@ CREDIT_RECORD_SOURCE_MODULE_LABELS = {
CreditRecordSourceModule.SHOT_REPLICATE.value: "拆镜复刻",
CreditRecordSourceModule.PAYMENT.value: "支付充值",
CreditRecordSourceModule.ADMIN.value: "后台管理",
CreditRecordSourceModule.TEAM.value: "团队管理",
CreditRecordSourceModule.UNKNOWN.value: "历史未知",
}
@@ -191,5 +198,6 @@ CREDIT_RECORD_BILLING_SCENE_LABELS = {
CreditRecordBillingScene.RECHARGE.value: "充值",
CreditRecordBillingScene.ADMIN_ADJUST.value: "管理员调整",
CreditRecordBillingScene.REFUND.value: "回退",
CreditRecordBillingScene.TEAM_INTERNAL_TRANSFER.value: "团队内部转账",
CreditRecordBillingScene.UNKNOWN.value: "历史未知",
}
@@ -7,6 +7,12 @@ from fastapi import HTTPException
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from app.enums.credit_record import (
CreditRecordBillingScene,
CreditRecordChargeKind,
CreditRecordSubject,
CreditRecordSourceModule,
)
from app.enums.team import TeamStatus
from app.enums.user import UserType
from app.models.team import Team
@@ -185,10 +191,10 @@ async def transfer_credits_to_member(
meta = CreditRecordMeta(
owner_type="team_internal_transfer",
owner_id=xfer_id,
charge_kind="team_internal",
credit_subject="team_internal",
source_module="team",
billing_scene="team_internal_transfer",
charge_kind=CreditRecordChargeKind.TEAM_INTERNAL.value,
credit_subject=CreditRecordSubject.TEAM_INTERNAL.value,
source_module=CreditRecordSourceModule.TEAM.value,
billing_scene=CreditRecordBillingScene.TEAM_INTERNAL_TRANSFER.value,
)
return meta