Example #1
0
def user_data_del():
    user = session.get('user_info')

    for key in r_session.keys('user_data:%s:*' % user.get('username')):
        r_session.delete(key.decode('utf-8'))

    return redirect(url_for('user_profile'))
Example #2
0
def diary_del():
    user = session.get('user_info')

    for key in r_session.keys('record:%s:*' % user.get('username')):
        r_session.delete(key.decode('utf-8'))

    return redirect(url_for('diary'))
Example #3
0
def admin_del_user(username):
    if r_session.get('%s:%s' % ('user', username)) is None:
        session['error_message'] = '账号不存在'
        return redirect(url_for('admin_user', username=username))

    # do del user
    r_session.delete('%s:%s' % ('user', username))
    r_session.srem('users', username)
    for b_account_id in r_session.smembers('accounts:' + username):
        account_id = b_account_id.decode('utf-8')
        r_session.delete('account:%s:%s' % (username, account_id))
        r_session.delete('account:%s:%s:data' % (username, account_id))
    r_session.delete('accounts:' + username)

    for key in r_session.keys('user_data:%s:*' % username):
        r_session.delete(key.decode('utf-8'))

    for key in r_session.keys('record:%s:*' % username):
        r_session.delete(key.decode('utf-8'))

    return redirect(url_for('admin_user'))
Example #4
0
def del_user(username):
    # do del user
    r_session.delete('%s:%s' % ('user', username))
    r_session.delete('%s:%s' % ('record', username))
    r_session.delete('%s:%s' % ('extra_info', username))
    r_session.delete('%s:%s' % ('rows', username))
    r_session.delete('%s:%s' % ('payment', username))
    r_session.srem('users', username)
    r_session.srem('email', username)
    for b_account_id in r_session.smembers('accounts:' + username):
        account_id = b_account_id.decode('utf-8')
        r_session.delete('account:%s:%s' % (username, account_id))
        r_session.delete('account:%s:%s:data' % (username, account_id))
    r_session.delete('accounts:' + username)

    for key in r_session.keys('user_data:%s:*' % username):
        r_session.delete(key.decode('utf-8'))
Example #5
0
def del_all_msg():
    for k in r_session.keys('user_messages:*'):
        r_session.delete(k.decode('utf-8'))
    return '删除成功'