# -*- coding: utf-8 -*- """票 04 残留盘点:本轮(22:30 后)新建的 e2c- 客户 + collab owner 复核 + e2c-r2i 复核""" 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() cur.execute("SELECT id, customer_no, customer_name, owner_user_id, archive_status, create_time " "FROM customer WHERE customer_name LIKE 'e2c-%' AND create_time >= '2026-09-05 22:30:00' " "ORDER BY create_time") rows = cur.fetchall() print('本轮新建 e2c-%d 条:' % len(rows)) for r in rows: print(' ', r['id'], r['customer_name'], 'arch=', r['archive_status'], 'owner=', str(r['owner_user_id'])[:6], r['create_time'].strftime('%H:%M:%S')) cur.execute("SELECT owner_user_name_snapshot n FROM customer WHERE id='750844482391375872'") print('collab owner 复核:', cur.fetchone()['n']) cur.execute("SELECT COUNT(*) c FROM customer WHERE customer_name LIKE 'e2c-r2i-%'") print('e2c-r2i-* 残留:', cur.fetchone()['c']) cur.execute("SELECT COUNT(*) c FROM customer WHERE customer_name LIKE 'e2c-%' AND archive_status=1") print('e2c-* 全部活跃数:', cur.fetchone()['c']) conn.close() print('SCAN DONE')