Beispiel #1
0
def get_unread_message_count(uid):
    fields = ['count(*) as cnt']
    result = select_all(XVZD_PREFIX__ + 'message',
                        fields,
                        conds={
                            'recv_uid': uid,
                            'readed': None
                        })
    return result[0].get('cnt')
Beispiel #2
0
def get_list(board, page=1, limit=10):
  page -= 1
  if page < 0:
    page = 1
  order = 'desc'
  page_offset = page * limit
  if page_offset > sys.maxint:
    page_offset = 0
  fields = ['no', 'title', 'uid', 'regdate', 'pinned']
  return select_all(XVZD_PREFIX__+board, fields,
                    order=order, limit='%d, %d'%(page_offset, limit))
Beispiel #3
0
def get_sended_message(uid, page, limit=10):
    order = 'desc'
    page -= 1
    if page < 0:
        page = 1
    page_offset = page * limit
    if page_offset > sys.maxint:
        page_offset = 0
    fields = [
        'no', 'recv_uid', 'send_uid', 'readed', 'title', 'content', 'regdate'
    ]
    return select_all(XVZD_PREFIX__ + 'message',
                      fields, {'send_uid': uid},
                      order=order,
                      limit='%d, %d' % (page_offset, limit))
Beispiel #4
0
def get_message_count(uid, limit=10):
    fields = ['count(*) as cnt']
    result = select_all(XVZD_PREFIX__ + 'message', fields)
    return result[0].get('cnt')
Beispiel #5
0
def get_all_notice():
    return select_all(__XVDZ_PREFIX__ + 'notice',
                      ['no', 'title', 'content', 'uid'])
Beispiel #6
0
def get_users():
    fields = ['uid', 'id', 'name', 'password']
    return select_all(XVZD_PREFIX__ + 'users', fields)
Beispiel #7
0
def get_articles(board):
  order = 'desc'
  fields = ['no', 'title', 'uid', 'regdate', 'pinned']
  return select_all(XVZD_PREFIX__+board, fields, order=order)
Beispiel #8
0
def get_pinned(board):
  fields = ['no', 'title', 'uid', 'regdate', 'pinned']
  return select_all(XVZD_PREFIX__+board, fields,
                    conds={'pinned': 1})
Beispiel #9
0
def get_endpage(board, limit=10):
  fields = ['count(*) as cnt']
  result = select_all(XVZD_PREFIX__+board, fields)
  return (int(result[0].get('cnt')) - 1) / limit + 1