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'))
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'))
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'))
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'))
def del_all_msg(): for k in r_session.keys('user_messages:*'): r_session.delete(k.decode('utf-8')) return '删除成功'