Ecommerce API (0.1.0)

Download OpenAPI specification:Download

基于FastAPI的Ecommerce API

根路由

Responses

Response samples

Content type
application/json
null

路由健康检查

Responses

Response samples

Content type
application/json
null

users

用户注册

创建新用户

Request Body schema: application/json
email
required
string <email> (Email)
username
required
string (Username)
password
required
string (Password) >= 8 characters

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com",
  • "username": "string",
  • "password": "stringst"
}

Response samples

Content type
application/json
{
  • "email": "user@example.com",
  • "username": "string",
  • "id": 0,
  • "is_active": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

auth

用户登录

用户登录获取令牌

Request Body schema: application/json
username_or_email
required
string (Username Or Email)

用户名或邮箱

password
required
string (Password)

密码

Responses

Request samples

Content type
application/json
{
  • "username_or_email": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "access_token": "string",
  • "refresh_token": "string",
  • "token_type": "string"
}

刷新访问token

使用刷新令牌获取新的访问令牌

Request Body schema: application/json
refresh_token
required
string (Refresh Token)

刷新令牌

Responses

Request samples

Content type
application/json
{
  • "refresh_token": "string"
}

Response samples

Content type
application/json
{
  • "access_token": "string",
  • "refresh_token": "string",
  • "token_type": "string"
}

用户退出登录

退出登录

将当前的访问令牌和刷新令牌(如果提供)添加到黑名单中,使它们失效

header Parameters
Authorization (string) or Authorization (null) (Authorization)
Request Body schema: application/json
Any of
refresh_token
required
string (Refresh Token)

刷新令牌

Responses

Request samples

Content type
application/json
Example
{
  • "refresh_token": "string"
}

Response samples

Content type
application/json
null

rbac

获取权限列表

获取权限列表

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建权限

创建新权限

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name)

权限名称

code
required
string (Code)

权限代码

Description (string) or Description (null) (Description)

权限描述

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "code": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "code": "string",
  • "description": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

获取特定权限详情

获取特定权限

Authorizations:
OAuth2PasswordBearer
path Parameters
permission_id
required
integer (Permission Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "code": "string",
  • "description": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

更新权限信息

更新权限

Authorizations:
OAuth2PasswordBearer
path Parameters
permission_id
required
integer (Permission Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

权限名称

Code (string) or Code (null) (Code)

权限代码

Description (string) or Description (null) (Description)

权限描述

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "code": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "code": "string",
  • "description": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

删除权限

删除权限

Authorizations:
OAuth2PasswordBearer
path Parameters
permission_id
required
integer (Permission Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

获取角色列表

获取角色列表

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建角色

创建新角色

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name)

角色名称

Description (string) or Description (null) (Description)

角色描述

Array of Permission Ids (integers) or Permission Ids (null) (Permission Ids)

权限ID列表

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "permission_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "permissions": [ ]
}

获取特定角色详情

获取特定角色

Authorizations:
OAuth2PasswordBearer
path Parameters
role_id
required
integer (Role Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "permissions": [ ]
}

更新角色信息

更新角色

Authorizations:
OAuth2PasswordBearer
path Parameters
role_id
required
integer (Role Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

角色名称

Description (string) or Description (null) (Description)

角色描述

Array of Permission Ids (integers) or Permission Ids (null) (Permission Ids)

权限ID列表

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "permission_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "permissions": [ ]
}

删除角色

删除角色

Authorizations:
OAuth2PasswordBearer
path Parameters
role_id
required
integer (Role Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

获取用户的角色列表

获取用户的角色列表

Authorizations:
OAuth2PasswordBearer
path Parameters
user_id
required
integer (User Id)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

更新用户的角色

更新用户的角色

Authorizations:
OAuth2PasswordBearer
path Parameters
user_id
required
integer (User Id)
Request Body schema: application/json
role_ids
required
Array of integers (Role Ids)

角色ID列表

Responses

Request samples

Content type
application/json
{
  • "role_ids": [
    ]
}

Response samples

Content type
application/json
null

获取所有用户及其角色列表

获取所有用户及其角色列表

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

categories

获取分类列表

获取分类列表,可以通过parent_id筛选特定父分类下的子分类

query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100
Parent Id (integer) or Parent Id (null) (Parent Id)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建分类

创建新分类

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) <= 100 characters

分类名称

Description (string) or Description (null) (Description)

分类描述

Parent Id (integer) or Parent Id (null) (Parent Id)

父分类ID

is_navigation
boolean (Is Navigation)
Default: true

是否显示在导航中

sort_order
integer (Sort Order)
Default: 0

排序权重(数字越大越靠前)

Icon Url (string) or Icon Url (null) (Icon Url)

分类图标URL

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "parent_id": 0,
  • "is_navigation": true,
  • "sort_order": 0,
  • "icon_url": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "parent_id": 0,
  • "is_navigation": true,
  • "sort_order": 0,
  • "icon_url": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "parent": {
    },
  • "children": [ ]
}

获取完整的分类树结构

获取完整的分类树结构

Responses

Response samples

Content type
application/json
[
  • {
    }
]

获取特定分类详情

获取特定分类详情

path Parameters
category_id
required
integer (Category Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "parent_id": 0,
  • "is_navigation": true,
  • "sort_order": 0,
  • "icon_url": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "parent": {
    },
  • "children": [ ]
}

更新分类信息

更新分类

Authorizations:
OAuth2PasswordBearer
path Parameters
category_id
required
integer (Category Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

分类名称

Description (string) or Description (null) (Description)

分类描述

Parent Id (integer) or Parent Id (null) (Parent Id)

父分类ID

is_navigation
boolean (Is Navigation)
Default: true

是否显示在导航中

sort_order
integer (Sort Order)
Default: 0

排序权重(数字越大越靠前)

Icon Url (string) or Icon Url (null) (Icon Url)

分类图标URL

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "parent_id": 0,
  • "is_navigation": true,
  • "sort_order": 0,
  • "icon_url": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "parent_id": 0,
  • "is_navigation": true,
  • "sort_order": 0,
  • "icon_url": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "parent": {
    },
  • "children": [ ]
}

删除分类

删除分类

Authorizations:
OAuth2PasswordBearer
path Parameters
category_id
required
integer (Category Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

tags

获取标签列表

获取标签列表

query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建标签

创建新标签

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) <= 50 characters

标签名称

Description (string) or Description (null) (Description)

标签描述

Color (string) or Color (null) (Color)

标签颜色

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "color": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "color": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

获取特定标签详情

获取特定标签详情

path Parameters
tag_id
required
integer (Tag Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "color": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

更新标签信息

更新标签

Authorizations:
OAuth2PasswordBearer
path Parameters
tag_id
required
integer (Tag Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

标签名称

Description (string) or Description (null) (Description)

标签描述

Color (string) or Color (null) (Color)

标签颜色

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "color": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "color": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

删除标签

删除标签

Authorizations:
OAuth2PasswordBearer
path Parameters
tag_id
required
integer (Tag Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

products

获取商品列表

获取商品列表,支持多种筛选条件

query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100
Category Id (integer) or Category Id (null) (Category Id)
Tag Id (integer) or Tag Id (null) (Tag Id)
Is Active (boolean) or Is Active (null) (Is Active)
Search (string) or Search (null) (Search)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建商品

创建新商品

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) <= 100 characters

商品名称

Description (string) or Description (null) (Description)

商品描述

price
required
number (Price) > 0

商品价格

stock
integer (Stock) >= 0
Default: 0

商品库存

category_id
required
integer (Category Id)

商品分类ID

is_active
boolean (Is Active)
Default: true

是否上架

Array of Tag Ids (integers) or Tag Ids (null) (Tag Ids)

商品标签ID列表

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "price": 0,
  • "stock": 0,
  • "category_id": 0,
  • "is_active": true,
  • "tag_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "price": 0,
  • "stock": 0,
  • "category_id": 0,
  • "is_active": true,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "category": {
    },
  • "tags": [ ]
}

获取特定商品详情

获取特定商品详情

path Parameters
product_id
required
integer (Product Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "price": 0,
  • "stock": 0,
  • "category_id": 0,
  • "is_active": true,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "category": {
    },
  • "tags": [ ]
}

更新商品信息

更新商品

Authorizations:
OAuth2PasswordBearer
path Parameters
product_id
required
integer (Product Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

商品名称

Description (string) or Description (null) (Description)

商品描述

Price (number) or Price (null) (Price)

商品价格

Stock (integer) or Stock (null) (Stock)

商品库存

Category Id (integer) or Category Id (null) (Category Id)

商品分类ID

Is Active (boolean) or Is Active (null) (Is Active)

是否上架

Array of Tag Ids (integers) or Tag Ids (null) (Tag Ids)

商品标签ID列表

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "price": 0,
  • "stock": 0,
  • "category_id": 0,
  • "is_active": true,
  • "tag_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "price": 0,
  • "stock": 0,
  • "category_id": 0,
  • "is_active": true,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "category": {
    },
  • "tags": [ ]
}

删除商品

删除商品

Authorizations:
OAuth2PasswordBearer
path Parameters
product_id
required
integer (Product Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

attributes

获取属性列表

获取属性列表

query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建属性

创建新属性

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) <= 50 characters

属性名称

Description (string) or Description (null) (Description)

属性描述

input_type
string (Input Type) <= 20 characters
Default: "select"

输入类型:select(单选)、multiple(多选)、input(输入框)等

is_sku
boolean (Is Sku)
Default: true

是否用于SKU生成

sort_order
integer (Sort Order)
Default: 0

排序权重(数字越大越靠前)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "input_type": "select",
  • "is_sku": true,
  • "sort_order": 0
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "input_type": "select",
  • "is_sku": true,
  • "sort_order": 0,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "values": [ ]
}

获取特定属性详情

获取特定属性详情

path Parameters
attribute_id
required
integer (Attribute Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "input_type": "select",
  • "is_sku": true,
  • "sort_order": 0,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "values": [ ]
}

更新属性信息

更新属性

Authorizations:
OAuth2PasswordBearer
path Parameters
attribute_id
required
integer (Attribute Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

属性名称

Description (string) or Description (null) (Description)

属性描述

Input Type (string) or Input Type (null) (Input Type)

输入类型

Is Sku (boolean) or Is Sku (null) (Is Sku)

是否用于SKU生成

Sort Order (integer) or Sort Order (null) (Sort Order)

排序权重

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "input_type": "string",
  • "is_sku": true,
  • "sort_order": 0
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "input_type": "select",
  • "is_sku": true,
  • "sort_order": 0,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "values": [ ]
}

删除属性

删除属性

Authorizations:
OAuth2PasswordBearer
path Parameters
attribute_id
required
integer (Attribute Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

attribute_values

获取属性值列表

获取属性值列表,可选择按属性ID筛选

query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100
Attribute Id (integer) or Attribute Id (null) (Attribute Id)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建属性值

创建新属性值

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
value
required
string (Value) <= 50 characters

属性值

Extra (string) or Extra (null) (Extra)

附加信息(如颜色代码、图片URL等)

sort_order
integer (Sort Order)
Default: 0

排序权重(数字越大越靠前)

attribute_id
required
integer (Attribute Id)

所属属性ID

Responses

Request samples

Content type
application/json
{
  • "value": "string",
  • "extra": "string",
  • "sort_order": 0,
  • "attribute_id": 0
}

Response samples

Content type
application/json
{
  • "value": "string",
  • "extra": "string",
  • "sort_order": 0,
  • "attribute_id": 0,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

获取特定属性值详情

获取特定属性值详情

path Parameters
value_id
required
integer (Value Id)

Responses

Response samples

Content type
application/json
{
  • "value": "string",
  • "extra": "string",
  • "sort_order": 0,
  • "attribute_id": 0,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "attribute": {
    }
}

更新属性值

更新属性值

Authorizations:
OAuth2PasswordBearer
path Parameters
value_id
required
integer (Value Id)
Request Body schema: application/json
Value (string) or Value (null) (Value)

属性值

Extra (string) or Extra (null) (Extra)

附加信息

Sort Order (integer) or Sort Order (null) (Sort Order)

排序权重

Attribute Id (integer) or Attribute Id (null) (Attribute Id)

所属属性ID

Responses

Request samples

Content type
application/json
{
  • "value": "string",
  • "extra": "string",
  • "sort_order": 0,
  • "attribute_id": 0
}

Response samples

Content type
application/json
{
  • "value": "string",
  • "extra": "string",
  • "sort_order": 0,
  • "attribute_id": 0,
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

删除属性值

删除属性值

Authorizations:
OAuth2PasswordBearer
path Parameters
value_id
required
integer (Value Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

skus

获取SKU列表

获取SKU列表,可选择按商品ID筛选

query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100
Product Id (integer) or Product Id (null) (Product Id)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建SKU

创建新SKU

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
product_id
required
integer (Product Id)

商品ID

Code (string) or Code (null) (Code)

SKU编码

name
required
string (Name) <= 200 characters

SKU名称

price
required
number (Price) > 0

SKU价格

stock
integer (Stock) >= 0
Default: 0

SKU库存

is_active
boolean (Is Active)
Default: true

是否启用

Image Url (string) or Image Url (null) (Image Url)

图片URL

attribute_value_ids
required
Array of integers (Attribute Value Ids)

属性值ID列表

Responses

Request samples

Content type
application/json
{
  • "product_id": 0,
  • "code": "string",
  • "name": "string",
  • "price": 0,
  • "stock": 0,
  • "is_active": true,
  • "image_url": "string",
  • "attribute_value_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "product_id": 0,
  • "code": "string",
  • "name": "string",
  • "price": 0,
  • "stock": 0,
  • "is_active": true,
  • "image_url": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "attribute_values": [ ]
}

获取特定SKU详情

获取特定SKU详情

path Parameters
sku_id
required
integer (Sku Id)

Responses

Response samples

Content type
application/json
{
  • "product_id": 0,
  • "code": "string",
  • "name": "string",
  • "price": 0,
  • "stock": 0,
  • "is_active": true,
  • "image_url": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "attribute_values": [ ]
}

更新SKU信息

更新SKU

Authorizations:
OAuth2PasswordBearer
path Parameters
sku_id
required
integer (Sku Id)
Request Body schema: application/json
Product Id (integer) or Product Id (null) (Product Id)

商品ID

Code (string) or Code (null) (Code)

SKU编码

Name (string) or Name (null) (Name)

SKU名称

Price (number) or Price (null) (Price)

SKU价格

Stock (integer) or Stock (null) (Stock)

SKU库存

Is Active (boolean) or Is Active (null) (Is Active)

是否启用

Image Url (string) or Image Url (null) (Image Url)

图片URL

Array of Attribute Value Ids (integers) or Attribute Value Ids (null) (Attribute Value Ids)

属性值ID列表

Responses

Request samples

Content type
application/json
{
  • "product_id": 0,
  • "code": "string",
  • "name": "string",
  • "price": 0,
  • "stock": 0,
  • "is_active": true,
  • "image_url": "string",
  • "attribute_value_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "product_id": 0,
  • "code": "string",
  • "name": "string",
  • "price": 0,
  • "stock": 0,
  • "is_active": true,
  • "image_url": "string",
  • "id": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "attribute_values": [ ]
}

删除SKU

删除SKU

Authorizations:
OAuth2PasswordBearer
path Parameters
sku_id
required
integer (Sku Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

批量删除SKU

批量删除SKU

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
Array
integer

Responses

Request samples

Content type
application/json
[
  • 0
]

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

根据属性组合批量生成SKU

根据属性组合批量生成SKU

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
product_id
required
integer (Product Id)

商品ID

attribute_ids
required
Array of integers (Attribute Ids)

用于生成SKU的属性ID列表

Price Increment (number) or Price Increment (null) (Price Increment)
Default: 0

SKU价格增量(相对于商品基础价格)

Stock Initial (integer) or Stock Initial (null) (Stock Initial)
Default: 0

SKU初始库存

Responses

Request samples

Content type
application/json
{
  • "product_id": 0,
  • "attribute_ids": [
    ],
  • "price_increment": 0,
  • "stock_initial": 0
}

Response samples

Content type
application/json
[
  • {
    }
]

product_reviews

获取商品评价列表

获取商品评价列表,支持多种筛选条件和排序选项

Authorizations:
OAuth2PasswordBearer
query Parameters
Product Id (integer) or Product Id (null) (Product Id)
User Id (integer) or User Id (null) (User Id)
Min Rating (integer) or Min Rating (null) (Min Rating)
Max Rating (integer) or Max Rating (null) (Max Rating)
verified_only
boolean (Verified Only)
Default: false
sort_by
string (Sort By)
Default: "created_at"
Enum: "created_at" "rating"
sort_order
string (Sort Order)
Default: "desc"
Enum: "asc" "desc"
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 20

Responses

Response samples

Content type
application/json
[
  • {
    }
]

创建商品评价

创建商品评价

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
product_id
required
integer (Product Id)

商品ID

rating
required
integer (Rating) [ 1 .. 5 ]

评分(1-5)

Content (string) or Content (null) (Content)

评价内容

Images (string) or Images (null) (Images)

评价图片,多个图片URL以逗号分隔

is_anonymous
boolean (Is Anonymous)
Default: false

是否匿名评价

Order Id (integer) or Order Id (null) (Order Id)

订单ID

Responses

Request samples

Content type
application/json
{
  • "product_id": 0,
  • "rating": 1,
  • "content": "string",
  • "images": "string",
  • "is_anonymous": false,
  • "order_id": 0
}

Response samples

Content type
application/json
{
  • "product_id": 0,
  • "rating": 1,
  • "content": "string",
  • "images": "string",
  • "is_anonymous": false,
  • "id": 0,
  • "user_id": 0,
  • "order_id": 0,
  • "is_verified_purchase": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "username": "string",
  • "replies": [ ]
}

获取商品评价统计信息

获取商品评价统计信息

Authorizations:
OAuth2PasswordBearer
query Parameters
product_id
required
integer (Product Id)

Responses

Response samples

Content type
application/json
{
  • "product_id": 0,
  • "average_rating": 0,
  • "total_reviews": 0,
  • "rating_distribution": { }
}

获取单个评价详情

获取单个评价详情

Authorizations:
OAuth2PasswordBearer
path Parameters
review_id
required
integer (Review Id)

Responses

Response samples

Content type
application/json
{
  • "product_id": 0,
  • "rating": 1,
  • "content": "string",
  • "images": "string",
  • "is_anonymous": false,
  • "id": 0,
  • "user_id": 0,
  • "order_id": 0,
  • "is_verified_purchase": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "username": "string",
  • "replies": [ ]
}

更新商品评价

更新商品评价

Authorizations:
OAuth2PasswordBearer
path Parameters
review_id
required
integer (Review Id)
Request Body schema: application/json
Rating (integer) or Rating (null) (Rating)

评分(1-5)

Content (string) or Content (null) (Content)

评价内容

Images (string) or Images (null) (Images)

评价图片,多个图片URL以逗号分隔

Is Anonymous (boolean) or Is Anonymous (null) (Is Anonymous)

是否匿名评价

Responses

Request samples

Content type
application/json
{
  • "rating": 1,
  • "content": "string",
  • "images": "string",
  • "is_anonymous": true
}

Response samples

Content type
application/json
{
  • "product_id": 0,
  • "rating": 1,
  • "content": "string",
  • "images": "string",
  • "is_anonymous": false,
  • "id": 0,
  • "user_id": 0,
  • "order_id": 0,
  • "is_verified_purchase": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "username": "string",
  • "replies": [ ]
}

删除商品评价

删除商品评价

Authorizations:
OAuth2PasswordBearer
path Parameters
review_id
required
integer (Review Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

创建评价回复

创建评价回复

Authorizations:
OAuth2PasswordBearer
path Parameters
review_id
required
integer (Review Id)
Request Body schema: application/json
content
required
string (Content)

回复内容

Responses

Request samples

Content type
application/json
{
  • "content": "string"
}

Response samples

Content type
application/json
{
  • "content": "string",
  • "id": 0,
  • "review_id": 0,
  • "user_id": 0,
  • "is_merchant": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "username": "string"
}

更新评价回复

更新评价回复

Authorizations:
OAuth2PasswordBearer
path Parameters
reply_id
required
integer (Reply Id)
Request Body schema: application/json
Content (string) or Content (null) (Content)

回复内容

Responses

Request samples

Content type
application/json
{
  • "content": "string"
}

Response samples

Content type
application/json
{
  • "content": "string",
  • "id": 0,
  • "review_id": 0,
  • "user_id": 0,
  • "is_merchant": true,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "username": "string"
}

删除评价回复

删除评价回复

Authorizations:
OAuth2PasswordBearer
path Parameters
reply_id
required
integer (Reply Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

商品搜索

商品搜索 :param q: 搜索关键词 :param category_id: 分类ID :param tag_ids: 标签ID列表 :param price_min: 最低价格 :param price_max: 最高价格 :param sort_by: 排序字段,如 "price", "created_at", "avg_rating" :param sort_order: 排序方向,"asc" 或 "desc" :param page: 页码 :param size: 每页数量 :param highlight: 是否启用高亮功能,默认启用 :param attributes: 属性筛选列表(复杂属性筛选的话,建议使用POST接口product_search/advanced) :return: 商品搜索结果

query Parameters
Q (string) or Q (null) (Q)
Category Id (integer) or Category Id (null) (Category Id)
Tag Ids (string) or Tag Ids (null) (Tag Ids)
Price Min (number) or Price Min (null) (Price Min)
Price Max (number) or Price Max (null) (Price Max)
Sort By (string) or Sort By (null) (Sort By)
Sort Order (string) or Sort Order (null) (Sort Order)
Default: "asc"
page
integer (Page) >= 1
Default: 1
size
integer (Size) [ 1 .. 100 ]
Default: 10
highlight
boolean (Highlight)
Default: true
Request Body schema: application/json
Any of
Array
name
required
string (Name)
values
required
Array of strings (Values)

Responses

Request samples

Content type
application/json
null

Response samples

Content type
application/json
{
  • "total": 0,
  • "page": 0,
  • "size": 0,
  • "items": [ ]
}

复杂属性搜索

商品搜索POST接口,支持复杂的属性筛选

请求体示例:

{
    "q": "手机",
    "category_id": 1,
    "tag_ids": "1,2,3",
    "price_min": 100,
    "price_max": 1000,
    "attributes": [
        {"name": "颜色", "values": ["红色", "蓝色"]},
        {"name": "尺寸", "values": ["S", "M"]}
    ],
    "sort_by": "price",
    "sort_order": "asc",
    "page": 1,
    "size": 10,
    "highlight": true
}
Request Body schema: application/json
Q (string) or Q (null) (Q)
Category Id (integer) or Category Id (null) (Category Id)
Tag Ids (string) or Tag Ids (null) (Tag Ids)
Price Min (number) or Price Min (null) (Price Min)
Price Max (number) or Price Max (null) (Price Max)
Sort By (string) or Sort By (null) (Sort By)
Sort Order (string) or Sort Order (null) (Sort Order)
Default: "asc"
page
integer (Page)
Default: 1
size
integer (Size)
Default: 10
highlight
boolean (Highlight)
Default: true
Array of Attributes (objects) or Attributes (null) (Attributes)

Responses

Request samples

Content type
application/json
{
  • "q": "string",
  • "category_id": 0,
  • "tag_ids": "string",
  • "price_min": 0,
  • "price_max": 0,
  • "sort_by": "string",
  • "sort_order": "asc",
  • "page": 1,
  • "size": 10,
  • "highlight": true,
  • "attributes": [
    ]
}

Response samples

Content type
application/json
{
  • "total": 0,
  • "page": 0,
  • "size": 0,
  • "items": [ ]
}

重新索引所有商品到Elasticsearch

重新索引所有商品到Elasticsearch

Authorizations:
OAuth2PasswordBearer

Responses

Response samples

Content type
application/json
null

warehouses

创建仓库

创建仓库

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name)
location
required
string (Location)
Contact Name (string) or Contact Name (null) (Contact Name)
Contact Phone (string) or Contact Phone (null) (Contact Phone)
Contact Email (string) or Contact Email (null) (Contact Email)
is_active
boolean (Is Active)
Default: true
Description (string) or Description (null) (Description)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "location": "string",
  • "contact_name": "string",
  • "contact_phone": "string",
  • "contact_email": "string",
  • "is_active": true,
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": {
    }
}

获取所有仓库

获取所有仓库

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip) >= 0
Default: 0
limit
integer (Limit) [ 1 .. 100 ]
Default: 100
Is Active (boolean) or Is Active (null) (Is Active)
Name (string) or Name (null) (Name)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": [
    ],
  • "total": 0,
  • "page": 0,
  • "size": 0
}

获取单个仓库详情

获取单个仓库详情

Authorizations:
OAuth2PasswordBearer
path Parameters
warehouse_id
required
integer (Warehouse Id) > 0

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": {
    }
}

更新仓库信息

更新仓库

Authorizations:
OAuth2PasswordBearer
path Parameters
warehouse_id
required
integer (Warehouse Id) > 0
Request Body schema: application/json
Name (string) or Name (null) (Name)
Location (string) or Location (null) (Location)
Contact Name (string) or Contact Name (null) (Contact Name)
Contact Phone (string) or Contact Phone (null) (Contact Phone)
Contact Email (string) or Contact Email (null) (Contact Email)
Is Active (boolean) or Is Active (null) (Is Active)
Description (string) or Description (null) (Description)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "location": "string",
  • "contact_name": "string",
  • "contact_phone": "string",
  • "contact_email": "string",
  • "is_active": true,
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": {
    }
}

删除仓库

删除仓库(只是软删除,is_active 设置为 False)

Authorizations:
OAuth2PasswordBearer
path Parameters
warehouse_id
required
integer (Warehouse Id) > 0

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": {
    }
}

inventory

创建库存项

创建库存项

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
sku_id
required
integer (Sku Id)
warehouse_id
required
integer (Warehouse Id)
quantity
integer (Quantity)
Default: 0
reserved_quantity
integer (Reserved Quantity)
Default: 0
Alert Threshold (integer) or Alert Threshold (null) (Alert Threshold)

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "warehouse_id": 0,
  • "quantity": 0,
  • "reserved_quantity": 0,
  • "alert_threshold": 0
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": {
    }
}

列出库存项

列出库存项,可选择按仓库、SKU、商品等进行筛选

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip) >= 0
Default: 0
limit
integer (Limit) [ 1 .. 100 ]
Default: 100
Warehouse Id (integer) or Warehouse Id (null) (Warehouse Id)
Sku Id (integer) or Sku Id (null) (Sku Id)
Product Id (integer) or Product Id (null) (Product Id)
Low Stock (boolean) or Low Stock (null) (Low Stock)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": [
    ],
  • "total": 0,
  • "page": 0,
  • "size": 0
}

获取单个库存项

按 ID 获取单个库存项

Authorizations:
OAuth2PasswordBearer
path Parameters
item_id
required
integer (Item Id) > 0

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": {
    }
}

更新库存项

更新库存项

Authorizations:
OAuth2PasswordBearer
path Parameters
item_id
required
integer (Item Id) > 0
Request Body schema: application/json
Quantity (integer) or Quantity (null) (Quantity)
Reserved Quantity (integer) or Reserved Quantity (null) (Reserved Quantity)
Alert Threshold (integer) or Alert Threshold (null) (Alert Threshold)

Responses

Request samples

Content type
application/json
{
  • "quantity": 0,
  • "reserved_quantity": 0,
  • "alert_threshold": 0
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": {
    }
}

删除库存项

删除库存项

Authorizations:
OAuth2PasswordBearer
path Parameters
item_id
required
integer (Item Id) > 0

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

获取库存交易记录

获取库存交易记录

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip) >= 0
Default: 0
limit
integer (Limit) [ 1 .. 100 ]
Default: 100
Inventory Item Id (integer) or Inventory Item Id (null) (Inventory Item Id)
Transaction Type (string) or Transaction Type (null) (Transaction Type)
Reference Id (string) or Reference Id (null) (Reference Id)
Reference Type (string) or Reference Type (null) (Reference Type)
Start Date (string) or Start Date (null) (Start Date)
End Date (string) or End Date (null) (End Date)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": [
    ],
  • "total": 0,
  • "page": 0,
  • "size": 0
}

入库

入库

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
sku_id
required
integer (Sku Id)
warehouse_id
required
integer (Warehouse Id)
quantity
required
integer (Quantity) > 0
Reference Id (string) or Reference Id (null) (Reference Id)
Reference Type (string) or Reference Type (null) (Reference Type)
Notes (string) or Notes (null) (Notes)

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "warehouse_id": 0,
  • "quantity": 0,
  • "reference_id": "string",
  • "reference_type": "string",
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

预留库存

预留库存

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
sku_id
required
integer (Sku Id)
warehouse_id
required
integer (Warehouse Id)
quantity
required
integer (Quantity) > 0
reference_type
string (Reference Type)
Default: "reserve"
Notes (string) or Notes (null) (Notes)

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "warehouse_id": 0,
  • "quantity": 0,
  • "reference_type": "reserve",
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

手动释放预留库存

手动释放预留库存,主要是为了配合 stock/reserve 使用

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
reference_id
required
string (Reference Id)
reference_type
string (Reference Type)
Default: "manual_release"
Notes (string) or Notes (null) (Notes)

Responses

Request samples

Content type
application/json
{
  • "reference_id": "string",
  • "reference_type": "manual_release",
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

确认出库

确认出库,主要是为了配合stock/reserve使用

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
reference_id
required
string (Reference Id)
reference_type
string (Reference Type)
Default: "confirm"
Notes (string) or Notes (null) (Notes)

Responses

Request samples

Content type
application/json
{
  • "reference_id": "string",
  • "reference_type": "confirm",
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

库存调整

库存调整(主要是用于盘点差异、数据纠错)

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
sku_id
required
integer (Sku Id)
warehouse_id
required
integer (Warehouse Id)
new_quantity
required
integer (New Quantity) >= 0
reason
required
string (Reason)
Notes (string) or Notes (null) (Notes)

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "warehouse_id": 0,
  • "new_quantity": 0,
  • "reason": "string",
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

批量库存调整

批量库存调整

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
required
Array of objects (Adjustments)

Responses

Request samples

Content type
application/json
{
  • "adjustments": [
    ]
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

库存调拨

库存调拨

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
sku_id
required
integer (Sku Id)
source_warehouse_id
required
integer (Source Warehouse Id)
target_warehouse_id
required
integer (Target Warehouse Id)
quantity
required
integer (Quantity) > 0
Notes (string) or Notes (null) (Notes)

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "source_warehouse_id": 0,
  • "target_warehouse_id": 0,
  • "quantity": 0,
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

批量调拨库存

批量调拨库存

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
required
Array of objects (Transfers)

Responses

Request samples

Content type
application/json
{
  • "transfers": [
    ]
}

Response samples

Content type
application/json
{
  • "success": true,
  • "message": "string",
  • "data": { }
}

手动获取低库存预警

按需手动获取低库存预警

Authorizations:
OAuth2PasswordBearer
query Parameters
Warehouse Id (integer) or Warehouse Id (null) (Warehouse Id)

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "total": 0
}

cart

获取当前用户的购物车

获取当前用户的购物车

Authorizations:
OAuth2PasswordBearer

Responses

Response samples

Content type
application/json
{
  • "user_id": 0,
  • "id": 0,
  • "items": [ ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

清空购物车

清空当前用户的购物车

Authorizations:
OAuth2PasswordBearer

Responses

Response samples

Content type
application/json
{
  • "user_id": 0,
  • "id": 0,
  • "items": [ ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

向购物车中添加商品

向购物车中添加商品

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
sku_id
required
integer (Sku Id)

SKU ID

quantity
required
integer (Quantity) > 0

Quantity

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "quantity": 0
}

Response samples

Content type
application/json
{
  • "user_id": 0,
  • "id": 0,
  • "items": [ ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

更新购物车中商品的数量

更新购物车中商品的数量

Authorizations:
OAuth2PasswordBearer
path Parameters
item_id
required
integer (Item Id)
Request Body schema: application/json
quantity
required
integer (Quantity) > 0

Quantity

Responses

Request samples

Content type
application/json
{
  • "quantity": 0
}

Response samples

Content type
application/json
{
  • "user_id": 0,
  • "id": 0,
  • "items": [ ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

从购物车中移除商品

从购物车中移除商品

Authorizations:
OAuth2PasswordBearer
path Parameters
item_id
required
integer (Item Id)

Responses

Response samples

Content type
application/json
{
  • "user_id": 0,
  • "id": 0,
  • "items": [ ],
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

orders

从购物车创建新订单(全量下单)

从购物车创建新订单

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
receiver_name
required
string (Receiver Name)
receiver_phone
required
string (Receiver Phone)
receiver_address
required
string (Receiver Address)
Notes (string) or Notes (null) (Notes)
User Coupon Id (integer) or User Coupon Id (null) (User Coupon Id)

用户优惠券ID

Responses

Request samples

Content type
application/json
{
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string",
  • "user_coupon_id": 0
}

Response samples

Content type
application/json
{
  • "total_amount": 0,
  • "status": "pending_payment",
  • "id": 0,
  • "order_sn": "string",
  • "user_id": 0,
  • "promotion_amount": 0,
  • "coupon_discount_amount": 0,
  • "pay_amount": 0,
  • "user_coupon_id": 0,
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "items": [ ],
  • "promotion": {
    }
}

从购物车中选择商品创建新订单

从购物车中选择指定商品创建新订单

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
receiver_name
required
string (Receiver Name)
receiver_phone
required
string (Receiver Phone)
receiver_address
required
string (Receiver Address)
Notes (string) or Notes (null) (Notes)
User Coupon Id (integer) or User Coupon Id (null) (User Coupon Id)

用户优惠券ID

selected_cart_item_ids
required
Array of integers (Selected Cart Item Ids) non-empty

Responses

Request samples

Content type
application/json
{
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string",
  • "user_coupon_id": 0,
  • "selected_cart_item_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "total_amount": 0,
  • "status": "pending_payment",
  • "id": 0,
  • "order_sn": "string",
  • "user_id": 0,
  • "promotion_amount": 0,
  • "coupon_discount_amount": 0,
  • "pay_amount": 0,
  • "user_coupon_id": 0,
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "items": [ ],
  • "promotion": {
    }
}

获取单个订单的详细信息

获取单个订单的详细信息

Authorizations:
OAuth2PasswordBearer
path Parameters
order_sn
required
string (Order Sn)

Responses

Response samples

Content type
application/json
{
  • "total_amount": 0,
  • "status": "pending_payment",
  • "id": 0,
  • "order_sn": "string",
  • "user_id": 0,
  • "promotion_amount": 0,
  • "coupon_discount_amount": 0,
  • "pay_amount": 0,
  • "user_coupon_id": 0,
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "items": [ ],
  • "promotion": {
    }
}

为指定订单请求支付

为指定订单请求支付,返回支付宝支付URL 路径参数使用 order_sn 以便用户友好

Authorizations:
OAuth2PasswordBearer
path Parameters
order_sn
required
string (Order Sn)

Responses

Response samples

Content type
application/json
{
  • "payment_url": "string"
}

用户主动取消一个“待支付”的订单

用户主动取消一个“待支付”的订单

Authorizations:
OAuth2PasswordBearer
path Parameters
order_sn
required
string (Order Sn)

Responses

Response samples

Content type
application/json
{
  • "total_amount": 0,
  • "status": "pending_payment",
  • "id": 0,
  • "order_sn": "string",
  • "user_id": 0,
  • "promotion_amount": 0,
  • "coupon_discount_amount": 0,
  • "pay_amount": 0,
  • "user_coupon_id": 0,
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "items": [ ],
  • "promotion": {
    }
}

Promotions

创建促销活动

创建一个新的促销活动。需要商品管理权限

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) <= 100 characters

促销活动名称

Description (string) or Description (null) (Description)

促销活动描述

start_time
required
string <date-time> (Start Time)

开始时间

end_time
required
string <date-time> (End Time)

结束时间

is_active
boolean (Is Active)
Default: true

是否激活

target_type
string (PromotionTargetType)
Default: "ALL"
Enum: "ALL" "PRODUCT" "CATEGORY" "TAG"

促销适用目标类型

Array of Target Ids (integers) or Target Ids (null) (Target Ids)

目标ID列表

condition_type
string (PromotionConditionType)
Default: "NO_THRESHOLD"
Enum: "NO_THRESHOLD" "MIN_AMOUNT" "MIN_QUANTITY"

触发条件类型

Condition Value (number) or Condition Value (string) or Condition Value (null) (Condition Value)

触发条件的值

action_type
required
string (PromotionActionType)
Enum: "FIXED" "PERCENTAGE" "SINGLE_PRODUCT_BUY_N_GET_M_FREE"

优惠动作类型

required
Action Value (number) or Action Value (string) (Action Value)

优惠动作的值

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "is_active": true,
  • "target_type": "ALL",
  • "target_ids": [
    ],
  • "condition_type": "NO_THRESHOLD",
  • "condition_value": 0,
  • "action_type": "FIXED",
  • "action_value": 0
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "is_active": true,
  • "target_type": "ALL",
  • "target_ids": [
    ],
  • "condition_type": "NO_THRESHOLD",
  • "condition_value": "string",
  • "action_type": "FIXED",
  • "action_value": "string",
  • "id": 0
}

获取促销活动列表

检索所有促销活动,支持分页

query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

获取指定ID的促销活动

根据ID获取单个促销活动的详细信息

path Parameters
promotion_id
required
integer (Promotion Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "is_active": true,
  • "target_type": "ALL",
  • "target_ids": [
    ],
  • "condition_type": "NO_THRESHOLD",
  • "condition_value": "string",
  • "action_type": "FIXED",
  • "action_value": "string",
  • "id": 0
}

更新促销活动

更新指定ID的促销活动信息。需要商品管理权限

Authorizations:
OAuth2PasswordBearer
path Parameters
promotion_id
required
integer (Promotion Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

促销活动名称

Description (string) or Description (null) (Description)

促销活动描述

Start Time (string) or Start Time (null) (Start Time)

开始时间

End Time (string) or End Time (null) (End Time)

结束时间

Is Active (boolean) or Is Active (null) (Is Active)

是否激活

PromotionTargetType (string) or null

促销适用目标类型

Array of Target Ids (integers) or Target Ids (null) (Target Ids)

目标ID列表

PromotionConditionType (string) or null

触发条件类型

Condition Value (number) or Condition Value (string) or Condition Value (null) (Condition Value)

触发条件的值

PromotionActionType (string) or null

优惠动作类型

Action Value (number) or Action Value (string) or Action Value (null) (Action Value)

优惠动作的值

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "is_active": true,
  • "target_type": "ALL",
  • "target_ids": [
    ],
  • "condition_type": "NO_THRESHOLD",
  • "condition_value": 0,
  • "action_type": "FIXED",
  • "action_value": 0
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "is_active": true,
  • "target_type": "ALL",
  • "target_ids": [
    ],
  • "condition_type": "NO_THRESHOLD",
  • "condition_value": "string",
  • "action_type": "FIXED",
  • "action_value": "string",
  • "id": 0
}

删除促销活动

根据ID删除一个促销活动。需要商品管理权限

Authorizations:
OAuth2PasswordBearer
path Parameters
promotion_id
required
integer (Promotion Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Coupons

创建优惠券模板

创建优惠券模板

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) <= 100 characters

优惠券名称

type
required
string (CouponType)
Enum: "FIXED" "PERCENTAGE"

优惠券类型

required
Value (number) or Value (string) (Value)

面值或折扣率

Min Spend (number) or Min Spend (string) (Min Spend)
Default: "0.0"

最低消费金额

Valid From (string) or Valid From (null) (Valid From)

有效期开始时间

Valid To (string) or Valid To (null) (Valid To)

有效期结束时间

total_quantity
integer (Total Quantity) >= 0
Default: 0

发行总量, 0为不限制

usage_limit_per_user
integer (Usage Limit Per User) >= 1
Default: 1

每位用户可领取/使用上限

is_active
boolean (Is Active)
Default: true

是否激活

Code Prefix (string) or Code Prefix (null) (Code Prefix)

优惠券码前缀, 留空则为通用券

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "type": "FIXED",
  • "value": 0,
  • "min_spend": "0.0",
  • "valid_from": "2019-08-24T14:15:22Z",
  • "valid_to": "2019-08-24T14:15:22Z",
  • "total_quantity": 0,
  • "usage_limit_per_user": 1,
  • "is_active": true,
  • "code_prefix": "string"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "type": "FIXED",
  • "value": "string",
  • "min_spend": "0.0",
  • "valid_from": "2019-08-24T14:15:22Z",
  • "valid_to": "2019-08-24T14:15:22Z",
  • "total_quantity": 0,
  • "usage_limit_per_user": 1,
  • "is_active": true,
  • "id": 0,
  • "code_prefix": "string",
  • "issued_quantity": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

获取所有优惠券模板

获取所有优惠券模板

Authorizations:
OAuth2PasswordBearer
query Parameters
page
integer (Page)
Default: 1
size
integer (Size)
Default: 10

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "total": 0
}

更新优惠券模板信息

更新优惠劵模板

Authorizations:
OAuth2PasswordBearer
path Parameters
template_id
required
integer (Template Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)
Valid From (string) or Valid From (null) (Valid From)
Valid To (string) or Valid To (null) (Valid To)
Total Quantity (integer) or Total Quantity (null) (Total Quantity)
Usage Limit Per User (integer) or Usage Limit Per User (null) (Usage Limit Per User)
Is Active (boolean) or Is Active (null) (Is Active)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "valid_from": "2019-08-24T14:15:22Z",
  • "valid_to": "2019-08-24T14:15:22Z",
  • "total_quantity": 0,
  • "usage_limit_per_user": 1,
  • "is_active": true
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "type": "FIXED",
  • "value": "string",
  • "min_spend": "0.0",
  • "valid_from": "2019-08-24T14:15:22Z",
  • "valid_to": "2019-08-24T14:15:22Z",
  • "total_quantity": 0,
  • "usage_limit_per_user": 1,
  • "is_active": true,
  • "id": 0,
  • "code_prefix": "string",
  • "issued_quantity": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

删除优惠券模板

删除一个优惠券模板

Authorizations:
OAuth2PasswordBearer
path Parameters
template_id
required
integer (Template Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

领取优惠券

按优惠券的模板ID领取优惠券

Authorizations:
OAuth2PasswordBearer
path Parameters
template_id
required
integer (Template Id)

Responses

Response samples

Content type
application/json
{
  • "user_id": 0,
  • "coupon_template_id": 0,
  • "code": "string",
  • "status": "UNUSED",
  • "id": 0,
  • "claimed_at": "2019-08-24T14:15:22Z",
  • "used_at": "2019-08-24T14:15:22Z",
  • "template": {
    }
}

获取我的优惠券列表

获取当前登录用户的所有优惠券,可根据状态筛选,支持分页

Authorizations:
OAuth2PasswordBearer
query Parameters
CouponStatus (string) or Coupon Status (null) (Coupon Status)

根据状态筛选

page
integer (Page) >= 1
Default: 1

页码

size
integer (Size) [ 1 .. 100 ]
Default: 10

每页数量

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "total": 0
}

获取我的单张优惠券详情

获取当前用户拥有的某一张优惠券的详细信息

Authorizations:
OAuth2PasswordBearer
path Parameters
user_coupon_id
required
integer (User Coupon Id)

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "code": "string",
  • "status": "UNUSED",
  • "claimed_at": "2019-08-24T14:15:22Z",
  • "used_at": "2019-08-24T14:15:22Z",
  • "template": {
    }
}

seckill

创建秒杀活动

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) [ 1 .. 100 ] characters

活动名称

Description (string) or Description (null) (Description)

活动描述

start_time
required
string <date-time> (Start Time)

秒杀开始时间

end_time
required
string <date-time> (End Time)

秒杀结束时间

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

获取秒杀活动列表

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

获取单个秒杀活动详情

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

更新秒杀活动

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

活动名称

Description (string) or Description (null) (Description)

活动描述

Start Time (string) or Start Time (null) (Start Time)

秒杀开始时间

End Time (string) or End Time (null) (End Time)

秒杀结束时间

SeckillActivityStatus (string) or null

活动状态

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "status": "PENDING"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

删除秒杀活动

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

预热秒杀活动库存到Redis

将指定的秒杀活动及其商品库存加载到Redis中进行预热 这是一个幂等且原子性的操作

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
null

为活动添加秒杀商品

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)
Request Body schema: application/json
sku_id
required
integer (Sku Id)

商品SKU ID

seckill_price
required
number (Seckill Price) > 0

秒杀价

seckill_stock
required
integer (Seckill Stock) > 0

秒杀库存

purchase_limit
integer (Purchase Limit) > 0
Default: 1

每人限购数量

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 1
}

Response samples

Content type
application/json
{
  • "sku_id": 0,
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 1,
  • "id": 0,
  • "activity_id": 0
}

更新秒杀商品信息

Authorizations:
OAuth2PasswordBearer
path Parameters
product_id
required
integer (Product Id)
Request Body schema: application/json
Seckill Price (number) or Seckill Price (null) (Seckill Price)

秒杀价

Seckill Stock (integer) or Seckill Stock (null) (Seckill Stock)

秒杀库存

Purchase Limit (integer) or Purchase Limit (null) (Purchase Limit)

每人限购数量

Responses

Request samples

Content type
application/json
{
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 0
}

Response samples

Content type
application/json
{
  • "sku_id": 0,
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 1,
  • "id": 0,
  • "activity_id": 0
}

从活动中移除秒杀商品

Authorizations:
OAuth2PasswordBearer
path Parameters
product_id
required
integer (Product Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

获取公开的秒杀活动列表

获取所有对用户可见的秒杀活动列表

  • 只返回状态为 PENDING (未开始) 和 ACTIVE (进行中) 的活动
  • 列表不包含详细的商品信息
Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

获取单个公开的秒杀活动详情

获取单个秒杀活动的详细信息,包括关联的秒杀商品

  • 只返回状态为 PENDING (未开始) 和 ACTIVE (进行中) 的活动
Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

创建秒杀订单

处理用户的秒杀请求

  • 前置检查: 活动有效性、库存、用户限购等 (由Redis Lua脚本原子性执行)
  • 异步处理: 如果校验通过,请求将被接受并放入消息队列中异步处理
  • 即时响应: 立即返回一个唯一的 request_id,用于后续查询订单处理状态
Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)
Request Body schema: application/json
sku_id
required
integer (Sku Id)

商品SKU ID

quantity
required
integer (Quantity) > 0

购买数量

receiver_name
required
string (Receiver Name) <= 100 characters

收货人姓名

receiver_phone
required
string (Receiver Phone)

收货人手机号

receiver_address
required
string (Receiver Address) <= 255 characters

收货地址

Notes (string) or Notes (null) (Notes)

订单备注

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "quantity": 0,
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "request_id": "string"
}

查询秒杀订单处理状态

根据创建秒杀订单时返回的 request_id,前端可以轮询此端点以获取订单的最终处理结果

Authorizations:
OAuth2PasswordBearer
path Parameters
request_id
required
string (Request Id)

Responses

Response samples

Content type
application/json
{
  • "status": "string",
  • "message": "string",
  • "order_id": 0,
  • "order_sn": "string"
}

Admin Seckill Management

创建秒杀活动

Authorizations:
OAuth2PasswordBearer
Request Body schema: application/json
name
required
string (Name) [ 1 .. 100 ] characters

活动名称

Description (string) or Description (null) (Description)

活动描述

start_time
required
string <date-time> (Start Time)

秒杀开始时间

end_time
required
string <date-time> (End Time)

秒杀结束时间

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

获取秒杀活动列表

Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

获取单个秒杀活动详情

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

更新秒杀活动

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)
Request Body schema: application/json
Name (string) or Name (null) (Name)

活动名称

Description (string) or Description (null) (Description)

活动描述

Start Time (string) or Start Time (null) (Start Time)

秒杀开始时间

End Time (string) or End Time (null) (End Time)

秒杀结束时间

SeckillActivityStatus (string) or null

活动状态

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "status": "PENDING"
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

删除秒杀活动

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

预热秒杀活动库存到Redis

将指定的秒杀活动及其商品库存加载到Redis中进行预热 这是一个幂等且原子性的操作

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
null

为活动添加秒杀商品

Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)
Request Body schema: application/json
sku_id
required
integer (Sku Id)

商品SKU ID

seckill_price
required
number (Seckill Price) > 0

秒杀价

seckill_stock
required
integer (Seckill Stock) > 0

秒杀库存

purchase_limit
integer (Purchase Limit) > 0
Default: 1

每人限购数量

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 1
}

Response samples

Content type
application/json
{
  • "sku_id": 0,
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 1,
  • "id": 0,
  • "activity_id": 0
}

更新秒杀商品信息

Authorizations:
OAuth2PasswordBearer
path Parameters
product_id
required
integer (Product Id)
Request Body schema: application/json
Seckill Price (number) or Seckill Price (null) (Seckill Price)

秒杀价

Seckill Stock (integer) or Seckill Stock (null) (Seckill Stock)

秒杀库存

Purchase Limit (integer) or Purchase Limit (null) (Purchase Limit)

每人限购数量

Responses

Request samples

Content type
application/json
{
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 0
}

Response samples

Content type
application/json
{
  • "sku_id": 0,
  • "seckill_price": 0,
  • "seckill_stock": 0,
  • "purchase_limit": 1,
  • "id": 0,
  • "activity_id": 0
}

从活动中移除秒杀商品

Authorizations:
OAuth2PasswordBearer
path Parameters
product_id
required
integer (Product Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Public Seckill

获取公开的秒杀活动列表

获取所有对用户可见的秒杀活动列表

  • 只返回状态为 PENDING (未开始) 和 ACTIVE (进行中) 的活动
  • 列表不包含详细的商品信息
Authorizations:
OAuth2PasswordBearer
query Parameters
skip
integer (Skip)
Default: 0
limit
integer (Limit)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

获取单个公开的秒杀活动详情

获取单个秒杀活动的详细信息,包括关联的秒杀商品

  • 只返回状态为 PENDING (未开始) 和 ACTIVE (进行中) 的活动
Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "description": "string",
  • "start_time": "2019-08-24T14:15:22Z",
  • "end_time": "2019-08-24T14:15:22Z",
  • "id": 0,
  • "status": "PENDING",
  • "products": [ ]
}

创建秒杀订单

处理用户的秒杀请求

  • 前置检查: 活动有效性、库存、用户限购等 (由Redis Lua脚本原子性执行)
  • 异步处理: 如果校验通过,请求将被接受并放入消息队列中异步处理
  • 即时响应: 立即返回一个唯一的 request_id,用于后续查询订单处理状态
Authorizations:
OAuth2PasswordBearer
path Parameters
activity_id
required
integer (Activity Id)
Request Body schema: application/json
sku_id
required
integer (Sku Id)

商品SKU ID

quantity
required
integer (Quantity) > 0

购买数量

receiver_name
required
string (Receiver Name) <= 100 characters

收货人姓名

receiver_phone
required
string (Receiver Phone)

收货人手机号

receiver_address
required
string (Receiver Address) <= 255 characters

收货地址

Notes (string) or Notes (null) (Notes)

订单备注

Responses

Request samples

Content type
application/json
{
  • "sku_id": 0,
  • "quantity": 0,
  • "receiver_name": "string",
  • "receiver_phone": "string",
  • "receiver_address": "string",
  • "notes": "string"
}

Response samples

Content type
application/json
{
  • "request_id": "string"
}

查询秒杀订单处理状态

根据创建秒杀订单时返回的 request_id,前端可以轮询此端点以获取订单的最终处理结果

Authorizations:
OAuth2PasswordBearer
path Parameters
request_id
required
string (Request Id)

Responses

Response samples

Content type
application/json
{
  • "status": "string",
  • "message": "string",
  • "order_id": 0,
  • "order_sn": "string"
}

User Behavior

记录浏览历史

记录当前登录用户对指定SKU的浏览历史.

Authorizations:
OAuth2PasswordBearer
path Parameters
sku_id
required
integer (Sku Id)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

获取最近浏览历史

获取当前登录用户最近的浏览历史记录.

Authorizations:
OAuth2PasswordBearer
query Parameters
limit
integer (Limit)
Default: 20

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Recommendations

基于商品的相似商品推荐

path Parameters
sku_id
required
integer (Sku Id)
query Parameters
limit
integer (Limit)
Default: 20

Responses

Response samples

Content type
application/json
[
  • {
    }
]

基于用户最近浏览的推荐

Authorizations:
OAuth2PasswordBearer
query Parameters
history_limit
integer (History Limit)
Default: 20
recommend_limit
integer (Recommend Limit)
Default: 20

Responses

Response samples

Content type
application/json
[
  • {
    }
]

User Profile

获取当前用户画像标签

Authorizations:
OAuth2PasswordBearer
query Parameters
Tag Key (string) or Tag Key (null) (Tag Key)
Limit (integer) or Limit (null) (Limit)

Responses

Response samples

Content type
application/json
[
  • {
    }
]