2
0

topic_comment_blind.py 902 B

12345678910111213141516171819202122232425
  1. from .tool.func import *
  2. def topic_comment_blind(topic_num = 1, num = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. topic_num = str(topic_num)
  6. num = str(num)
  7. if admin_check(3, 'blind (code ' + topic_num + '#' + num + ')') != 1:
  8. return re_error('/error/3')
  9. curs.execute(db_change("select block from topic where code = ? and id = ?"), [topic_num, num])
  10. block = curs.fetchall()
  11. if block:
  12. if block[0][0] == 'O':
  13. curs.execute(db_change("update topic set block = '' where code = ? and id = ?"), [topic_num, num])
  14. else:
  15. curs.execute(db_change("update topic set block = 'O' where code = ? and id = ?"), [topic_num, num])
  16. rd_plus(topic_num, get_time())
  17. conn.commit()
  18. return redirect('/thread/' + topic_num + '#' + num)