feat: add customer relations API for family and protocols

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-10-07 22:26:15 +08:00
1 parent f005370a1e
commit e7f2dfa4d4
3 files changed
+406

No files matched your search

+14
View File
@@ -24,6 +24,7 @@ from app.models.models import (
BizSampleCode,
SysUser,
)
from app.services.customer_relations import build_customer_relations
router = APIRouter(prefix="/web/admin", tags=["基础信息管理"])
@@ -119,6 +120,19 @@ async def list_customers(
return success_response({"list": result_list, "total": total, "page": page, "pageSize": pageSize, "totalPages": tp})
@router.get("/customers/{customer_id}/relations")
async def get_customer_relations(
customer_id: str,
user: dict = Depends(require_menu_code("biz:customer:list")),
db: Session = Depends(get_db),
):
tenant_no = _get_tenant_no(db, user)
data = build_customer_relations(db, customer_id, tenant_no)
if not data:
return error_response(404, "客户不存在")
return success_response(data)
@router.post("/customers")
async def create_customer(
body: CustomerCreateBody,