from .tool.func import * async def list_user_check(name = 'test', plus_name = None, arg_num = 1, do_type = 'normal'): with get_db_connect() as conn: curs = conn.cursor() plus_id = plus_name check_type = do_type if do_type in ['simple', 'normal'] else 'normal' check_type = '' if check_type == 'normal' else check_type num = arg_num sql_num = (num * 50 - 50) if num * 50 > 0 else 0 if await acl_check(tool = 'all_admin_auth', ip = name) != 1 or (plus_id and await acl_check(tool = 'all_admin_auth', ip = plus_id) != 1): if await acl_check('', 'owner_auth', '', '') == 1: return await re_error(conn, 4) div = '' if await acl_check(tool = 'check_auth', memo = (check_type + ' ' if check_type != '' else '') + 'check (' + name + ')') == 1: return await re_error(conn, 3) if check_type == '': if ip_or_user(name) == 0: curs.execute(db_change("select data from user_set where name = \"approval_question\" and id = ?"), [name]) approval_question = curs.fetchall() if approval_question and approval_question[0][0]: curs.execute(db_change("select data from user_set where name = \"approval_question_answer\" and id = ?"), [name]) approval_question_answer = curs.fetchall() if approval_question_answer and approval_question_answer[0]: div += '''
Q ''' + approval_question[0][0] + ''' A ''' + approval_question_answer[0][0] + '''

''' if plus_id: plus = "or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ? " set_list = [name, plus_id, sql_num] if num == 1: curs.execute(db_change("" + \ "select distinct ip from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? or " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ?" ""), [name, plus_id]) all_ip_count = len(curs.fetchall()) curs.execute(db_change("" + \ "select distinct ip from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ?" + \ ""), [name]) a_ip_count = len(curs.fetchall()) curs.execute(db_change("" + \ "select distinct ip from ua_d " + \ "where " + ('ip' if ip_or_user(plus_id) == 1 else 'name') + " = ?" ""), [plus_id]) b_ip_count = len(curs.fetchall()) if a_ip_count + b_ip_count != all_ip_count: div += await get_lang('same_ip_exist') + '
' else: plus = '' set_list = [name, sql_num] curs.execute(db_change("" + \ "select name, ip, ua, today from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? " + \ plus + \ "order by today desc limit ?, 50" + \ ""), set_list) record = curs.fetchall() if record: if not plus_id: div = '' + \ '(' + await get_lang('compare') + ') ' + \ '(' + await get_lang('simple_check') + ')' + \ '
' + \ '' + div else: div = '' + \ '(' + name + ') ' + \ '(' + plus_id + ')' + \ '
' + \ '' + div div += ''' ''' set_n = 0 for data in record: if data[2]: if len(data[2]) > 300: ua = '' + \ '(300+)' + \ '' + \ '' set_n += 1 else: ua = html.escape(data[2]) else: ua = '
' div += ''' ''' div += '''
''' + await get_lang('name') + ''' ''' + await get_lang('ip') + ''' ''' + await get_lang('time') + '''
''' + data[0] + ''' (''' + await get_lang('delete') + ''') ''' + data[1] + ''' ''' + data[3] + '''
''' + ua + '''
''' if plus_id: div += await get_next_page_bottom( '/list/user/check/' + url_pas(name) + '/normal/{}/' + url_pas(plus_id), num, record ) else: div += await get_next_page_bottom( '/list/user/check/' + url_pas(name) + '/normal/{}', num, record ) if plus_id: name += ', ' + plus_id return easy_minify(flask.render_template(await skin_check(), imp = [name, await wiki_set(), await wiki_custom(), wiki_css(['(' + await get_lang('check') + ')', 0])], data = div, menu = [['manager', await get_lang('return')]] )) else: curs.execute(db_change("" + \ "select distinct " + ('name' if ip_or_user(name) == 1 else 'ip') + " from ua_d " + \ "where " + ('ip' if ip_or_user(name) == 1 else 'name') + " = ? " "order by today desc limit ?, 50" + \ ""), [name, sql_num]) record = curs.fetchall() div = '' for for_a in record: div += '
  • ' + for_a[0] + '
  • ' if div != '': div = '' div += await get_next_page_bottom( '/list/user/check/' + url_pas(name) + '/' + check_type + '/{}', num, record ) div = '' + \ '(' + await get_lang('check') + ')' + \ '' + div return easy_minify(flask.render_template(await skin_check(), imp = [name, await wiki_set(), await wiki_custom(), wiki_css(['(' + await get_lang('simple_check') + ')', 0])], data = div, menu = [['check/' + url_pas(name), await get_lang('return')]] ))