separate newest comment

This commit is contained in:
BennyThink
2021-07-11 11:37:45 +08:00
parent ca088d8678
commit 688328f6b4
5 changed files with 111 additions and 5 deletions

View File

@@ -352,6 +352,27 @@ class CommentChildHandler(CommentHandler):
self.write(resp)
class CommentNewestHandler(CommentHandler):
class_name = f"CommentNewest{adapter}Resource"
# from Mongo import CommentNewestResource
# instance = CommentNewestResource()
@run_on_executor()
def get_comment(self):
size = int(self.get_argument("size", "5"))
page = int(self.get_argument("page", "1"))
comment_data = self.instance.get_comment(page, size)
self.hide_phone((comment_data["data"]))
return comment_data
@gen.coroutine
def get(self):
resp = yield self.get_comment()
self.write(resp)
class AnnouncementHandler(BaseHandler):
class_name = f"Announcement{adapter}Resource"