示例#1
0
def get_article_list(page):
    try:
        sql = "select id, title, publish_time, summary from article order by id desc limit %s, %s"
        cur_page = page+1
        all_page = db.get('select count(*) as count from article')
        all_page = all_page['count']/(page+1)
        articles = db.query(sql, page, page_count)
    except Exception, e:
        print e
        return {'err': -1, 'err_msg': '系统错误'}
示例#2
0
def get_article(article_id):
    try:
        article_id = int(article_id)
        if article_id < 1:
            return None
        sql = "select id, title, html, publish_time, content from article where id = %s"
        article = db.get(sql, article_id)
        return article
    except Exception, e:
        print e
        return None