# ProductStorage **Repository Path**: lvsmart/ProductStorage ## Basic Information - **Project Name**: ProductStorage - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-09-20 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 简单的Django项目Demo # 商品存储 所有商家的商品,都会存储在这里. ## Model | Field | Type | Description | | ------------- | ------------ |------------ | | **bar_code** | VARCHAR(50) | 国条码 | | name | VARCHAR(128) | 名称 | | vendor_name | VARCHAR(128) | 商家名称 | | brand | VARCHAR(128) | 品牌名称 | | ware_id | VARCHAR(50) | 物料编码 | | region | VARCHAR(128) | 产地 | | packing | VARCHAR(128) | 包装 | | weight | FLOAT | 毛重 | | tax_rate | FLOAT | 税率 | | seo_info | LONGTEXT | seo信息 | | properties | LONGTEXT | 属性 | ## API 概述 三种错误message ## 单个商品 ### 保存商品 * 如果国条码不存在,直接存 * 如果国条码已经存在,不保存,返回失败 > POST /products #### **Input** | Name | Type | Description | | ------------- | ----- | -------------------- | | **bar_code** | str | **Required.** 国条码 | | name | str | 名称 | | vendor_name | str | 商家名称 | | brand | str | 品牌名称 | | ware_id | str | 物料编码 | | region | str | 产地 | | packing | str | 包装 | | weight | float | 毛重 | | tax_rate | float | 税率 | | seo_info | str | seo信息 | | properties | str | 属性 | #### **Response** ```python { "vendor_name": str, "ware_id": str, "brand": str, "region": str, "weight": float, "tax_rate": float, "seo_info": str, "packing": str, "bar_code": str, "properties": str, "name": str } ``` ### 更新商品信息 * 根据国标码,更新对应商品的对应信息 * 国标码不存在,不能更新,返回失败 * body里面,因为**bar_code**不能更新,所以,必能有bar_code * 其他字段选填 > PATCH /products/:bar_code #### **Input** | Name | Type | Description | | ------------- | ----- | -------------------- | | name | str | 名称 | | vendor_name | str | 商家名称 | | brand | str | 品牌名称 | | ware_id | str | 物料编码 | | region | str | 产地 | | packing | str | 包装 | | weight | float | 毛重 | | tax_rate | float | 税率 | | seo_info | str | seo信息 | | properties | str | 属性 | #### **Response** ```python { "bar_code": str, "vendor_name": str, "ware_id": str, "brand": str, "region": str, "weight": float, "tax_rate": float, "seo_info": str, "packing": str, "properties": str, "name": str } ``` ### 批量查询商品 * 使用国标码,查询已经存在的商品的信息. * 无论查询条件是一个还是多个,都返回一个list * 如果失败,返回的数据,没有data字段 > GET /search/products **Parameters** | Name | Type | Description | | -------- | ---- | ------------------------- | | bar_code | str | bar code 字符串,逗号隔开 | demo: #### **Response** ```python [ { "bar_code": str, "vendor_name": str, "ware_id": str, "brand": str, "region": str, "weight": float, "tax_rate": float, "seo_info": str, "packing": str, "properties": str, "name": str } ] ```