Files
Django/shop/services/shenhe_config.py
XingQue 6515568ec0 feat: 只看审核按俱乐部隔离,商品管理支持俱乐部视图
未绑店出货开关按 club_id 配置;后台商品列表可在具体小程序下管理并切换审核展示。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 03:20:03 +08:00

44 lines
1.3 KiB
Python
Raw 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 jituan.constants import CLUB_ID_DEFAULT
from shop.models import DianpuShangpinShenheShezhi
def _norm_club_id(club_id):
return (club_id or CLUB_ID_DEFAULT).strip() or CLUB_ID_DEFAULT
def get_or_create_shenhe_config(club_id):
"""获取或创建某俱乐部的审核展示配置。"""
cid = _norm_club_id(club_id)
config, _ = DianpuShangpinShenheShezhi.objects.get_or_create(
club_id=cid,
defaults={
'kaiqi_shenhe': False,
'zhi_kan_shenhe': True,
},
)
return config
def is_zhi_kan_shenhe_enabled(club_id):
"""
未绑店用户是否只看审核专用商品。
无配置时默认 True保持历史行为。
"""
config = DianpuShangpinShenheShezhi.query.filter(
club_id=_norm_club_id(club_id)
).first()
if not config:
return True
return bool(getattr(config, 'zhi_kan_shenhe', True))
def is_kaiqi_shenhe_enabled(club_id):
"""店铺发布商品是否需平台审核。无配置默认 False。"""
config = DianpuShangpinShenheShezhi.query.filter(
club_id=_norm_club_id(club_id)
).first()
if not config:
return False
return bool(config.kaiqi_shenhe)