当代数据库管理系统课程实验二
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

3.3 KiB

创建商铺

URL

POST http://[address]/seller/create_store

Request

Headers:

key 类型 描述 是否可为空
token string 登录产生的会话标识 N

Body:

{
  "user_id": "$seller id$",
  "store_id": "$store id$"
}
key 类型 描述 是否可为空
user_id string 卖家用户ID N
store_id string 商铺ID N

Response

Status Code:

描述
200 创建商铺成功
5XX 商铺ID已存在

商家添加书籍信息

URL:

POST http://[address]/seller/add_book

Request

Headers:

key 类型 描述 是否可为空
token string 登录产生的会话标识 N

Body:

{
  "user_id": "$seller user id$",
  "store_id": "$store id$",
  "book_info": {
    "tags": [
      "tags1",
      "tags2",
      "tags3",
      "..."
    ],
    "pictures": [
      "$Base 64 encoded bytes array1$",
      "$Base 64 encoded bytes array2$",
      "$Base 64 encoded bytes array3$",
      "..."
    ],
    "id": "$book id$",
    "title": "$book title$",
    "author": "$book author$",
    "publisher": "$book publisher$",
    "original_title": "$original title$",
    "translator": "translater",
    "pub_year": "$pub year$",
    "pages": 10,
    "price": 10,
    "binding": "平装",
    "isbn": "$isbn$",
    "author_intro": "$author introduction$",
    "book_intro": "$book introduction$",
    "content": "$chapter1 ...$"
  },
  "stock_level": 0
}

属性说明:

变量名 类型 描述 是否可为空
user_id string 卖家用户ID N
store_id string 商铺ID N
book_info class 书籍信息 N
stock_level int 初始库存,大于等于0 N

book_info类:

变量名 类型 描述 是否可为空
id string 书籍ID N
title string 书籍题目 N
author string 作者 Y
publisher string 出版社 Y
original_title string 原书题目 Y
translator string 译者 Y
pub_year string 出版年月 Y
pages int 页数 Y
price int 价格(以分为单位) N
binding string 装帧,精状/平装 Y
isbn string ISBN号 Y
author_intro string 作者简介 Y
book_intro string 书籍简介 Y
content string 样章试读 Y
tags array 标签 Y
pictures array 照片 Y

tags和pictures:

tags 中每个数组元素都是string类型  
picture 中每个数组元素都是string(base64表示的bytes array)类型

Response

Status Code:

描述
200 添加图书信息成功
5XX 卖家用户ID不存在
5XX 商铺ID不存在
5XX 图书ID已存在

商家添加书籍库存

URL

POST http://[address]/seller/add_stock_level

Request

Headers:

key 类型 描述 是否可为空
token string 登录产生的会话标识 N

Body:

{
  "user_id": "$seller id$",
  "store_id": "$store id$",
  "book_id": "$book id$",
  "add_stock_level": 10
}
key 类型 描述 是否可为空
user_id string 卖家用户ID N
store_id string 商铺ID N
book_id string 书籍ID N
add_stock_level int 增加的库存量 N

Response

Status Code:

描述
200 创建商铺成功
5XX 商铺ID不存在
5XX 图书ID不存在