예제 #1
0
파일: app.py 프로젝트: sopnic/ybk
def upsert_account():
    user = request.form.get('user')
    exchange = request.form.get('exchange')
    login_name = request.form.get('login_name')
    login_password = request.form.get('login_password')
    money_password = request.form.get('money_password')
    bank_password = request.form.get('bank_password')
    if add_account(user, exchange, login_name,
                   login_password, money_password, bank_password):
        return jsonify(status=200)
    else:
        return jsonify(status=403, reason='创建/修改账号失败')
예제 #2
0
파일: app.py 프로젝트: sopnic/ybk
def import_account():
    text = request.form.get('text')
    total = 0
    imported = 0
    for line in text.splitlines():
        line = line.strip()
        if not line:
            continue
        vals = line.split()
        vals += [''] * (6 - len(vals))
        user, exchange, login_name, login_password, \
            money_password, bank_password = vals
        r = add_account(user, exchange, login_name, login_password,
                        money_password, bank_password)
        total += 1
        imported += int(r)
    return jsonify(status=200, total=total, imported=imported)