feat: 总会员(包含式)模型、迁移、抢单校验与后台配置

- Huiyuan.is_bundle + club_huiyuan_bundle_include 表
- 购买/到期逻辑不变,抢单时总会员覆盖子会员类型
- dshyhq/clumber 返回 is_bundle 与 included_huiyuan_ids

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-05 18:12:57 +08:00
parent 5754a69e0b
commit 37bc8f960a
10 changed files with 228 additions and 21 deletions

View File

@@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0010_backfill_penalty_czjilu_leixing'),
]
operations = [
migrations.AddField(
model_name='huiyuan',
name='is_bundle',
field=models.BooleanField(default=False, verbose_name='是否为总会员(包含式)'),
),
]

View File

@@ -150,6 +150,7 @@ class Huiyuan(QModel):
blank=True,
verbose_name='所属板块'
)
is_bundle = models.BooleanField(default=False, verbose_name='是否为总会员(包含式)')
class Meta:
db_table = 'huiyuan'

View File

@@ -296,16 +296,18 @@ class DashouHuiyuanList(APIView):
club_row = club_rows.get(huiyuan.huiyuan_id)
card_image = (club_row.card_image or '').strip() if club_row else ''
card_bg = (club_row.card_bg or '').strip() if club_row else ''
is_bundle = bool(getattr(huiyuan, 'is_bundle', False))
huiyuan_list.append({
'id': huiyuan.huiyuan_id,
'mingzi': huiyuan.jieshao,
'jiage': format_yuan(club_price),
'formal_days': formal_days,
'jieshao': huiyuan.jtjieshao,
'trial_enabled': bool(trial_sellable),
'trial_price': format_yuan(trial_price) if trial_sellable else '0.00',
'trial_days': trial_days if trial_sellable else 0,
'can_buy_trial': bool(trial_ok and trial_sellable),
'is_bundle': is_bundle,
'trial_enabled': False if is_bundle else bool(trial_sellable),
'trial_price': '0.00' if is_bundle else (format_yuan(trial_price) if trial_sellable else '0.00'),
'trial_days': 0 if is_bundle else (trial_days if trial_sellable else 0),
'can_buy_trial': False if is_bundle else bool(trial_ok and trial_sellable),
'card_image': card_image,
'card_bg': card_bg,
})