Beispiel #1
0
def getaward_all():
    user = session.get('user_info')
    username = user.get('username')

    error_message = ''
    success_message = ''
    for b_user_id in r_session.smembers('accounts:%s' % username):

        account_key = 'account:%s:%s' % (username, b_user_id.decode("utf-8"))
        account_info = json.loads(r_session.get(account_key).decode("utf-8"))

        session_id = account_info.get('session_id')
        user_id = account_info.get('user_id')

        cookies = dict(sessionid=session_id, userid=str(user_id))
        r = api_getaward(cookies)
        if r.get('rd') != 'ok':
            error_message += 'Id:%s : %s<br />' % (user_id, r.get('rd'))
            red_log('手动执行', '转盘', user_id, r.get('rd'))
        else:
            success_message += 'Id:%s : 获得:%s  下次转需要:%s 秘银.<br />' % (user_id, regular_html(r.get('tip')), r.get('cost'))
            red_log('手动执行', '转盘', user_id, '获得:%s' % regular_html(r.get('tip')))
            account_data_key = account_key + ':data'
            account_data_value = json.loads(r_session.get(account_data_key).decode("utf-8"))
            account_data_value.get('mine_info')['td_not_in_a'] = 0
            r_session.set(account_data_key, json.dumps(account_data_value))
    if len(success_message) > 0:
        session['info_message'] = success_message

    if len(error_message) > 0:
        session['error_message'] = error_message

    return redirect(url_for('excavators'))
Beispiel #2
0
def getaward_id(user_id):
    user = session.get('user_info')
    account_key = 'account:%s:%s' % (user.get('username'), user_id)
    account_info = json.loads(r_session.get(account_key).decode("utf-8"))

    session_id = account_info.get('session_id')
    user_id = account_info.get('user_id')

    cookies = dict(sessionid=session_id, userid=str(user_id))
    r = api_getaward(cookies)
    if r.get('rd') != 'ok':
        session['error_message'] = r.get('rd')
        red_log('手动执行', '转盘', user_id, r.get('rd'))
        return redirect(url_for('excavators'))
    else:
        session['info_message'] = '获得:%s  下次转需要:%s秘银.<br />' % (regular_html(
            r.get('tip')), r.get('cost'))
        red_log('手动执行', '转盘', user_id, '获得:%s' % regular_html(r.get('tip')))
    account_data_key = account_key + ':data'
    account_data_value = json.loads(
        r_session.get(account_data_key).decode("utf-8"))
    account_data_value.get('mine_info')['td_not_in_a'] = 0
    r_session.set(account_data_key, json.dumps(account_data_value))

    return redirect(url_for('excavators'))
Beispiel #3
0
def getaward_id(user_id):
    user = session.get('user_info')

    account_key = 'account:%s:%s' % (user.get('username'), user_id)
    account_info = json.loads(r_session.get(account_key).decode("utf-8"))

    session_id = account_info.get('session_id')
    user_id = account_info.get('user_id')

    cookies = dict(sessionid=session_id, userid=str(user_id))
    r = api_getaward(cookies)
    if r.get('rd') != 'ok':
        session['error_message'] = r.get('rd')
        return redirect(url_for('excavators'))
    else:
        session['info_message'] = '获得:%s  下次转需要:%s秘银.<br />' % (regular_html(r.get('tip')), r.get('cost'))

    return redirect(url_for('excavators'))
Beispiel #4
0
def async_getaward_all(username):
    for b_user_id in r_session.smembers('accounts:%s' % username):

        account_key = 'account:%s:%s' % (username, b_user_id.decode("utf-8"))
        account_info = json.loads(r_session.get(account_key).decode("utf-8"))

        session_id = account_info.get('session_id')
        user_id = account_info.get('user_id')

        cookies = dict(sessionid=session_id, userid=str(user_id))
        r = api_getaward(cookies)
        if r.get('rd') != 'ok':
            red_log('手动执行', '转盘', user_id, r.get('rd'), username)
        else:
            red_log('手动执行', '转盘', user_id, '获得:%s' % regular_html(r.get('tip')), username)
            account_data_key = account_key + ':data'
            account_data_value = json.loads(r_session.get(account_data_key).decode("utf-8"))
            account_data_value.get('mine_info')['td_not_in_a'] = 0
            r_session.set(account_data_key, json.dumps(account_data_value))
Beispiel #5
0
def getaward_all(user_id):
    user = session.get('user_info')
    account_key = 'account:%s:%s' % (user.get('username'), user_id)
    account_info = json.loads(r_session.get(account_key).decode("utf-8"))

    session_id = account_info.get('session_id')
    user_id = account_info.get('user_id')

    cookies = dict(sessionid=session_id, userid=str(user_id))
    t = api_getaward(cookies)
    if t.get('rd') != 'ok':
        session['error_message'] = '%s' % t.get('rd')
    else:
        session['info_message'] = '转盘成功,获得:%s  下次转需要:%s秘银.<br />' % (unquote(t.get('tip')), t.get('cost'))
        account_data_key = account_key + ':data'
        account_data_value = json.loads(r_session.get(account_data_key).decode("utf-8"))
        account_data_value.get('mine_info')['td_not_in_a'] = 0
        r_session.set(account_data_key, json.dumps(account_data_value))

    return redirect(url_for('excavators'))
Beispiel #6
0
def getaward_all(user_id):
    user = session.get('user_info')
    account_key = 'account:%s:%s' % (user.get('username'), user_id)
    account_info = json.loads(r_session.get(account_key).decode("utf-8"))

    session_id = account_info.get('session_id')
    user_id = account_info.get('user_id')

    cookies = dict(sessionid=session_id, userid=str(user_id))
    t = api_getaward(cookies)
    if t.get('rd') != 'ok':
        session['error_message'] = '%s' % t.get('rd')
    else:
        session['info_message'] = '转盘成功,获得:%s  下次转需要:%s秘银.<br />' % (unquote(
            t.get('tip')), t.get('cost'))
        account_data_key = account_key + ':data'
        account_data_value = json.loads(
            r_session.get(account_data_key).decode("utf-8"))
        account_data_value.get('mine_info')['td_not_in_a'] = 0
        r_session.set(account_data_key, json.dumps(account_data_value))

    return redirect(url_for('excavators'))
Beispiel #7
0
def getaward_id(user_id):
    user = session.get('user_info')
    account_key = 'account:%s:%s' % (user.get('username'), user_id)
    account_info = json.loads(r_session.get(account_key).decode("utf-8"))

    session_id = account_info.get('session_id')
    user_id = account_info.get('user_id')

    cookies = dict(sessionid=session_id, userid=str(user_id))
    r = api_getaward(cookies)
    if r.get('rd') != 'ok':
        session['error_message'] = r.get('rd')
        red_log('手动执行', '转盘', user_id, r.get('rd'))
        return redirect(url_for('excavators'))
    else:
        session['info_message'] = '获得:%s  下次转需要:%s秘银.<br />' % (regular_html(r.get('tip')), r.get('cost'))
        red_log('手动执行', '转盘', user_id, '获得:%s' % regular_html(r.get('tip')))
    account_data_key = account_key + ':data'
    account_data_value = json.loads(r_session.get(account_data_key).decode("utf-8"))
    account_data_value.get('mine_info')['td_not_in_a'] = 0
    r_session.set(account_data_key, json.dumps(account_data_value))

    return redirect(url_for('excavators'))