示例#1
0
文件: book.py 项目: junxian123/yushu
def get_book_detail(bid):
    uid = g.user.id
    is_wisher = False
    is_gifter = Gift.is_gifter(bid, uid)
    if not is_gifter:
        is_wisher = Wish.is_wisher(bid, uid)

    book = Book.get_detail(bid)
    gifts = Gift.get_gifts_by_bid(bid)
    wishes = Wish.get_wishes_by_bid(bid)

    book_detail = BookDetailViewModel(is_gifter, is_wisher, book, gifts,
                                      wishes)
    return jsonify(book_detail), 200
示例#2
0
def get_book(bid):
    book = Book.get_detail(bid)
    return jsonify(book)