Files
2026-10-11 23:23:20 +00:00

38 lines
3.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("control", "0010_plan_billing_months_plan_online_payment_required")]
operations = [
migrations.CreateModel(
name="PlanCatalogDraft",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("name", models.CharField(max_length=100, verbose_name="套餐名称")),
("slug", models.SlugField(max_length=80, unique=True, verbose_name="草稿标识")),
("scope", models.CharField(choices=[("personal", "个人"), ("team", "团队共享(待接入)")], max_length=20, verbose_name="套餐类型")),
("traffic_limit_gb", models.PositiveIntegerField(help_text="0 表示不限代理流量,不代表无限带宽、人数或设备。", verbose_name="月代理流量(GB)")),
("price_cny", models.DecimalField(blank=True, decimal_places=2, help_text="留空表示待定价,不是0元免费;填写也不会自动上架。", max_digits=10, null=True, verbose_name="拟定月价(元)")),
("member_limit", models.PositiveIntegerField(blank=True, help_text="个人为1;团队留空表示待确认。", null=True, verbose_name="成员上限")),
("device_limit", models.PositiveIntegerField(blank=True, help_text="团队为全部成员总数;留空表示待确认,不是无限。", null=True, verbose_name="总设备上限")),
("concurrent_limit", models.PositiveIntegerField(blank=True, help_text="留空表示待确认,不是无限。", null=True, verbose_name="同时在线上限")),
("description", models.TextField(blank=True, verbose_name="草案说明")),
("sort_order", models.PositiveSmallIntegerField(default=10, verbose_name="排序")),
("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
("updated_at", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
],
options={
"verbose_name": "套餐草稿(未上架)",
"verbose_name_plural": "套餐草稿(未上架)",
"ordering": ["sort_order", "pk"],
"constraints": [
models.CheckConstraint(condition=models.Q(price_cny__isnull=True) | models.Q(price_cny__gte=0), name="catalog_draft_price_nonnegative"),
models.CheckConstraint(condition=models.Q(member_limit__isnull=True) | models.Q(member_limit__gt=0), name="catalog_draft_members_positive"),
models.CheckConstraint(condition=models.Q(device_limit__isnull=True) | models.Q(device_limit__gt=0), name="catalog_draft_devices_positive"),
models.CheckConstraint(condition=models.Q(concurrent_limit__isnull=True) | models.Q(concurrent_limit__gt=0), name="catalog_draft_concurrent_positive"),
],
},
),
]