Files
starRiverProperty/scripts/test-env/stub-person-service.py
hpd840321 7b2bd307f1 Initial commit: reorganized source tree
- backend/: 13 Maven modules (cw-elevator-application, cloudwalk-cloud, intelligent-cwoscomponent, ninca-crk, etc.)
- frontend/: 4 Vue projects (elevator-front, cwos-portal, alarm-front, front_acs) + decompiled + scripts
- scripts/: build, test-env, tools (Docker Compose, service templates, API parity)
- docs/: AGENTS.md, superpowers specs, architecture docs
- .gitignore: standard Java/Maven exclusions

Moved from legacy maven-*/ root layout to backend/ organized structure.
2026-05-09 09:56:45 +08:00

42 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""Stub: PersonResult format — floorList is a top-level field in data"""
from http.server import HTTPServer, BaseHTTPRequestHandler
import json, sys
PERSON_DATA = {
"id": "1072908835884208128", "businessId": "2524639890ba4f2cba9ba1a4eeaa4015",
"personCode": "PC001", "name": "秦夏", "userName": "qinxia", "phone": "13666667067",
"organizationIds": ["488b8ad049bb43408a6fbcc50bcb89ac"],
"organizationNames": ["广发基金"],
"labelIds": [], "labelNames": [],
"floorList": ["605560541473144832", "605560541657694208", "605560542911791104"],
"defaultFloor": "605560541473144832",
"status": 0, "isDel": 0
}
class PersonStub(BaseHTTPRequestHandler):
def log_message(self, f, *a): print(f"[stub] {a}", file=sys.stderr)
def do_POST(self):
body_len = int(self.headers.get('Content-Length', 0))
body = json.loads(self.rfile.read(body_len)) if body_len > 0 else {}
if '/detail' in self.path:
resp = {"code": "00000000", "success": True, "message": "success", "data": PERSON_DATA}
else:
resp = {"code": "00000000", "success": True, "data": {"total": 0, "datas": []}}
self._json(resp)
def do_GET(self):
self._json({"status": "UP"})
def _json(self, data):
resp = json.dumps(data, ensure_ascii=False).encode()
self.send_response(200)
self.send_header('Content-Type', 'application/json;charset=utf-8')
self.send_header('Content-Length', str(len(resp)))
self.end_headers()
self.wfile.write(resp)
port = int(sys.argv[1]) if len(sys.argv) > 1 else 33011
HTTPServer(('127.0.0.1', port), PersonStub).serve_forever()