コード例 #1
0
ファイル: handlers.py プロジェクト: hearain528/blog
def api_article_delete(*, request, article_id):
    r = web.Response()
    #删除文章表里面的数据
    blog = Blogs(id = article_id)
    blog_result = yield from blog.delete()
    #删除blog_tag表里面的数据
    blog_tag_sql = 'delete from blog_tag where blog_id = ?'
    yield from execute(blog_tag_sql, [article_id])
    #删除blog_category表里面的数据
    blog_category_sql = 'delete from blog_category where blog_id = ?'
    yield from execute(blog_category_sql, [article_id])
    if int(article_id) > 0 and int(blog_result) > 0:
        result = APIResult(1, '', '删除成功')
    else:
        result = APIResult(0, '', '删除失败')
    return jsonResult(r, result)