Beispiel #1
0
def api_msg_count(*, userid):
    if not userid:
        raise APIValueError('userid')
    newmsgs = yield from Message.findAll('isovertime=False AND touserid=?',
                                         [userid])
    remindmsgs = yield from RemindMsg.findAll(
        'isovertime=False AND touserid=?', [userid])
    return {'newmsgs': len(newmsgs), 'remindmsgs': len(remindmsgs)}
def personal_get_message(*, user_id, page='1'):
    page_index = get_page_index(page)
    num = yield from Message.findNumber('count(*)',
                                        where="recv_id='" + user_id + "'")
    p = Page(num, page_index, 1)
    messages = yield from Message.findAll(where="recv_id='" + user_id + "'",
                                          orderBy="created_at desc",
                                          limit=(p.offset, p.limit))
    return dict(messages=messages, page=p)
Beispiel #3
0
def message():
    messages = Message.findAll(orderBy='created_at desc')
    return render_template('message.html',
                           messages=messages,
                           __user__=request.__user__)
Beispiel #4
0
def message():
    messages = yield from Message.findAll(orderBy='created_at desc')
    return {'__template__': 'message.html', 'messages': messages}