# -*- coding: utf-8 -*- import io, sys, pymysql sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') conn = pymysql.connect(host='192.168.1.161', user='devgps', password='dev@2021GPS', database='zentao_dev_2026', charset='utf8mb4', autocommit=False) cur = conn.cursor() print('== 身份归属验证 ==') cur.execute("SELECT id, addedby, title FROM zt_file WHERE id IN (8815, 8816)") for r in cur.fetchall(): print('zt_file:', r) cur.execute("SELECT id, openedby FROM zt_task WHERE id=18569") print('zt_task 18569:', cur.fetchone()) cur.execute("SELECT id, actor, comment FROM zt_action WHERE objecttype='story' AND objectid=9130 ORDER BY id DESC LIMIT 3") for r in cur.fetchall(): c = r[2].decode() if isinstance(r[2], bytes) else r[2] print('action:', r[0], 'actor=', r[1], '|', (c or '')[:55]) print('== 清理 ==') cur.execute("UPDATE zt_file SET deleted='1' WHERE id IN (8815, 8816)"); print('zt_file 软删:', cur.rowcount) cur.execute("UPDATE zt_task SET deleted='1' WHERE id=18569"); print('zt_task 软删:', cur.rowcount) cur.execute("""DELETE FROM zt_action WHERE (objecttype='task' AND objectid=18569) OR (objecttype='story' AND objectid=9130 AND (comment LIKE '%鉴权矩阵%' OR comment LIKE '%_auth_probe%' OR comment LIKE '%20260806111637%' OR comment LIKE '%20260806111638%'))""") print('action 删:', cur.rowcount) cur.execute("""DELETE FROM zt_actionrecent WHERE (objecttype='task' AND objectid=18569) OR (objecttype='story' AND objectid=9130 AND (comment LIKE '%鉴权矩阵%' OR comment LIKE '%_auth_probe%' OR comment LIKE '%20260806111637%' OR comment LIKE '%20260806111638%'))""") print('recent 删:', cur.rowcount) # 恢复 9130 test_other_url 到 08-05 的测试文档 cur.execute("UPDATE zt_story SET test_other_url='/zentao/img/20260805171435808ccb0dd2f9487b9ecbb5ae0ddb3266.md' WHERE id=9130") print('test_other_url 恢复:', cur.rowcount) conn.commit(); print('committed')