Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.
Coding
Chuyao Aa
Try it摩天轮开放接口二次封装技能。当用户需要对接摩天轮(MTL)开放平台接口、创建MTL HTTP接口、封装摩天轮API时触发。支持自动检测并添加mtl-open-sdk-consumer依赖、初始化ApiClient Bean、创建MtlRestController、根据原生接口定义生成HTTP接口代码。
What it does
将摩天轮开放原生接口封装为 HTTP 接口,基于 Spring Boot + mtl-open-sdk-consumer。
The skill document
摩天轮接口封装
将摩天轮开放原生接口封装为 HTTP 接口,基于 Spring Boot + mtl-open-sdk-consumer。
执行流程
步骤1:检测并添加 Maven 依赖
检测 pom.xml 是否已引入 mtl-open-sdk-consumer,若无则添加:
com.alibaba.mtl
mtl-open-sdk-consumer
2.0
步骤2:初始化 ApiClient Bean
检测项目中是否已存在 ApiClient Bean 配置,若无则在配置类中添加:
@Bean(name = "mtlClient")
public ApiClient mtlClient() throws URISyntaxException {
return new ApiClient(
"{clientIdentifier}", // 需在摩天轮申请
new URI("https://open.mtl4.alibaba-inc.com"),
EntryToken.builder()
.identifier("{clientIdentifier}")
.token("{token}") // 需在摩天轮申请
.build(),
new ClientConfiguration());
}
注意:clientIdentifier 和 token 需在摩天轮平台申请,URI 固定为 https://open.mtl4.alibaba-inc.com。
步骤3:创建 rest 包
检测项目中是否存在 rest package,若无则创建。
步骤4:创建 MtlRestController
检测 rest 包下是否存在 MtlRestController 类,若无则创建:
@RestController
@RequestMapping("/mtl")
public class MtlRestController {
@Autowired
private ApiClient mtlClient;
// 若项目存在 MtlLogProducer 日志类,还需注入:
// @Autowired
// private GetEnv getEnv;
}
步骤5:确认原生接口定义
必须向用户确认原生接口信息,完整定义示例:
接口路径(path):/dev/api/v1/alterSheet/detail
方法类型:GET/POST
描述:查询变更单明细
Parameters(query参数):{
"id": "integer类型,必传"
}
RequestBody(body参数):{
"targetReleaseId": "integer类型",
"testers": "string类型"
}
步骤6:生成 HTTP 接口
根据原生接口定义在 MtlRestController 中创建接口方法。
GET 请求示例(原生接口:/dev/api/v1/alterSheet/detail):
@GetMapping("/api/v1/alterSheet/detail")
public Map getAlterSheet(@RequestParam("id") String id) {
Map result = MapBuilder.of("success", true).build();
RequestMessage request = RequestMessage.builder()
.method(HttpMethod.GET)
.path("/dev/api/v1/alterSheet/detail")
.json(null)
.parameters(MapBuilder.ofAssignType("id", id).build())
.build();
try {
ResponseMessage responseMessage = mtlClient.sendRequest(request);
if (null == responseMessage) {
throw new RuntimeException("response is null");
}
result.put("data", LubanTypeUtil.toJSON(responseMessage.getJson()));
} catch (Exception e) {
result.put("success", false);
result.put("msg", e.getMessage());
}
return result;
}
POST 请求示例(带 RequestBody):
@PostMapping("/api/v1/xxx")
public Map postXxx(@RequestBody Map body) {
Map result = MapBuilder.of("success", true).build();
RequestMessage request = RequestMessage.builder()
.method(HttpMethod.POST)
.path("/dev/api/v1/xxx")
.json(LubanTypeUtil.toJSONString(body))
.parameters(null)
.build();
try {
ResponseMessage responseMessage = mtlClient.sendRequest(request);
if (null == responseMessage) {
throw new RuntimeException("response is null");
}
result.put("data", LubanTypeUtil.toJSON(responseMessage.getJson()));
} catch (Exception e) {
result.put("success", false);
result.put("msg", e.getMessage());
}
return result;
}
关键规则
| 规则 | 说明 |
|---|---|
| HTTP 路径 | 去除原生路径中的 /dev 前缀 |
| GET 参数 | 使用 parameters 传递 query 参数 |
| POST Body | 使用 LubanTypeUtil.toJSONString() 转换后放入 json 字段 |
| 日志记录 | 仅当项目存在 MtlLogProducer 类时添加日志代码 |
日志代码(可选)
若项目存在 MtlLogProducer 类,在 try-catch 中添加:
// 成功日志
MtlLogProducer.info(
"/dev/api/v1/xxx",
getEnv.curEnv().getEnv(),
"接口描述",
LubanTypeUtil.toJSONString(request),
LubanTypeUtil.toJSONString(responseMessage));
// 异常日志
MtlLogProducer.error(
"/dev/api/v1/xxx",
getEnv.curEnv().getEnv(),
"接口描述",
LubanTypeUtil.toJSONString(request),
e);
Related skills
Save, search, and manage personal notes and knowledge bases in Get笔记 on explicit request.
cli-creator
OfficialScaffold a durable CLI that Codex threads can run from any repo by name.
figma-use
OfficialDrive the Figma Plugin API via use_figma MCP to inspect files, create nodes, edit properties, and bind variables safely.
aspnet-core
OfficialBuild, review, and refactor ASP.NET Core apps using Microsoft's official framework guidance.
algorithmic-art
OfficialGenerates original algorithmic art through a p5.js viewer driven by seeded randomness and tunable parameters.
More from 1688aiinfra
Browse all skillsDiagnose 1688 store health with a two-stage flow: overall judgment plus a deep-dive report in your chosen direction.
Diagnose 1688 product performance and traffic issues from real CLI data, then hand off to image or title optimizers.
1688商品搜索SKILL:提供完整的1688商品搜索能力,包括类目查询、关键词搜索、图片搜索、商品详情、相关性商品、拉取货盘底池等9个核心接口。 支持多语言搜索和商品推荐,使用1688开放平台官方API,统一鉴权,Token全局缓存共享。
1688智能选品找货能力。通过文字、图片或链接搜商品、找同款、找相似款,支持批量采购比价、热销选品、跨境找货、场景化选品及多条件筛选(价格/销量/材质/属性排除等)。 触发词:找商品、找同款、搜商品、帮我找、想要XX、图片找货、链接找货、以图搜图、选品、批发、找货源、热销、比价、最便宜、按销量排序、出口、跨境、找...
将1688的商品铺货到俄罗斯电商平台Ozon(上架),通过Ozon官方API实现商品信息的上传和状态查询。适用于需要将单个1688的商品上架到Ozon的场景。
1688商品标题优化 工具能力:为商品标题添加热词优化(快速、基于规则)和 LLM 深度重写(高质量、自然流畅),支持用户输入偏好。如果用户没有选择想优化标题的商品,技能中可以出组件让用户选择; 触发词:优化标题、标题优化、改标题、重写标题、商品标题、标题改写、分析标题、我要优化标题、标题里哪些词没用、标题里应该加哪些热搜关键词、我的商品标题怎么优化?、我的标题怎么优化?、我要优化商品标题