Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
0
 def get(self):
     mid = request.params['mid']
     movie = Movie.get(mid)
     return movie
Ejemplo n.º 6
0
 def get(self):
     mid = request.args['mid']
     movie = Movie.get(mid)
     if not movie:
         return Code.movie_does_not_exist
     return movie