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.
64 lines
3.0 KiB
64 lines
3.0 KiB
# -*- coding: utf-8 -*-
|
|
"""第三轮 3 个失败用例的手动取证:transfer/page 过滤、assignable 耗时、import page D-06 复核。"""
|
|
import io, sys, time, json
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
import requests
|
|
|
|
BASE = 'http://localhost:8080'
|
|
|
|
def tok(uid):
|
|
r = requests.get(f'{BASE}/api/auth/debug/token', params={'userId': uid}, timeout=30)
|
|
d = r.json().get('data')
|
|
return d if isinstance(d, str) else (d or {}).get('token')
|
|
|
|
adm = tok('739564171091247104')
|
|
H = {'Authorization': f'Bearer {adm}'}
|
|
|
|
print('--- 1) transfer/page?transferNo=JG202609030002 ---')
|
|
t0 = time.time()
|
|
r = requests.get(f'{BASE}/api/customer/transfer/page',
|
|
params={'transferNo': 'JG202609030002', 'pageSize': 10},
|
|
headers=H, timeout=30)
|
|
print(f'HTTP {r.status_code} {time.time()-t0:.1f}s')
|
|
d = r.json()
|
|
recs = (d.get('data') or {}).get('records') or []
|
|
print('total=', (d.get('data') or {}).get('total'), '命中:', [(x.get('transferNo'), x.get('status')) for x in recs])
|
|
|
|
print('--- 2) transfer/page 全量(无过滤) ---')
|
|
r = requests.get(f'{BASE}/api/customer/transfer/page', params={'pageSize': 5}, headers=H, timeout=30)
|
|
d = r.json()
|
|
recs = (d.get('data') or {}).get('records') or []
|
|
print('total=', (d.get('data') or {}).get('total'),
|
|
'首条:', [(x.get('transferNo'), x.get('status'), x.get('fromUserName')) for x in recs[:3]])
|
|
|
|
print('--- 3) assignable 耗时(JG202609030002 的 id 由 1) 拿,否则查 DB 备用) ---')
|
|
tid = None
|
|
if recs:
|
|
tid = recs[0].get('id')
|
|
if not tid:
|
|
import pymysql
|
|
c = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
|
|
database='crm', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
|
|
cur = c.cursor(); cur.execute('SELECT id FROM customer_transfer ORDER BY id DESC LIMIT 1')
|
|
tid = str(cur.fetchone()['id']); c.close()
|
|
print('tid =', tid)
|
|
for i in range(2):
|
|
t0 = time.time()
|
|
try:
|
|
r = requests.get(f'{BASE}/api/customer/transfer/{tid}/assignable',
|
|
params={'id': tid}, headers=H, timeout=60)
|
|
users = (r.json().get('data') or [])
|
|
print(f'尝试{i+1}: HTTP {r.status_code} {time.time()-t0:.1f}s 用户数={len(users)}',
|
|
[u.get('username') for u in users[:5]])
|
|
except Exception as e:
|
|
print(f'尝试{i+1}: {time.time()-t0:.1f}s 异常 {type(e).__name__}: {str(e)[:100]}')
|
|
|
|
print('--- 4) import page 复核(D-06:主 task 是否可见) ---')
|
|
r = requests.get(f'{BASE}/api/customer/import/page', params={'pageSize': 10}, headers=H, timeout=30)
|
|
d = r.json()
|
|
recs = (d.get('data') or {}).get('records') or []
|
|
print('total=', (d.get('data') or {}).get('total'))
|
|
for x in recs[:6]:
|
|
print(' task=', x.get('taskId'), 'mode=', x.get('importMode'), 'status=', x.get('status'),
|
|
'creator=', x.get('creatorName'), 'create=', x.get('createTime'))
|
|
print('主 task 750866543671246848 可见 =', any(str(x.get('taskId')) == '750866543671246848' for x in recs))
|
|
|