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.
32 lines
1.6 KiB
32 lines
1.6 KiB
|
15 hours ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""票 05 残留盘点:r2demo 客户归档态 + 协议清扫 + MEMBER_ID 成员位复原 + dedup 单例值 + 全局活跃计数"""
|
||
|
|
import pymysql, json
|
||
|
|
|
||
|
|
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_name, archive_status FROM customer WHERE customer_name LIKE 'e2c-r2demo-%'")
|
||
|
|
rows = cur.fetchall()
|
||
|
|
print('r2demo 客户 %d 条:' % len(rows))
|
||
|
|
for r in rows:
|
||
|
|
print(' ', r['id'], r['customer_name'], 'arch=', r['archive_status'])
|
||
|
|
cur.execute("SELECT COUNT(*) c FROM customer_agreement WHERE customer_id=%s AND deleted=0", (r['id'],))
|
||
|
|
print(' agreement 活行残留(deleted=0):', cur.fetchone()['c'])
|
||
|
|
|
||
|
|
cur.execute("SELECT user_id, member_role, deleted FROM customer_team_member WHERE customer_id='750844483406397440'")
|
||
|
|
print('MEMBER_ID(e2c-成员-样例) 成员:', json.dumps(cur.fetchall(), ensure_ascii=False, default=str))
|
||
|
|
|
||
|
|
cur.execute("SELECT master_enabled, name_enabled, name_match_mode, similarity_threshold, phone_enabled "
|
||
|
|
"FROM customer_dedup_rule WHERE id=1")
|
||
|
|
print('dedup 单例现值:', cur.fetchone())
|
||
|
|
|
||
|
|
cur.execute("SELECT COUNT(*) c FROM customer WHERE customer_name LIKE 'e2c-%%' AND archive_status=1")
|
||
|
|
print('e2c-* 全部活跃数(基准=16):', cur.fetchone()['c'])
|
||
|
|
|
||
|
|
cur.execute("SELECT owner_user_name_snapshot n FROM customer WHERE id='750844482391375872'")
|
||
|
|
print('collab owner 复核(应曾偲青):', cur.fetchone()['n'])
|
||
|
|
conn.close()
|
||
|
|
print('SCAN T05 DONE')
|