feat: 只看审核按俱乐部隔离,商品管理支持俱乐部视图
未绑店出货开关按 club_id 配置;后台商品列表可在具体小程序下管理并切换审核展示。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -139,22 +139,20 @@ class ShopGoodsView(APIView):
|
||||
# 店铺封禁或不属于当前俱乐部 → 公共正常商品
|
||||
data = self._get_public_goods(True)
|
||||
else:
|
||||
# 未绑店:受「是否只看审核」开关控制
|
||||
# 未绑店:受本俱乐部「是否只看审核」开关控制
|
||||
# 开启 → 有特殊身份看正常(=1),否则看审核专用(=2)
|
||||
# 关闭 → 一律看正常公共商品(与身份无关)
|
||||
use_normal = True
|
||||
if self._is_zhi_kan_shenhe_enabled():
|
||||
if self._is_zhi_kan_shenhe_enabled(club_id):
|
||||
use_normal = has_special
|
||||
data = self._get_public_goods(use_normal)
|
||||
|
||||
return Response({'code': 200, 'data': data})
|
||||
|
||||
def _is_zhi_kan_shenhe_enabled(self):
|
||||
"""全局开关:未绑店用户是否按身份只看审核专用商品。默认开启以保持历史行为。"""
|
||||
config = DianpuShangpinShenheShezhi.query.filter(id=1).first()
|
||||
if not config:
|
||||
return True
|
||||
return bool(getattr(config, 'zhi_kan_shenhe', True))
|
||||
def _is_zhi_kan_shenhe_enabled(self, club_id):
|
||||
"""本俱乐部开关:未绑店用户是否按身份只看审核专用商品。默认开启。"""
|
||||
from shop.services.shenhe_config import is_zhi_kan_shenhe_enabled
|
||||
return is_zhi_kan_shenhe_enabled(club_id)
|
||||
|
||||
def _has_special_identity(self, user_main):
|
||||
"""判断用户是否拥有打手/商家/管事/组长任一身份"""
|
||||
|
||||
@@ -237,9 +237,10 @@ class ShopProductModifyView(APIView):
|
||||
# 提取相对路径
|
||||
tupian_url = full_url.replace(settings.COS_DOMAIN.rstrip('/') + '/', '', 1)
|
||||
|
||||
# 审核状态
|
||||
audit_config = DianpuShangpinShenheShezhi.query.filter(id=1).first()
|
||||
shenhe_status = not (audit_config and audit_config.kaiqi_shenhe)
|
||||
# 审核状态(按店铺所属俱乐部)
|
||||
from shop.services.shenhe_config import is_kaiqi_shenhe_enabled
|
||||
shop_club = getattr(dianpu, 'club_id', None) or 'xq'
|
||||
shenhe_status = not is_kaiqi_shenhe_enabled(shop_club)
|
||||
|
||||
ShangpinLeixingDianpu.query.create(
|
||||
dianpu_id=dianpu.id,
|
||||
@@ -320,8 +321,9 @@ class ShopProductModifyView(APIView):
|
||||
|
||||
# 审核重置
|
||||
if content_changed:
|
||||
audit_config = DianpuShangpinShenheShezhi.query.filter(id=1).first()
|
||||
if audit_config and audit_config.kaiqi_shenhe:
|
||||
from shop.services.shenhe_config import is_kaiqi_shenhe_enabled
|
||||
shop_club = getattr(dianpu, 'club_id', None) or 'xq'
|
||||
if is_kaiqi_shenhe_enabled(shop_club):
|
||||
obj.shenhe_zhuangtai = False
|
||||
update_fields.append('shenhe_zhuangtai')
|
||||
|
||||
@@ -872,8 +874,9 @@ class ShopProductModifyView1(APIView):
|
||||
content_changed = True
|
||||
|
||||
if content_changed:
|
||||
audit_config = DianpuShangpinShenheShezhi.query.filter(id=1).first()
|
||||
if audit_config and audit_config.kaiqi_shenhe:
|
||||
from shop.services.shenhe_config import is_kaiqi_shenhe_enabled
|
||||
shop_club = getattr(dianpu, 'club_id', None) or 'xq'
|
||||
if is_kaiqi_shenhe_enabled(shop_club):
|
||||
product.shenhe_zhuangtai = False
|
||||
update_fields.append('shenhe_zhuangtai')
|
||||
|
||||
@@ -962,8 +965,9 @@ class ShopProductModifyView1(APIView):
|
||||
return Response({'code': 400, 'msg': '分成金额不能超过商品价格'})'''
|
||||
|
||||
shenhe_status = True
|
||||
audit_config = DianpuShangpinShenheShezhi.query.filter(id=1).first()
|
||||
if audit_config and audit_config.kaiqi_shenhe:
|
||||
from shop.services.shenhe_config import is_kaiqi_shenhe_enabled
|
||||
shop_club = getattr(dianpu, 'club_id', None) or 'xq'
|
||||
if is_kaiqi_shenhe_enabled(shop_club):
|
||||
shenhe_status = False
|
||||
|
||||
product = Shangpin.query.create(
|
||||
|
||||
Reference in New Issue
Block a user