v0.1.0: CRM/ERP 系统内测版本 - 安全加固完成
- Docker bridge 网络隔离(8000 端口封死) - Gunicorn 4 Worker 多进程 - Alembic 数据库迁移基线 - 日志轮转 20m×3 - JWT 密钥 + DB 密码 + CORS 收紧 - 3-2-1 备份链路(NAS + R740-B 冷备) - 连接池 pool_pre_ping + pool_recycle=3600
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
{
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"title": "ERP MCP Tools for Dify",
|
||||
"version": "1.1.0",
|
||||
"description": "润滑油 CRM/ERP 系统的 AI 工具接口,供 Dify Agent 调用"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://192.168.1.100:8000"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/api/dify/tools/search_customers": {
|
||||
"post": {
|
||||
"operationId": "searchCustomers",
|
||||
"summary": "搜索客户列表,支持按名称模糊搜索和等级过滤",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"keyword": { "type": "string", "description": "客户名称关键词" },
|
||||
"level": { "type": "string", "description": "客户等级: A / B / C", "enum": ["A", "B", "C"] },
|
||||
"page": { "type": "integer", "default": 1 },
|
||||
"size": { "type": "integer", "default": 10 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": { "200": { "description": "客户列表查询结果" } }
|
||||
}
|
||||
},
|
||||
"/api/dify/tools/create_customer": {
|
||||
"post": {
|
||||
"operationId": "createCustomer",
|
||||
"summary": "创建新客户(返回确认卡片,需用户在前端确认后执行)",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": ["name"],
|
||||
"properties": {
|
||||
"name": { "type": "string", "description": "客户名称" },
|
||||
"level": { "type": "string", "description": "客户等级", "default": "C" },
|
||||
"contact": { "type": "string", "description": "联系人" },
|
||||
"phone": { "type": "string", "description": "电话" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": { "200": { "description": "返回 action_card 确认卡片" } }
|
||||
}
|
||||
},
|
||||
"/api/dify/tools/calculate_price": {
|
||||
"post": {
|
||||
"operationId": "calculatePrice",
|
||||
"summary": "查询客户专属报价:历史成交价追溯,无历史则标准价兜底",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": ["customer_id", "sku_id"],
|
||||
"properties": {
|
||||
"customer_id": { "type": "string", "description": "客户 UUID" },
|
||||
"sku_id": { "type": "string", "description": "产品 SKU UUID" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": { "200": { "description": "报价查询结果" } }
|
||||
}
|
||||
},
|
||||
"/api/dify/tools/create_order": {
|
||||
"post": {
|
||||
"operationId": "createOrder",
|
||||
"summary": "创建销售订单(返回确认卡片,需用户确认后执行)",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": ["customer_id", "items"],
|
||||
"properties": {
|
||||
"customer_id": { "type": "string", "description": "客户 UUID" },
|
||||
"items": {
|
||||
"type": "array",
|
||||
"description": "订单明细行列表",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["sku_id", "qty", "unit_price"],
|
||||
"properties": {
|
||||
"sku_id": { "type": "string", "description": "产品 SKU UUID" },
|
||||
"qty": { "type": "number", "description": "数量" },
|
||||
"unit_price": { "type": "number", "description": "单价" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"remark": { "type": "string", "description": "备注" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": { "200": { "description": "返回 action_card 确认卡片" } }
|
||||
}
|
||||
},
|
||||
"/api/dify/tools/search_orders": {
|
||||
"post": {
|
||||
"operationId": "searchOrders",
|
||||
"summary": "搜索订单列表,支持按客户名称、订单号、发货/付款状态筛选",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"keyword": { "type": "string", "description": "客户名称关键词" },
|
||||
"order_no": { "type": "string", "description": "订单号模糊搜索" },
|
||||
"shipping_state": { "type": "string", "description": "发货状态", "enum": ["pending", "partial", "shipped"] },
|
||||
"payment_state": { "type": "string", "description": "付款状态", "enum": ["unpaid", "partial", "cleared"] },
|
||||
"page": { "type": "integer", "default": 1 },
|
||||
"size": { "type": "integer", "default": 10 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": { "200": { "description": "订单列表查询结果" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user