feat:精简
Some checks failed
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Python CI / Format Backend (3.11.x) (push) Has been cancelled
Python CI / Format Backend (3.12.x) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda126-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-slim-images (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled

This commit is contained in:
2026-01-16 18:34:38 +08:00
parent 16263710d9
commit 11fcec9387
137 changed files with 68993 additions and 6435 deletions

View File

@@ -307,8 +307,8 @@ async def create_redemption_codes(
if not form_data.duration_days:
raise HTTPException(status_code=400, detail="duration_days is required for duration type")
elif form_data.redemption_type == "upgrade":
if not form_data.upgrade_expires_at:
raise HTTPException(status_code=400, detail="upgrade_expires_at is required for upgrade type")
if not form_data.upgrade_days:
raise HTTPException(status_code=400, detail="upgrade_days is required for upgrade type")
else:
raise HTTPException(status_code=400, detail="Invalid redemption_type")
@@ -321,12 +321,12 @@ async def create_redemption_codes(
codes = []
for _ in range(form_data.count):
code = RedemptionCodeModel(
code=f"{uuid.uuid4().hex}{uuid.uuid1().hex}",
code=uuid.uuid4().hex[:16].upper(),
purpose=form_data.purpose,
redemption_type=form_data.redemption_type,
plan_id=form_data.plan_id,
duration_days=form_data.duration_days,
upgrade_expires_at=form_data.upgrade_expires_at,
upgrade_days=form_data.upgrade_days,
expired_at=form_data.expired_at,
created_at=now,
)