You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.1 KiB
26 lines
1.1 KiB
|
19 hours ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""票 04 残留清理:清 r1 Job 观测遗留的 followOld pending_notice 历史(30 条已失效)"""
|
||
|
|
import pymysql
|
||
|
|
|
||
|
|
conn = pymysql.connect(host='8.129.84.155', user='root', password='Itc@123456',
|
||
|
|
database='crm', charset='utf8mb4', autocommit=True,
|
||
|
|
cursorclass=pymysql.cursors.DictCursor)
|
||
|
|
cur = conn.cursor()
|
||
|
|
|
||
|
|
FOLLOW_OLD = '750844481363771392'
|
||
|
|
cur.execute("SELECT COUNT(*) c, SUM(notice_status='0') pending FROM customer_pending_notice "
|
||
|
|
"WHERE customer_id=%s", (FOLLOW_OLD,))
|
||
|
|
row = cur.fetchone()
|
||
|
|
print('清理前: total=%s pending(未发)=%s' % (row['c'], row['pending']))
|
||
|
|
assert row['pending'] in (0, None), '存在未发提醒,不应清理'
|
||
|
|
|
||
|
|
cur.execute("DELETE FROM customer_pending_notice WHERE customer_id=%s", (FOLLOW_OLD,))
|
||
|
|
print('已删除:', cur.rowcount, '条(r1 升级链历史,全部已失效,证据在案 e2e-report.md)')
|
||
|
|
|
||
|
|
cur.execute("SELECT COUNT(*) c FROM customer_pending_notice WHERE customer_id=%s",
|
||
|
|
(FOLLOW_OLD,))
|
||
|
|
print('清理后:', cur.fetchone()['c'], '条')
|
||
|
|
conn.close()
|
||
|
|
print('CLEAN DONE')
|
||
|
|
|