Ejemplo n.º 1
0
 def get(self, mid):
     userid = self.get_current_user()
     if not userid:
         self.write({
             "success": False,
             "content": "没有登录",
         })
         return
     mail = manager.mail.one_mail(mid)
     if mail and (mail.touserid == userid):
         manager.mail.set_mail_read(mid)
         self.write({
             "success": True,
             "UserAvatar": url_for_avatar(mail.fromuserid),
             "Title": mail.title,
             "Userid": mail.fromuserid,
             "Content": mail.content,
             "Sendtime": timeformat(mail.sendtime),
             "Signature": mail.signature,
             "Mid": mail.mid,
         })
         return
     self.write({
         "success": False,
         "content": "没有该邮件!",
     })
Ejemplo n.º 2
0
 def render(self, userid):
     if userid is not None:
         userfav = map(bid_wrapper(userid),
                       manager.favourite.get_all(userid))
         return self.render_string(
             "ui/userbox.html", userid=userid,
             url_for_avatar=url_for_avatar(userid),
             userfav=userfav)
     else:
         return self.render_string("ui/userbox.html", userid=userid)
Ejemplo n.º 3
0
 def render(self, userid):
     if userid is not None:
         userfav = map(bid_wrapper(userid),
                       manager.favourite.get_all(userid))
         return self.render_string("ui/userbox.html",
                                   userid=userid,
                                   url_for_avatar=url_for_avatar(userid),
                                   userfav=userfav)
     else:
         return self.render_string("ui/userbox.html", userid=userid)
Ejemplo n.º 4
0
 def get(self, mid):
     userid = self.get_current_user()
     if not userid:
         self.write({"success": False, "content": "没有登录"})
         return
     mail = manager.mail.one_mail(mid)
     if mail and (mail.touserid == userid):
         manager.mail.set_mail_read(mid)
         self.write(
             {
                 "success": True,
                 "UserAvatar": url_for_avatar(mail.fromuserid),
                 "Title": mail.title,
                 "Userid": mail.fromuserid,
                 "Content": mail.content,
                 "Sendtime": timeformat(mail.sendtime),
                 "Signature": mail.signature,
                 "Mid": mail.mid,
             }
         )
         return
     self.write({"success": False, "content": "没有该邮件!"})