def insert_result(): if 'user' in session: connect = MySQLdb.connect(db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD) myprojects = DashboardService.insertBattleResult(connect, request.form['game_type'], session['user'], request.form['counter'], request.form['result']) connect.close() return json.dumps(myprojects) return 'false'
def myresults(): if 'user' in session: connect = MySQLdb.connect(db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD) myprojects = DashboardService.getMyResultsSummary(connect, session['user'], request.form['game_type']) connect.close() return json.dumps(myprojects) return 'null'
def gen_chara(): if 'user' in session: connect = MySQLdb.connect(db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD) result = DashboardService.genTactics(connect, session['user'], request.form['id']) connect.close() return json.dumps(result) return 'false'
def create_chara(): if 'user' in session: connect = MySQLdb.connect(db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD) myprojects = DashboardService.createCharacter(connect, session['user'], request.form['name'], request.form['game_type']) connect.close() return json.dumps(myprojects) return 'false'
def characters(): if 'user' in session: connect = MySQLdb.connect(db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD) myprojects = DashboardService.getCharacters(connect, session['user']) connect.close() return json.dumps(myprojects) return 'false'
def tactics_editor(pid): if 'user' in session: connect = MySQLdb.connect(db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD) result = DashboardService.getMyCharacter(connect, session['user'], pid) connect.close() return render_template('/game/tactics_editor.html', pid=pid, game_type=result['game_type']) else: return redirect(url_for('login_view'))