diff --git a/GVSite b/GVSite index ce8ce23d..84251cd5 160000 --- a/GVSite +++ b/GVSite @@ -1 +1 @@ -Subproject commit ce8ce23d344bf86a96048c8ea8e5dcbb858490bd +Subproject commit 84251cd531819cbb73b510572202b64adc232512 diff --git a/TempLate/index.html b/TempLate/index.html index b5331f3a..9513fa0f 100644 --- a/TempLate/index.html +++ b/TempLate/index.html @@ -5,7 +5,7 @@ 银河锋锐软件开发工作室 - + diff --git a/backup/www/index.html b/backup/www/index.html index fd216eeb..b5331f3a 100644 --- a/backup/www/index.html +++ b/backup/www/index.html @@ -5,8 +5,8 @@ 银河锋锐软件开发工作室 - - + +
diff --git a/gvsds/apps/community/views.py b/gvsds/apps/community/views.py index fa868e8c..5464fc45 100644 --- a/gvsds/apps/community/views.py +++ b/gvsds/apps/community/views.py @@ -75,6 +75,13 @@ def _TimeStr(dt): return str(dt) +def _AvatarURL(user_bytes): + """作者头像 URL(ugm 公开头像接口,按用户 UUID)""" + if not user_bytes: + return '' + return 'https://www.gvsds.com/api/ugm/user-avatar/by-uuid/?UserUUID=' + UUIDObj(user_bytes).str + + class CommunityBoardsView(APIView): """板块列表(含分类与各板块帖子数)""" @@ -134,6 +141,7 @@ class CommunityPostsView(APIView): 'BoardUUID': UUIDObj(p.BoardUUID).str, 'Title': p.Title, 'AuthorName': p.AuthorName, + 'AuthorAvatar': _AvatarURL(p.AuthorUUID), 'ViewCount': p.ViewCount, 'LikeCount': p.LikeCount, 'ReplyCount': p.ReplyCount, @@ -165,6 +173,7 @@ class CommunityPostDetailView(APIView): replies.append({ 'ReplyUUID': UUIDObj(r.ReplyUUID).str, 'AuthorName': r.AuthorName, + 'AuthorAvatar': _AvatarURL(r.AuthorUUID), 'Content': r.Content, 'ReplyToUUID': UUIDObj(r.ReplyToUUID).str if r.ReplyToUUID else '', 'CreateTime': _TimeStr(r.CreateTime), @@ -180,6 +189,7 @@ class CommunityPostDetailView(APIView): 'Title': post.Title, 'Content': post.Content, 'AuthorName': post.AuthorName, + 'AuthorAvatar': _AvatarURL(post.AuthorUUID), 'ViewCount': post.ViewCount, 'LikeCount': post.LikeCount, 'ReplyCount': post.ReplyCount, diff --git a/gvsds/apps/ugm/views.py b/gvsds/apps/ugm/views.py index 58b1c678..6e3c0909 100644 --- a/gvsds/apps/ugm/views.py +++ b/gvsds/apps/ugm/views.py @@ -350,7 +350,9 @@ class GetUserAvatarView(APIView): class GetArgsUserAvatarView(APIView): - permission_classes = [IsAuthenticated] + """按 UserUUID 查询用户头像(公开:社区等对外页面无需登录即可展示头像)""" + + permission_classes = [AllowAny] def get(self, request): user_uuid_str = request.query_params.get('UserUUID')