fix: 总榜按邀请总人数排行,组长去重统计;总会员子类型解析增强
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -80,6 +80,17 @@ def get_bundle_included_ids(club_id, bundle_huiyuan_id):
|
||||
)
|
||||
if ids:
|
||||
return ids
|
||||
stored_bids = ClubHuiyuanBundleInclude.objects.filter(
|
||||
club_id=club_id,
|
||||
).values_list('bundle_huiyuan_id', flat=True).distinct()
|
||||
for stored_bid in stored_bids:
|
||||
if huiyuan_ids_match(stored_bid, bundle_huiyuan_id):
|
||||
return list(
|
||||
ClubHuiyuanBundleInclude.query.filter(
|
||||
club_id=club_id,
|
||||
bundle_huiyuan_id=stored_bid,
|
||||
).values_list('included_huiyuan_id', flat=True)
|
||||
)
|
||||
return []
|
||||
|
||||
|
||||
@@ -112,16 +123,22 @@ def _membership_club_candidates(yonghu_id, club_id=None, record_club_id=None):
|
||||
|
||||
|
||||
def resolve_bundle_included_ids(bundle_huiyuan_id, club_id=None, yonghu_id=None, record_club_id=None):
|
||||
"""按候选俱乐部解析总会员包含的子会员(只读,首个非空配置即返回)。"""
|
||||
"""按候选俱乐部合并总会员包含的子会员(去重,只读)。"""
|
||||
if not bundle_huiyuan_id:
|
||||
return []
|
||||
merged = []
|
||||
seen = set()
|
||||
for cid in _membership_club_candidates(
|
||||
yonghu_id, club_id=club_id, record_club_id=record_club_id,
|
||||
):
|
||||
ids = get_bundle_included_ids(cid, bundle_huiyuan_id)
|
||||
if ids:
|
||||
return list(ids)
|
||||
return []
|
||||
for hid in get_bundle_included_ids(cid, bundle_huiyuan_id):
|
||||
norm = normalize_huiyuan_id(hid)
|
||||
core = norm.lstrip('0') or '0' if norm else ''
|
||||
dedupe_key = core or norm
|
||||
if dedupe_key and dedupe_key not in seen:
|
||||
seen.add(dedupe_key)
|
||||
merged.append(hid)
|
||||
return merged
|
||||
|
||||
|
||||
def _included_huiyuan_id_set(included_ids):
|
||||
|
||||
Reference in New Issue
Block a user