fix: 回滚公告轮播身份校验,避免前端整页无数据
This commit is contained in:
@@ -149,10 +149,9 @@ class ShangpinGonggaoView(APIView):
|
||||
商品公告和轮播图接口
|
||||
获取类型为1的公告和轮播图
|
||||
"""
|
||||
# 应用节流(限制频率)
|
||||
throttle_classes = [AnonRateThrottle]
|
||||
# 新增:允许所有用户访问(不需要认证)
|
||||
permission_classes = [AllowAny]
|
||||
authentication_classes = [] # 不校验 JWT,避免前端带过期 token 时 401
|
||||
def post(self, request):
|
||||
"""
|
||||
处理POST请求,返回公告和轮播图数据
|
||||
@@ -165,27 +164,9 @@ class ShangpinGonggaoView(APIView):
|
||||
"""
|
||||
try:
|
||||
logger.info("收到商品公告和轮播图请求")
|
||||
from jituan.services.display_config import (
|
||||
get_gonggao_content,
|
||||
get_lunbo_urls,
|
||||
normalize_page_key,
|
||||
resolve_lunbo_page_key_for_request,
|
||||
)
|
||||
|
||||
requested_key = normalize_page_key(request.data.get('page_key'), image_type=1)
|
||||
page_key = resolve_lunbo_page_key_for_request(request, request.data.get('page_key'), image_type=1)
|
||||
if page_key is None:
|
||||
logger.info(
|
||||
"公告轮播 page_key 被拒绝 user=%s requested=%s",
|
||||
getattr(getattr(request, 'user', None), 'UserUID', 'anon'),
|
||||
requested_key,
|
||||
)
|
||||
return Response({
|
||||
"shangpingonggao": "",
|
||||
"shangpinlunbo": [],
|
||||
"page_key": requested_key,
|
||||
}, status=status.HTTP_200_OK)
|
||||
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, page_key=page_key)
|
||||
lunbo_urls = get_lunbo_urls(request, page_key=page_key, image_type=1)
|
||||
response_data = {
|
||||
|
||||
Reference in New Issue
Block a user