Ver Fonte

역사 추가는 0부터 시작하도록

잉여개발기 (SPDV) há 5 anos atrás
pai
commit
539a75d5e6
3 ficheiros alterados com 13 adições e 7 exclusões
  1. 2 1
      route/give_history_add.py
  2. 10 5
      route/tool/func.py
  3. 1 1
      version.json

+ 2 - 1
route/give_history_add.py

@@ -20,7 +20,8 @@ def give_history_add_2(conn, name):
             today,
             'Add:' + flask.request.form.get('get_ip', ''),
             flask.request.form.get('send', ''),
-            leng
+            leng,
+            mode = 'add'
         )
 
         conn.commit()

+ 10 - 5
route/tool/func.py

@@ -1104,16 +1104,21 @@ def rd_plus(topic_num, date, name = None, sub = None):
 
     conn.commit()
 
-def history_plus(title, data, date, ip, send, leng, t_check = '', d_type = ''):
-    curs.execute(db_change("select id from history where title = ? and type = '' order by id + 0 desc limit 1"), [title])
-    id_data = curs.fetchall()
-    id_data = str(int(id_data[0][0]) + 1) if id_data else '1'
+def history_plus(title, data, date, ip, send, leng, t_check = '', d_type = '', mode = ''):
+    if mode == 'add':
+        curs.execute(db_change("select id from history where title = ? and type = '' order by id + 0 asc limit 1"), [title])
+        id_data = curs.fetchall()
+        id_data = str(int(id_data[0][0]) - 1) if id_data else '0'
+    else:
+        curs.execute(db_change("select id from history where title = ? and type = '' order by id + 0 desc limit 1"), [title])
+        id_data = curs.fetchall()
+        id_data = str(int(id_data[0][0]) + 1) if id_data else '1'
 
     send = re.sub(r'\(|\)|<|>', '', send)
     send = send[:128] if len(send) > 128 else send
     send = send + ' (' + t_check + ')' if t_check != '' else send
 
-    if not re.search('^user:', title):
+    if not re.search('^user:', title) and mode != 'add':
         curs.execute(db_change("select count(*) from rc where type = 'normal'"))
         if curs.fetchall()[0][0] > 49:
             curs.execute(db_change("select id, title from rc where type = 'normal' order by date asc limit 1"))

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "master" : {
-        "r_ver" : "v3.2.0-master-21 (v3.2.0-dev-20200804-01)",
+        "r_ver" : "v3.2.0-master-21 (v3.2.0-dev-20200805-01)",
         "c_ver" : "3201601",
         "s_ver" : "9"
     }, "stable" : {