commit 0a39e3e63bc9e37e95bb5629d90d39778e75677f Author: ykxiao Date: Tue May 27 17:12:57 2025 +0800 初始化json-rpc文档项目 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..4efe3b5 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jsonrpc-docs.iml b/.idea/jsonrpc-docs.iml new file mode 100644 index 0000000..50d15f7 --- /dev/null +++ b/.idea/jsonrpc-docs.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..710161a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2d7664f --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +# 德木 JsonRpc 协议数据对接文档 + +## 服务中心 + +> 📌 **服务中心为 Nacos** +> 通过 `composer require hyperf/service-governance-nacos` 组件实现。 +> 详细用法参考 [Hyperf 文档](https://hyperf.io)。 + +🔹 一个服务可以同时作为 **服务提供者** 或 **消费者** +🔹 作为消费者时,可提供回调服务 + +--- + +## 公共接口服务 + +### 🧠 AI 服务 - `AiService` +- 提供查询、数据分析等功能 + +### 📱 EasyApp 服务 - `EasyAppService` +- 提供微信、钉钉、公众号等服务 + +### ☁️ OSS 服务 - `OssService` +- 文件上传、签名、回调 +- 文件下载、删除等常规操作 + +### 🖨️ 云打印服务 - `PrintService` +- 快麦云打印机支持 +- 打印回调、参数配置 +- *后续将接入更多打印机型号* + +### 📨 短信服务 - `SmsService` +- 阿里云短信发送 + +### ⚙️ 系统配置服务 - `SysConfigService` +- 各系统的第三方接口对接秘钥管理 + +### 👥 用户管理服务 - `UserAuthService` +- 公共用户逻辑服务 +- 子系统可调用统一用户服务 + +### 🌐 WebSocket 服务 - `WebSocketService` +- 公共 WS 服务模块 + +--- + +## 合同服务 + +### 📝 e签宝合同 - `ContractService` +- 签署业务合同常规流程对接 +- 支持多系统调用 + +### 📑 单据模版 - `OrderTempService` +- 模版处理服务 +- 根据业务需求动态生成文档 + +--- + +## 回调服务 + +> 🔄 **回调机制说明** +- 消费者端定义服务回调接口 +- 服务端成功执行后触发回调消费者服务 \ No newline at end of file diff --git a/_media/logo.png b/_media/logo.png new file mode 100644 index 0000000..490bc3b Binary files /dev/null and b/_media/logo.png differ diff --git a/_sidebar.md b/_sidebar.md new file mode 100644 index 0000000..1595bb9 --- /dev/null +++ b/_sidebar.md @@ -0,0 +1,9 @@ + + +* **开始接入** + * [前言]() + * [对接指南](zh-cn/guide) +* **Ai服务模块** + * [Ai服务接口功能](zh-cn/ai_function) + * [Ai服务接口列表](zh-cn/ai_service) +* **EasyApp接口服务** \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..9f2bb34 Binary files /dev/null and b/favicon.ico differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..2463391 --- /dev/null +++ b/index.html @@ -0,0 +1,48 @@ + + + + + Document + + + + + + + +
+ + + + + + + diff --git a/zh-cn/ai_function.md b/zh-cn/ai_function.md new file mode 100644 index 0000000..79089df --- /dev/null +++ b/zh-cn/ai_function.md @@ -0,0 +1,12 @@ +# 🤖 接口功能说明 + +### 📋 接口功能概览 + +| 图标 | 方法名称 | 功能描述 | +|------|-----------------------------------|--------------------------| +| 🗣 | `aiChatPost` | 实时AI对话交互 | +| 📜 | `aiChatHistoryPost` | 获取历史对话记录 | +| 📑 | `aiContractRiskAnalysisPost` | 合同文件风险分析 | +| 🔍 | `aiContractRiskAnalysisResultPost` | 获取风险分析结果 | +| 💾 | `aiQuerySqlPost` | 自然语言转数据库查询语句 | +| 🗑️ | `aiChatDelete` | 删除指定对话记录 | \ No newline at end of file diff --git a/zh-cn/ai_service.md b/zh-cn/ai_service.md new file mode 100644 index 0000000..22c54a7 --- /dev/null +++ b/zh-cn/ai_service.md @@ -0,0 +1,87 @@ +# 🤖 AI 服务模块 + +## 🛠 服务接口列表 + +```php + + * @since 2025/4/7 + * @version 1.0.0 + */ + +declare(strict_types=1); + +namespace App\JsonRpc; + +interface AiServiceInterface +{ + /** + * 🗣 AI 智能对话 + * @param array $params 对话参数 { + * @type string $session_id 会话ID + * @type string $user_input 用户输入 + * @type int $model_type 模型类型 + * } + * @return void + */ + public function aiChatPost(array $params): void; + + /** + * 📜 获取AI对话历史记录 + * @param array $params 查询参数 { + * @type string $user_id 用户ID + * @type int $page 页码 + * @type int $page_size 每页数量 + * } + * @return array { + * @type array $list 对话记录列表 + * @type int $total 总记录数 + * } + */ + public function aiChatHistoryPost(array $params): array; + + /** + * 📑 智能合同风险分析 + * @param array $params 合同参数 { + * @type string $contract_id 合同ID + * @type string $file_url 合同文件URL + * } + * @return void + */ + public function aiContractRiskAnalysisPost(array $params): void; + + /** + * 🔍 获取合同风险分析结果 + * @param array $params 查询参数 { + * @type string $task_id 分析任务ID + * } + * @return array { + * @type int $risk_level 风险等级 + * @type array $risk_items 风险条目 + * } + */ + public function aiContractRiskAnalysisResultPost(array $params): array; + + /** + * 💾 生成数据库查询语句 + * @param array $params 生成参数 { + * @type string $question 自然语言问题 + * @type string $db_schema 数据库结构 + * } + * @return void + */ + public function aiQuerySqlPost(array $params): void; + + /** + * 🗑️ 删除AI对话记录 + * @param array $params 删除参数 { + * @type string $record_id 记录ID + * @type string $user_id 用户ID + * } + * @return void + */ + public function aiChatDelete(array $params): void; +} +``` \ No newline at end of file diff --git a/zh-cn/guide.md b/zh-cn/guide.md new file mode 100644 index 0000000..86b567b --- /dev/null +++ b/zh-cn/guide.md @@ -0,0 +1,95 @@ +# JSON-RPC 接口规范文档 + +## 📌 目录 +- [协议基础信息](#协议基础信息) +- [请求格式规范](#请求格式规范) +- [响应格式规范](#响应格式规范) + +## 协议基础信息 + +> 🌐 **JSON-RPC 通信规范** + +| 项目 | 值 | 说明 | +|-----------------|---------------------|--------------------------| +| 🔖 协议版本 | JSON-RPC 2.0 | 遵循最新2.0协议规范 | +| 📤 传输协议 | HTTP POST | 仅支持POST方法 | +| 🚪 服务端点 | `127.0.0.1:8848` | 生产环境请替换为实际地址 | +| 🕒 超时时间 | 5000ms | 建议客户端设置超时 | +| 📝 Content-Type | `application/json` | 必须严格设置此请求头 | + +--- + +## 请求格式规范 + +### 📦 请求示例 +```json +{ + "jsonrpc": "2.0", + "method": "ServiceName.method", + "params": { + "company_info": { + "id": 5, + "name": "德木智造", + "full_name": "苏州德木智造科技有限公司", + "domain": "drp", + "owner": "ykxiao", + "mobile": "13712279001", + "address": "江苏省苏州市太仓市太仓港港口开发区北环路20号809室", + "org_code": "91320585MAE1L3233J", + "email": "yk_9001@icloud.com" + }, + "userInfo": { + "id": 8, + "company_id": 5, + "user_type": 2, + "login_name": "ykk" + } + }, + "id": "req_123456" +} +``` + +## 响应格式规范 + +### ✅ 成功响应 +```json +{ + "jsonrpc": "2.0", + "result": { + "status": "success", + "data": { + "request_id": "req_123456", + "processed_at": "2023-08-20 15:30:45" + } + }, + "id": "req_123456" +} +``` + +### ❌ 错误响应 +```json +{ + "jsonrpc": "2.0", + "error": { + "code": -32000, + "message": "企业信息验证失败", + "data": { + "field": "org_code", + "reason": "统一信用代码格式不正确" + } + }, + "id": "req_123456" +} +``` + +### 🚨 错误码说明 + +| 错误码 | HTTP状态码 | 说明 | 解决方案 | +|---------|------------|-----------------------|-------------------------| +| -32700 | 400 | 解析错误 | 检查JSON格式 | +| -32600 | 400 | 无效请求 | 验证请求参数 | +| -32601 | 404 | 方法不存在 | 检查method名称 | +| -32602 | 400 | 无效参数 | 检查params参数 | +| -32603 | 500 | 内部错误 | 联系技术支持 | +| -32000 | 200 | 业务逻辑错误 | 查看error.data详情 | +| -32001 | 401 | 未授权访问 | 检查认证信息 | \ No newline at end of file