ソースを参照

검사 기능 추가 2

잉여개발기 (SPDV) 6 年 前
コミット
1ce39519a9
1 ファイル変更28 行追加9 行削除
  1. 28 9
      route/give_user_check.py

+ 28 - 9
route/give_user_check.py

@@ -13,11 +13,8 @@ def give_user_check_2(conn, name):
         return re_error('/error/3')
 
     num = int(number_check(flask.request.args.get('num', '1')))
-    if num * 50 > 0:
-        sql_num = num * 50 - 50
-    else:
-        sql_num = 0
-
+    sql_num = (num * 50 - 50) if num * 50 > 0 else 0
+    
     div = ''
     plus_id = flask.request.args.get('plus', None)
 
@@ -28,7 +25,7 @@ def give_user_check_2(conn, name):
             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 = '''
+                div += '''
                     <table id="main_table_set">
                         <tbody>
                             <tr>
@@ -39,12 +36,34 @@ def give_user_check_2(conn, name):
                             </tr>
                         </tbody>
                     </table>
-                    <hr class=\"main_hr\">
+                    <hr class="main_hr">
                 '''
 
     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 += load_lang('same_ip_exist') + '<hr class="main_hr">'    
     else:
         plus = ''
         set_list = [name, sql_num]
@@ -61,13 +80,13 @@ def give_user_check_2(conn, name):
         if not plus_id:
             div = '' + \
                 '<a href="/manager/14?plus=' + url_pas(name) + '">(' + load_lang('compare') + ')</a>' + \
-                '<hr class=\"main_hr\">' + \
+                '<hr class="main_hr">' + \
             '' + div
         else:
             div = '' + \
                 '<a href="/check/' + url_pas(name) + '">(' + name + ')</a> ' + \
                 '<a href="/check/' + url_pas(plus_id) + '">(' + plus_id + ')</a>' + \
-                '<hr class=\"main_hr\">' + \
+                '<hr class="main_hr">' + \
             '' + div
 
         div += '''