def get_game_list(request): """ get game list """ try: if request.method == "GET" or DEBUG is True: page_num = request.GET.get('page_num') game_dict_list = GameLogic.get_game_list(int(page_num)) ret_dict = dict(game_list=game_dict_list) if int(page_num) <= 1: ret_dict["prepageno"] = 1 else: ret_dict["prepageno"] = int(page_num) - 1 ret_dict["nextpageno"] = int(page_num) + 1 ret_dict['total_num']=GameLogic.get_total_num() print "ret_dict", ret_dict ret = render(request, 'gplat/homepage.html', ret_dict) else: ret = dict(code=2001, msg=u"Invalid method. Use POST. You used %s" % request.method) except Exception as e: ret = dict(code=2001, msg=u"Internal error: %s" % str(e)) return ret
def get_game_list_json(request): """ get game list """ try: if request.method == "GET" or DEBUG is True: page_num = request.GET.get('page_num') game_dict_list = GameLogic.get_game_list(int(page_num)) ret_dict = dict(game_list=game_dict_list) ret_dict['total_num']=GameLogic.get_total_num() ret = dict(code=1, content=ret_dict) else: ret = dict(code=2001, msg=u"Invalid method. Use POST. You used %s" % request.method) except Exception as e: ret = dict(code=2001, msg=u"Internal error: %s" % str(e)) return ret