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.
33 lines
1.4 KiB
33 lines
1.4 KiB
|
3 days ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""D-08 定性:followOld 的 30 条 notice——plan 分布/创建时间/payload/状态。"""
|
||
|
|
import io, sys, json
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
import pymysql
|
||
|
|
|
||
|
|
IDS = json.load(open(r'e:\code\crm-backend-matt\.scratch\customer-e2e\seed-ids.json', encoding='utf-8'))
|
||
|
|
fid = IDS['customers']['followOld']['id']
|
||
|
|
print('followOld id =', fid)
|
||
|
|
|
||
|
|
c = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
|
||
|
|
database='crm', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor,
|
||
|
|
autocommit=True)
|
||
|
|
cur = c.cursor()
|
||
|
|
cur.execute("SELECT * FROM customer_pending_notice WHERE customer_id=%s ORDER BY id", (fid,))
|
||
|
|
rows = cur.fetchall()
|
||
|
|
print(f'共 {len(rows)} 条')
|
||
|
|
from collections import Counter
|
||
|
|
plans = Counter(str(r['plan_notify_time']) for r in rows)
|
||
|
|
sts = Counter(str(r['notice_status']) for r in rows)
|
||
|
|
print('plan 分布:', dict(plans))
|
||
|
|
print('status 分布:', dict(sts))
|
||
|
|
print('列:', list(rows[0].keys()) if rows else '-')
|
||
|
|
cur.execute("SELECT * FROM customer_pending_notice "
|
||
|
|
"WHERE customer_id=%s ORDER BY id LIMIT 3", (fid,))
|
||
|
|
for r in cur.fetchall():
|
||
|
|
print(' 首3条:', {k: str(v)[:50] for k, v in r.items()})
|
||
|
|
cur.execute("SELECT * FROM customer_pending_notice "
|
||
|
|
"WHERE customer_id=%s ORDER BY id DESC LIMIT 3", (fid,))
|
||
|
|
for r in cur.fetchall():
|
||
|
|
print(' 末3条:', {k: str(v)[:50] for k, v in r.items()})
|
||
|
|
c.close()
|