示例#1
0
文件: mail.py 项目: pengzhr/argon
    def get(self, start=None):
        userid = self.get_current_user()
        if not userid:
            self.write({"success": False, "content": "未认证用户!"})
            return

        total = manager.mail.get_mail_total(userid)
        if start is None:
            start = manager.mail.get_first_unread(userid)
            if start == 0:
                start = total
            start = start // 20 * 20
        else:
            start = int(start)

        if start > total:
            self.write({"success": False, "content": "没有新的数据!"})
            return

        if start < 0:
            start = total - self.page_size
            if start < 0:
                start = 0

        maillist = manager.mail.get_mail_simple(userid, start, self.page_size)
        for li in maillist:
            li["sendtime"] = timeformat(li["sendtime"])
        self.write({"success": True, "content": maillist, "start": start})
示例#2
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": "没有该邮件!",
     })
示例#3
0
文件: mail.py 项目: pengzhr/argon
 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": "没有该邮件!"})
示例#4
0
    def get(self, start=None):
        userid = self.get_current_user()
        if not userid:
            self.write({
                "success": False,
                "content": "未认证用户!",
            })
            return

        total = manager.mail.get_mail_total(userid)
        if start is None:
            start = manager.mail.get_first_unread(userid)
            if start == 0:
                start = total
            start = start // 20 * 20
        else:
            start = int(start)

        if start > total:
            self.write({
                "success": False,
                "content": "没有新的数据!",
            })
            return

        if (start < 0):
            start = total - self.page_size
            if start < 0:
                start = 0

        maillist = manager.mail.get_mail_simple(userid, start, self.page_size)
        for li in maillist:
            li['sendtime'] = timeformat(li['sendtime'])
        self.write({
            "success": True,
            "content": maillist,
            "start": start,
        })