只改了 django/config/views.py 里的 PopupConfigView:
authentication_classes = [] 去掉 user.id 登录检查
This commit is contained in:
@@ -3149,18 +3149,11 @@ class PopupConfigView(APIView):
|
||||
请求格式:POST { "pageKey": "dashouzhongxin" }
|
||||
返回格式:{ "code": 0, "data": { "serverTime": "...", "popups": [...] } }
|
||||
"""
|
||||
permission_classes = [IsAuthenticated] # JWT 认证
|
||||
authentication_classes = []
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
def post(self, request):
|
||||
# 1. 获取当前用户(已通过JWT认证,可直接使用)
|
||||
user = request.user
|
||||
if not user or not user.id:
|
||||
return Response({
|
||||
'code': 401,
|
||||
'msg': '用户未登录或认证失败'
|
||||
}, status=status.HTTP_401_UNAUTHORIZED)
|
||||
|
||||
# 2. 获取参数 pageKey
|
||||
# 获取参数 pageKey
|
||||
page_key = request.data.get('pageKey')
|
||||
if not page_key:
|
||||
return Response({
|
||||
|
||||
Reference in New Issue
Block a user