Ejemplo n.º 1
0
def game():
	username = request.cookies.get("username")
	usertype = bool(request.cookies.get("usertype"))
	gameName = request.args.get("type")
	toShowUpdate = False

	game_desc_status, game_desc = db_query.searchGame(gameName)
	category_status , category = db_query.findGameCategory(gameName)
	isPurchasedStatus, isPurchased = db_query.purchase(username,gameName)

	print(game_desc)
	order_id=None
	if username == game_desc[0][10]:
		toShowUpdate = True
		
	else:
		if not isPurchased:
			order_amount = int(game_desc[0][4])*100
			order_currency = 'INR'
			
			order_id = client.order.create({'amount':order_amount, 'currency':order_currency})
			

	if game_desc_status==200:
		return render_template("photo-detail.html",game_desc = game_desc,username=username, category=category, purchase=isPurchased,usertype=usertype, order_id=order_id, update=toShowUpdate)
	else:
		return redirect("/")
Ejemplo n.º 2
0
def index():
	username = request.cookies.get("username")
	usertype = bool(request.cookies.get("usertype"))
	print("in index usertype", usertype)
	games_status, games_list = db_query.searchGame("%")
	if games_status == 200:
		return render_template('index.html', games=games_list,username=username,usertype=usertype)
	else:
		flash(games_list)
		return render_template('index.html',games=0,username=username,usertype=usertype)
Ejemplo n.º 3
0
def search():
	username = request.cookies.get("username")
	usertype = bool(request.cookies.get("usertype"))
	if not request.args.get('search'):
		flash("Please provide a correct vlaue")
		return redirect("/")
	game_status, game_list = db_query.searchGame(request.args.get('search'))
	if game_status == 500:
		return redirect("/")
	elif game_status==404:
		flash(game_list)
		return redirect("index.html")
	elif game_list == None:
		return redirect("/")
	return render_template('index.html', games=game_list,username=username,usertype=usertype)