Files
full/wiki/api/10-market.md

575 lines
14 KiB
Markdown
Raw Normal View History

# MARKET API
市场代理商、供应商及经营数据管理。
> 本文档由 protobuf descriptor 生成。字段名采用 protobuf JSON 名称64 位整数在 JSON 中应按字符串处理。
## 接入方式
- 动态 HTTP`POST /rpc/market/{Service}/{Method}`
- 原生 gRPC`/market.{Service}/{Method}`
- grpc-gateway`POST /market.{Service}/{Method}`
- 鉴权:需要登录的接口通过 `Authorization: <JWT>` 传递裸 JWT不添加 `Bearer` 前缀。
- 动态 HTTP 成功或失败均返回 HTTP 200业务状态见 `code``message``details`
## 服务概览
| 服务 | 方法数 | 说明 |
|---|---:|---|
| `Agency` | 9 | Agency 服务 |
| `Data` | 5 | Data 服务 |
| `Supply` | 5 | Supply 服务 |
## Agency
| 方法 | 动态 HTTP 路径 | 请求 | 响应 | 类型 |
|---|---|---|---|---|
| `Login` | `POST /rpc/market/Agency/Login` | [`market.LoginRequest`](#marketloginrequest) | [`ec_market_blocks.MarketLoginReply`](#ec_market_blocksmarketloginreply) | Unary |
| `Create` | `POST /rpc/market/Agency/Create` | [`market.MarketAgenctyItem`](#marketmarketagenctyitem) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
| `Get` | `POST /rpc/market/Agency/Get` | [`ec_market_blocks.IdentRequest`](#ec_market_blocksidentrequest) | [`market.MarketAgenctyItem`](#marketmarketagenctyitem) | Unary |
| `Fetch` | `POST /rpc/market/Agency/Fetch` | [`ec_market_blocks.MarketFetchRequest`](#ec_market_blocksmarketfetchrequest) | [`market.AgencyReply`](#marketagencyreply) | Unary |
| `Modify` | `POST /rpc/market/Agency/Modify` | [`market.MarketAgenctyItem`](#marketmarketagenctyitem) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
| `Delete` | `POST /rpc/market/Agency/Delete` | [`ec_market_blocks.IdentRequest`](#ec_market_blocksidentrequest) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
| `SetPassword` | `POST /rpc/market/Agency/SetPassword` | [`market.SetPasswordRequest`](#marketsetpasswordrequest) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
| `Pending` | `POST /rpc/market/Agency/Pending` | [`ec_market_blocks.MarketFetchRequest`](#ec_market_blocksmarketfetchrequest) | [`market.AgencyReply`](#marketagencyreply) | Unary |
| `Approve` | `POST /rpc/market/Agency/Approve` | [`market.ApproveRequest`](#marketapproverequest) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
### Agency.Login
- 动态 HTTP`POST /rpc/market/Agency/Login`
- gRPC`/market.Agency/Login`
- 请求示例:
```json
{
"account": "string",
"password": "string",
"verify": "string"
}
```
### Agency.Create
- 动态 HTTP`POST /rpc/market/Agency/Create`
- gRPC`/market.Agency/Create`
- 请求示例:
```json
{
"account": "string",
"agency_type": 0,
"approve": 0,
"area": "string",
"avatar": "string",
"commission_rate": 0,
"country": "string",
"created_at": "string",
"email": "string",
"id_after": "string",
"id_before": "string",
"id_name": "string",
"identity": "string",
"name": "string",
"org_name": "string",
"org_photo": "string",
"password": "string",
"phone": "string",
"remark": "string",
"status": 0
}
```
### Agency.Get
- 动态 HTTP`POST /rpc/market/Agency/Get`
- gRPC`/market.Agency/Get`
- 请求示例:
```json
{
"id": "0",
"identity": "string"
}
```
### Agency.Fetch
- 动态 HTTP`POST /rpc/market/Agency/Fetch`
- gRPC`/market.Agency/Fetch`
- 请求示例:
```json
{
"approve": 0,
"identity": "string",
"keyword": "string",
"page_no": "0",
"page_size": "0",
"params": {
"key": "string"
},
"status": 0
}
```
### Agency.Modify
- 动态 HTTP`POST /rpc/market/Agency/Modify`
- gRPC`/market.Agency/Modify`
- 请求示例:
```json
{
"account": "string",
"agency_type": 0,
"approve": 0,
"area": "string",
"avatar": "string",
"commission_rate": 0,
"country": "string",
"created_at": "string",
"email": "string",
"id_after": "string",
"id_before": "string",
"id_name": "string",
"identity": "string",
"name": "string",
"org_name": "string",
"org_photo": "string",
"password": "string",
"phone": "string",
"remark": "string",
"status": 0
}
```
### Agency.Delete
- 动态 HTTP`POST /rpc/market/Agency/Delete`
- gRPC`/market.Agency/Delete`
- 请求示例:
```json
{
"id": "0",
"identity": "string"
}
```
### Agency.SetPassword
- 动态 HTTP`POST /rpc/market/Agency/SetPassword`
- gRPC`/market.Agency/SetPassword`
- 请求示例:
```json
{
"identity": "string",
"new_password": "string",
"old_password": "string"
}
```
### Agency.Pending
- 动态 HTTP`POST /rpc/market/Agency/Pending`
- gRPC`/market.Agency/Pending`
- 请求示例:
```json
{
"approve": 0,
"identity": "string",
"keyword": "string",
"page_no": "0",
"page_size": "0",
"params": {
"key": "string"
},
"status": 0
}
```
### Agency.Approve
- 动态 HTTP`POST /rpc/market/Agency/Approve`
- gRPC`/market.Agency/Approve`
- 请求示例:
```json
{
"approve": 0,
"identity": "string"
}
```
## Data
| 方法 | 动态 HTTP 路径 | 请求 | 响应 | 类型 |
|---|---|---|---|---|
| `Overview` | `POST /rpc/market/Data/Overview` | [`ec_market_blocks.Empty`](#ec_market_blocksempty) | [`market.OverviewReply`](#marketoverviewreply) | Unary |
| `MemberFetch` | `POST /rpc/market/Data/MemberFetch` | [`ec_market_blocks.MarketFetchRequest`](#ec_market_blocksmarketfetchrequest) | [`market.DataReply`](#marketdatareply) | Unary |
| `MemberDetails` | `POST /rpc/market/Data/MemberDetails` | [`ec_market_blocks.IdentRequest`](#ec_market_blocksidentrequest) | [`market.KeyVal`](#marketkeyval) | Unary |
| `OrderFetch` | `POST /rpc/market/Data/OrderFetch` | [`ec_market_blocks.MarketFetchRequest`](#ec_market_blocksmarketfetchrequest) | [`market.DataReply`](#marketdatareply) | Unary |
| `OrderDetails` | `POST /rpc/market/Data/OrderDetails` | [`ec_market_blocks.IdentRequest`](#ec_market_blocksidentrequest) | [`market.KeyVal`](#marketkeyval) | Unary |
### Data.Overview
- 动态 HTTP`POST /rpc/market/Data/Overview`
- gRPC`/market.Data/Overview`
- 请求示例:
```json
{}
```
### Data.MemberFetch
- 动态 HTTP`POST /rpc/market/Data/MemberFetch`
- gRPC`/market.Data/MemberFetch`
- 请求示例:
```json
{
"approve": 0,
"identity": "string",
"keyword": "string",
"page_no": "0",
"page_size": "0",
"params": {
"key": "string"
},
"status": 0
}
```
### Data.MemberDetails
- 动态 HTTP`POST /rpc/market/Data/MemberDetails`
- gRPC`/market.Data/MemberDetails`
- 请求示例:
```json
{
"id": "0",
"identity": "string"
}
```
### Data.OrderFetch
- 动态 HTTP`POST /rpc/market/Data/OrderFetch`
- gRPC`/market.Data/OrderFetch`
- 请求示例:
```json
{
"approve": 0,
"identity": "string",
"keyword": "string",
"page_no": "0",
"page_size": "0",
"params": {
"key": "string"
},
"status": 0
}
```
### Data.OrderDetails
- 动态 HTTP`POST /rpc/market/Data/OrderDetails`
- gRPC`/market.Data/OrderDetails`
- 请求示例:
```json
{
"id": "0",
"identity": "string"
}
```
## Supply
| 方法 | 动态 HTTP 路径 | 请求 | 响应 | 类型 |
|---|---|---|---|---|
| `Create` | `POST /rpc/market/Supply/Create` | [`market.MarketSupplyItem`](#marketmarketsupplyitem) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
| `Get` | `POST /rpc/market/Supply/Get` | [`ec_market_blocks.IdentRequest`](#ec_market_blocksidentrequest) | [`market.MarketSupplyItem`](#marketmarketsupplyitem) | Unary |
| `Fetch` | `POST /rpc/market/Supply/Fetch` | [`ec_market_blocks.MarketFetchRequest`](#ec_market_blocksmarketfetchrequest) | [`market.SupplyReply`](#marketsupplyreply) | Unary |
| `Modify` | `POST /rpc/market/Supply/Modify` | [`market.MarketSupplyItem`](#marketmarketsupplyitem) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
| `Delete` | `POST /rpc/market/Supply/Delete` | [`ec_market_blocks.IdentRequest`](#ec_market_blocksidentrequest) | [`ec_market_blocks.IdentityStatusReply`](#ec_market_blocksidentitystatusreply) | Unary |
### Supply.Create
- 动态 HTTP`POST /rpc/market/Supply/Create`
- gRPC`/market.Supply/Create`
- 请求示例:
```json
{
"account": "string",
"avatar": "string",
"commission_rate": 0,
"id": 0,
"id_after": "string",
"id_before": "string",
"id_name": "string",
"identity": "string",
"name": "string",
"org_name": "string",
"org_photo": "string",
"password": "string",
"phone": "string",
"remark": "string",
"status": 0
}
```
### Supply.Get
- 动态 HTTP`POST /rpc/market/Supply/Get`
- gRPC`/market.Supply/Get`
- 请求示例:
```json
{
"id": "0",
"identity": "string"
}
```
### Supply.Fetch
- 动态 HTTP`POST /rpc/market/Supply/Fetch`
- gRPC`/market.Supply/Fetch`
- 请求示例:
```json
{
"approve": 0,
"identity": "string",
"keyword": "string",
"page_no": "0",
"page_size": "0",
"params": {
"key": "string"
},
"status": 0
}
```
### Supply.Modify
- 动态 HTTP`POST /rpc/market/Supply/Modify`
- gRPC`/market.Supply/Modify`
- 请求示例:
```json
{
"account": "string",
"avatar": "string",
"commission_rate": 0,
"id": 0,
"id_after": "string",
"id_before": "string",
"id_name": "string",
"identity": "string",
"name": "string",
"org_name": "string",
"org_photo": "string",
"password": "string",
"phone": "string",
"remark": "string",
"status": 0
}
```
### Supply.Delete
- 动态 HTTP`POST /rpc/market/Supply/Delete`
- gRPC`/market.Supply/Delete`
- 请求示例:
```json
{
"id": "0",
"identity": "string"
}
```
## 消息结构
### ec_market_blocks.Empty
空消息:请求时发送 `{}`
### ec_market_blocks.IdentRequest
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `id` | `int64` | 可选 |
| `identity` | `string` | 可选 |
### ec_market_blocks.IdentityStatusReply
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `code` | `int32` | 可选 |
| `identity` | `string` | 可选 |
| `message` | `string` | 可选 |
| `timeseq` | `int64` | 可选 |
### ec_market_blocks.MarketFetchRequest
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `page_no` | `int64` | 可选 |
| `page_size` | `int64` | 可选 |
| `params` | `map<string, string>` | 对象映射 |
| `identity` | `string` | 可选 |
| `keyword` | `string` | 可选 |
| `status` | `int32` | 可选 |
| `approve` | `int32` | 可选 |
### ec_market_blocks.MarketFetchRequest.ParamsEntry
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `key` | `string` | 可选 |
| `value` | `string` | 可选 |
### ec_market_blocks.MarketLoginReply
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `token` | `string` | 可选 |
| `identity` | `string` | 可选 |
| `market_identity` | `string` | 可选 |
| `name` | `string` | 可选 |
| `account` | `string` | 可选 |
| `role` | `string` | 可选 |
| `status` | `int32` | 可选 |
| `created_at` | `string` | 可选 |
| `market_name` | `string` | 可选 |
### market.AgencyReply
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `count` | `int64` | 可选 |
| `data` | `[]market.MarketAgenctyItem` | 数组 |
### market.ApproveRequest
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `approve` | `int32` | 可选 |
| `identity` | `string` | 可选 |
### market.DataReply
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `count` | `int64` | 可选 |
| `data` | `[]market.KeyVal` | 数组 |
### market.KeyVal
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `key` | `string` | 可选 |
| `val` | `string` | 可选 |
### market.LoginRequest
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `account` | `string` | 可选 |
| `password` | `string` | 可选 |
| `verify` | `string` | 可选 |
### market.MarketAgenctyItem
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `identity` | `string` | 可选 |
| `created_at` | `string` | 可选 |
| `name` | `string` | 可选 |
| `avatar` | `string` | 可选 |
| `account` | `string` | 可选 |
| `phone` | `string` | 可选 |
| `password` | `string` | 可选 |
| `org_name` | `string` | 可选 |
| `org_photo` | `string` | 可选 |
| `id_name` | `string` | 可选 |
| `id_before` | `string` | 可选 |
| `id_after` | `string` | 可选 |
| `remark` | `string` | 可选 |
| `commission_rate` | `int32` | 可选 |
| `agency_type` | `int32` | 可选 |
| `status` | `int32` | 可选 |
| `email` | `string` | 可选 |
| `country` | `string` | 可选 |
| `area` | `string` | 可选 |
| `approve` | `int32` | 可选 |
### market.MarketSupplyItem
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `name` | `string` | 可选 |
| `avatar` | `string` | 可选 |
| `commission_rate` | `int32` | 可选 |
| `account` | `string` | 可选 |
| `phone` | `string` | 可选 |
| `password` | `string` | 可选 |
| `org_name` | `string` | 可选 |
| `org_photo` | `string` | 可选 |
| `id_name` | `string` | 可选 |
| `id_before` | `string` | 可选 |
| `id_after` | `string` | 可选 |
| `remark` | `string` | 可选 |
| `identity` | `string` | 可选 |
| `status` | `int32` | 可选 |
| `id` | `int32` | 可选 |
### market.OverviewReply
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `total_approve` | `int64` | 可选 |
| `total_month` | `int64` | 可选 |
| `total_all` | `int64` | 可选 |
| `total_staff` | `int64` | 可选 |
| `reportMonth` | `map<string, int64>` | 对象映射 |
| `reportStaff` | `map<string, int64>` | 对象映射 |
### market.OverviewReply.ReportMonthEntry
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `key` | `string` | 可选 |
| `value` | `int64` | 可选 |
### market.OverviewReply.ReportStaffEntry
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `key` | `string` | 可选 |
| `value` | `int64` | 可选 |
### market.SetPasswordRequest
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `identity` | `string` | 可选 |
| `old_password` | `string` | 可选 |
| `new_password` | `string` | 可选 |
### market.SupplyReply
| JSON 字段 | 类型 | 规则 |
|---|---|---|
| `count` | `int64` | 可选 |
| `data` | `[]market.MarketSupplyItem` | 数组 |