feat(jituan): 集团多俱乐部改造 — club 隔离、财务/提现/分红/展示配置
This commit is contained in:
@@ -132,20 +132,17 @@ class ShangpinGonggaoView(APIView):
|
||||
"""
|
||||
try:
|
||||
logger.info("收到商品公告和轮播图请求")
|
||||
# 1. 查询公告(类型为1)
|
||||
gonggao_obj = Gonggao.query.filter(NoticeType=1).first()
|
||||
# 获取公告内容,如果没有则返回空字符串
|
||||
gonggao_content = gonggao_obj.Content if gonggao_obj else ""
|
||||
# 2. 查询轮播图(类型为1,按显示顺序排序)
|
||||
lunbo_queryset = Lunbo.query.filter(ImageType=1)
|
||||
# 提取轮播图URL列表
|
||||
lunbo_urls = [lunbo.ImageURL for lunbo in lunbo_queryset]
|
||||
# 3. 构建返回数据
|
||||
from jituan.services.display_config import get_gonggao_content, get_lunbo_urls, normalize_page_key
|
||||
|
||||
page_key = normalize_page_key(request.data.get('page_key'), image_type=1)
|
||||
gonggao_content = get_gonggao_content(request, notice_type=1)
|
||||
lunbo_urls = get_lunbo_urls(request, page_key=page_key, image_type=1)
|
||||
response_data = {
|
||||
"shangpingonggao": gonggao_content,
|
||||
"shangpinlunbo": lunbo_urls
|
||||
"shangpinlunbo": lunbo_urls,
|
||||
"page_key": page_key,
|
||||
}
|
||||
logger.info(f"返回数据:公告长度{len(gonggao_content)},轮播图数量{len(lunbo_urls)}")
|
||||
logger.info(f"返回数据:公告长度{len(gonggao_content)},轮播图数量{len(lunbo_urls)} page_key={page_key}")
|
||||
# 4. 返回响应
|
||||
return Response(response_data, status=status.HTTP_200_OK)
|
||||
except Exception as e:
|
||||
@@ -3158,9 +3155,13 @@ class PopupConfigView(APIView):
|
||||
'msg': '缺少参数 pageKey'
|
||||
}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# 3. 查询页面配置
|
||||
# 3. 查询页面配置(按俱乐部)
|
||||
from jituan.services.display_config import get_gonggao_content
|
||||
from jituan.services.club_context import resolve_club_id_from_request
|
||||
|
||||
club_id = resolve_club_id_from_request(request)
|
||||
try:
|
||||
popup_page = PopupPage.query.get(page_key=page_key, is_active=True)
|
||||
popup_page = PopupPage.query.get(club_id=club_id, page_key=page_key, is_active=True)
|
||||
except PopupPage.DoesNotExist:
|
||||
# 该页面没有配置弹窗,返回空
|
||||
return Response({
|
||||
@@ -3206,15 +3207,21 @@ class GetWithdrawModeView(APIView):
|
||||
permission_classes = [IsAuthenticated] # JWT 认证
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
# 尝试获取 ID=1 的记录
|
||||
config = WithdrawConfig.query.filter(id=1).first()
|
||||
# 如果存在则取实际值,否则默认 2(手动提现)
|
||||
mode = config.mode if config else 2
|
||||
from jituan.services.club_context import resolve_club_id_from_request
|
||||
from jituan.services.club_user import get_user_club_id
|
||||
from jituan.services.withdraw_config import get_withdraw_mode
|
||||
|
||||
user = getattr(request, 'user', None)
|
||||
club_id = get_user_club_id(user) if user and getattr(user, 'is_authenticated', False) else None
|
||||
if not club_id:
|
||||
club_id = resolve_club_id_from_request(request)
|
||||
mode = get_withdraw_mode(club_id)
|
||||
|
||||
return Response({
|
||||
'code': 0,
|
||||
'data': {
|
||||
'mode': mode
|
||||
'mode': mode,
|
||||
'club_id': club_id,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user