def halls(self): cid = request.params['cid'] cinema = Cinema.get(cid) if not cinema: return Code.cinema_does_not_exist cinema.halls = Hall.query.filter_by(cid=cid).all() return cinema
def halls(self): cid = request.params["cid"] cinema = Cinema.get(cid) if not cinema: return Code.cinema_does_not_exist, request.args # return {"msg": "cinema %s is not found" % cid} cinema.halls = Hall.query.filter_by(cid=cid).all() return cinema
def halls(self): cid = request.params['cid'] cinema = Cinema.get(cid) if not cinema: return Code.cinema_dose_not_exist, request.args # 查询数据库中的hall表,取出所有cid等于当前影院的影厅 cinema.halls = Hall.query.filter_by(cid=cid).all() return cinema
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 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 halls(self): cid = request.params['cid'] cinema = Cinema.get(cid) if not cinema: # return 1, request.args 是为了自定了response, return Code.cinema_does_not_exist, request.args cinema.halls = Hall.query.filter_by(cid=cid).all() # return jsonify({ # 'rc': 0, # 'msg': 'succ', # 'data': cinema, # }) return cinema
def get(self): cid = request.params['cid'] cinema = Cinema.get(cid) return cinema
def get(self): cid = request.args["cid"] cinema = Cinema.get(cid) if not cinema: return Code.cinema_does_not_exist, request.args return cinema