Просмотр исходного кода

최근 변경 API 기능 추가

잉여개발기 (SPDV) 5 лет назад
Родитель
Сommit
12e1fae255
3 измененных файлов с 18 добавлено и 11 удалено
  1. 13 7
      route/api_recent_change.py
  2. 4 3
      route/recent_changes.py
  3. 1 1
      version.json

+ 13 - 7
route/api_recent_change.py

@@ -5,14 +5,20 @@ def api_recent_change_2(conn):
 
     num = int(number_check(flask.request.args.get('num', '10')))
     num = 50 if (1 if not num > 0 else num) > 50 else num
-
+    repeat_ok = flask.request.args.get('repeat', '1')
     data_list = []
+    admin = admin_check(6)
+    get_title = ''
+
     curs.execute(db_change('select id, title from rc order by date desc'))
     for i in curs.fetchall():
-        curs.execute(db_change('select id, title, date, ip, send, leng, hide from history where id = ? and title = ?'), i)
-        data_list += curs.fetchall()
+        if repeat_ok == '1' or i[1] != get_title:
+            get_title = i[1]
+            curs.execute(db_change('select id, title, date, ip, send, leng, hide from history where id = ? and title = ?'), i)
+            get_data = curs.fetchall()
+            if get_data[0][6] == '' or admin == 1:
+                data_list += get_data
+            else:
+                data_list += [['', '', '', '', '', '', get_data[0][6]]]
         
-    if data_list:
-        return flask.jsonify(data_list)
-    else:
-        return flask.jsonify({})
+    return flask.jsonify(data_list if data_list else {}) 

+ 4 - 3
route/recent_changes.py

@@ -13,7 +13,8 @@ def recent_changes_2(conn, name, tool):
         ban = ''
         select = ''
         sub = ''
-
+        admin_6 = admin_check(6)
+        admin = admin_check()
         div = '''
             <table id="main_table_set">
                 <tbody>
@@ -143,7 +144,7 @@ def recent_changes_2(conn, name, tool):
             date = data[2]
 
             if data[6] == 'O':
-                if admin_check(6) == 1:
+                if admin == 1:
                     style[0] = 'id="toron_color_grey"'
                     style[1] = 'id="toron_color_grey"'
 
@@ -200,7 +201,7 @@ def recent_changes_2(conn, name, tool):
 
                     menu = [['w/' + url_pas(name), load_lang('return')]]
 
-                    if admin_check() == 1:
+                    if admin == 1:
                         menu += [['add_history/' + url_pas(name), load_lang('history_add')]]
                 else:
                     menu = [['history/' + url_pas(name), load_lang('return')]]

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "master" : {
-        "r_ver" : "v3.2.0-stable-11",
+        "r_ver" : "v3.2.0-master-14",
         "c_ver" : "3200900",
         "s_ver" : "9"
     }, "stable" : {