---
name: meitu-match-channel-product
description: >-
  Matches an OTA / channel product id to a Meitu ERP line via direct-connect
  merchants. Use list_product_channel_mappings to query or reverse-lookup, and
  set_product_channel_mapping to save channelLineId on a customerId. Use when
  the user wants to 匹配渠道产品, 绑定 OTA 商品编号, or find which ERP product
  an OTA product id belongs to.
---

# Meitu · 渠道产品匹配

把渠道端产品 ID（OTA 商品编号）写到某个直连商户上，或用这个编号反查 ERP 产品。订单同步优先走这里，不要先靠产品名猜测。

## Prerequisites

1. Meitu Cloud MCP + PAT：`https://service.meitu.io/api/mcp`
2. Token 权限含：`products.channel_mappings.list`；要写入再加 `products.channel_mappings.set`
3. 写操作必须 `confirm: true`
4. Do **not** embed tokens in this skill or commit them

Docs: https://meitu.io/mcp · https://meitu.io/openapi

## 字段

| 字段 | 含义 |
|------|------|
| `productId` / `lineId` | ERP 产品 ID，同一条线路 |
| `customerId` | 直连商户。同一平台可以有多个（门票一个、跟团游一个） |
| `channelId` | 平台渠道编码，如 101 携程。在商户上，不在产品上 |
| `channelLineId` | 渠道端产品 ID，精确匹配 |
| `mapped` | `true` 表示这个商户已经写过 `channelLineId` |

## Workflow

```
- [ ] 1. 确认手里有渠道端产品 ID，还是 ERP productId
- [ ] 2. 反查：list_product_channel_mappings，传 channelLineId（可再加 customerId / channelId）
- [ ] 3. 恰好 1 条 → 用它的 lineId，停止
- [ ] 4. 0 条：list_products 按产品名找候选；多条则问用户
- [ ] 5. 列出该产品的直连商户，按 channelName 选出商户；同一平台有多家时问用户
- [ ] 6. set_product_channel_mapping（confirm=true）
- [ ] 7. 再查一次，确认 mapped=true 且 channelLineId 一致，然后回报
```

### 反查

```json
{ "channelLineId": "<OTA商品编号>" }
```

有 `customerId` 或 `channelId` 时一起传，避免不同平台碰巧编号相同。

只传 `productId` 时，返回该产品下全部直连商户，包括还没映射的。`mapped=false` 的行 `channelLineId` 为空。

### 写入

先用只传 `productId` 的查询确认 `customerId`。不要编一个商户。

```json
{
  "productId": 49835,
  "customerId": 12001,
  "channelLineId": "OTA-ITEM-8891",
  "channelLineName": "大阪五日",
  "confirm": true
}
```

`channelLineId` 不能省略。清除这条映射时传空字符串 `""`，并再次向用户确认。

商户必须是直连客户，且已经绑定平台渠道。否则接口会拒绝。

### 等价 REST

同一枚 Token。

- `GET /api/open/erp/v1/products/{productId}/channel-mappings`
- `GET /api/open/erp/v1/channel-mappings?channelLineId=`
- `PUT /api/open/erp/v1/products/{productId}/channel-mappings`  
  body：`{ "customerId", "channelLineId", "channelLineName" }`

## 汇报

告诉用户：ERP `productId`、产品名、直连商户名、`customerId`、平台名、`channelLineId`。多条命中时列出候选，不要擅自选。
