def plays(self): cid = request.params["cid"] cinema = Cinema.get(cid) if not cinema: return Code.cinema_does_not_exist.request.args cinema.plays = Play.query.filter_by(cid=cid).all() for play in cinema.plays: play.movie = Movie.get(play.mid) return cinema
def ticket_info(self): orderno = request.params['orderno'] order = Order.getby_orderno(orderno) if not order: return Code.order_does_not_exist, {'orderno': orderno} order.play = Play.get(order.pid) order.movie = Movie.get(order.play.mid) order.tickets = PlaySeat.getby_orderno(orderno) return order
def plays(self): cid = request.params['cid'] cinema = Cinema.get(cid) if not cinema: return Code.cinema_does_not_exist, {'cid': cid} cinema.plays = Play.query.filter_by(cid=cid).all() if not cinema: return Code.cinema_does_not_exist, {'cid': cid} for play in cinema.plays: play.movies = Movie.get(play.mid) return cinema
def plays(self): # 使用Request.Params["id"]来获取参数是一种比较有效的途径。 cid = request.params['cid'] cinema = Cinema.get(cid) if not cinema: return Code.cinema_does_not_exist, request.args cinema.plays = Play.query.filter_by(cid=cid).all() for play in cinema.plays: play.movie = Movie.get(play.mid) # 为啥返回的是cinema return cinema
def get(self): mid = request.params['mid'] movie = Movie.get(mid) return movie
def get(self): mid = request.args['mid'] movie = Movie.get(mid) if not movie: return Code.movie_does_not_exist return movie