Ejemplo n.º 1
0
def book_comment():
    form = CommentForm().validate_for_api()
    book_id = form.data["book_id"]
    content = form.data["content"]
    http = Http()
    res = http.book_comment(book_id, content)
    return jsonify(res)
Ejemplo n.º 2
0
def search():
    form = BookSearchForm().validate_for_api()
    start = form.start.data
    count = form.count.data
    summary = form.summary.data
    q = form.q.data
    http = Http()
    res = http.book_search(start, count, summary, q)
    return jsonify(res)
Ejemplo n.º 3
0
def book_favor_info(book_id):
    uid = g.user.uid
    http = Http()
    fav_nums = http.get_like_info(book_id)
    book_like_info = Tap.query.filter_by(uid=uid, type=400,
                                         cid=book_id).first()
    if book_like_info is None:
        like_status = 0
    else:
        like_status = 1
    return jsonify({
        "fav_nums": fav_nums,
        "id": book_id,
        "like_status": like_status
    })
Ejemplo n.º 4
0
def get_detail(id):
    http = Http()
    res = http.get_detail(id)
    return jsonify(res)
Ejemplo n.º 5
0
def get_hot_keyword():
    http = Http()
    res = http.get_hot_keyword()
    return jsonify(res)
Ejemplo n.º 6
0
def get_book_comment(book_id):
    http = Http()
    res = http.get_book_comment(book_id)
    return jsonify(res)
Ejemplo n.º 7
0
def get_hot_list():
    http = Http()
    res = http.get_hot_list()
    return jsonify(res)