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.

31 lines
1.3 KiB

2 days ago
# -*- coding: utf-8 -*-
"""票 08 前置冒烟:起服后 debug token + 客户分页(seed 在位)+ 健康探针。"""
import io, sys, json
import requests
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
BASE = 'http://localhost:8080'
ADMIN = '739564171091247104'
r = requests.get(f'{BASE}/api/auth/debug/token', params={'userId': ADMIN}, timeout=10)
tok = r.json().get('data')
tok = tok.get('token') if isinstance(tok, dict) else tok
print('token:', (tok or 'FAIL')[:20] + '...' if tok else 'FAIL')
H = {'Authorization': f'Bearer {tok}'}
r = requests.get(f'{BASE}/api/customer/ping', headers=H, timeout=10)
print('ping:', r.status_code, r.json().get('message'))
r = requests.post(f'{BASE}/api/customer/workspace/mine/page',
data={'current': 1, 'size': 50}, headers=H, timeout=15)
d = r.json().get('data') or {}
rows = d.get('content') or []
print('mine page:', r.status_code, 'total=', d.get('total'), 'rows=', len(rows))
for c in rows[:5]:
print(' ', c.get('customerNo'), c.get('customerName'), 'stage=', c.get('customerStage'), 'owner=', c.get('ownerUserNameSnapshot'))
r = requests.post(f'{BASE}/api/customer/workspace/pool/page',
data={'current': 1, 'size': 10}, headers=H, timeout=15)
d = r.json().get('data') or {}
print('pool page: total=', d.get('total'))