# api-aggregator **Repository Path**: wkwang/api-aggregator ## Basic Information - **Project Name**: api-aggregator - **Description**: 接口聚合工具 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-03-14 - **Last Updated**: 2024-10-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 接口聚合工具,给前端使用 > 配置示例: ```json /** * path-pattern: /api-agg/go/{project-name}/{api-name} * post: /api-agg/ywl2/getUserFullInfo * head: { * token: "", * client-type: 1, * os-type: 2 * } * body: { * uid: "12312312313131", * orders: { * pageIndex: 1, * pageSize: 10 * }, * bills: { * pageIndex: 1, * pageSize: 10 * } * } * 变量说明:{}表示变量参数,"#"表示request head参数变量,"@"表示依赖其他服务接口的返回值对象,"$+"数字表示是数组类型,"$_"表示取整个数组,其他表示从request body中取值 */ { "name": "getUserFullInfo", "projectId": "31232313132", "projectName": "ywl2", "description": "获取用户全部展示信息", "services": [ { "id": "getAccount", "path": "/user/account/{uid}", "method": "get", "head": { "token": "{#token}", "clientType": "{#client-type}", "osType": "{#os-type}" } }, { "id": "getProfile", "path": "/user/profile?uid={uid}&clitype={#client-type}", "method": "get", "head": { "token": "{#token}" } }, { "id": "getOrders", "path": "/order", "method": "get", "head": { "token": "{#token}" }, "data": { "pageIndex": "{orders.pageIndex}", "pageSize": "{orders.pageSize}" } }, { "id": "getBills", "path": "/finance/accounts/bills", "method": "post", "dataType": "json", // post、put、delete可用,form或json,默认json:content-type必须为application/json; charset=utf-8; form:content-type为application/x-www-form-urlencoded;charset=utf-8 "head": { "token": "{#token}" }, "data": { "pageIndex": "{bills.pageIndex}", "pageSize": "{bills.pageSize}", "accountNo": "{@getProfile.data.accountNo}", "orderId": "{@getOrders.data$0.orderId}" } } ] } ```