您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

178 行
3.3 KiB

2 年前
  1. ## 创建商铺
  2. #### URL
  3. POST http://[address]/seller/create_store
  4. #### Request
  5. Headers:
  6. key | 类型 | 描述 | 是否可为空
  7. ---|---|---|---
  8. token | string | 登录产生的会话标识 | N
  9. Body:
  10. ```json
  11. {
  12. "user_id": "$seller id$",
  13. "store_id": "$store id$"
  14. }
  15. ```
  16. key | 类型 | 描述 | 是否可为空
  17. ---|---|---|---
  18. user_id | string | 卖家用户ID | N
  19. store_id | string | 商铺ID | N
  20. #### Response
  21. Status Code:
  22. 码 | 描述
  23. --- | ---
  24. 200 | 创建商铺成功
  25. 5XX | 商铺ID已存在
  26. ## 商家添加书籍信息
  27. #### URL:
  28. POST http://[address]/seller/add_book
  29. #### Request
  30. Headers:
  31. key | 类型 | 描述 | 是否可为空
  32. ---|---|---|---
  33. token | string | 登录产生的会话标识 | N
  34. Body:
  35. ```json
  36. {
  37. "user_id": "$seller user id$",
  38. "store_id": "$store id$",
  39. "book_info": {
  40. "tags": [
  41. "tags1",
  42. "tags2",
  43. "tags3",
  44. "..."
  45. ],
  46. "pictures": [
  47. "$Base 64 encoded bytes array1$",
  48. "$Base 64 encoded bytes array2$",
  49. "$Base 64 encoded bytes array3$",
  50. "..."
  51. ],
  52. "id": "$book id$",
  53. "title": "$book title$",
  54. "author": "$book author$",
  55. "publisher": "$book publisher$",
  56. "original_title": "$original title$",
  57. "translator": "translater",
  58. "pub_year": "$pub year$",
  59. "pages": 10,
  60. "price": 10,
  61. "binding": "平装",
  62. "isbn": "$isbn$",
  63. "author_intro": "$author introduction$",
  64. "book_intro": "$book introduction$",
  65. "content": "$chapter1 ...$"
  66. },
  67. "stock_level": 0
  68. }
  69. ```
  70. 属性说明:
  71. 变量名 | 类型 | 描述 | 是否可为空
  72. ---|---|---|---
  73. user_id | string | 卖家用户ID | N
  74. store_id | string | 商铺ID | N
  75. book_info | class | 书籍信息 | N
  76. stock_level | int | 初始库存,大于等于0 | N
  77. book_info类:
  78. 变量名 | 类型 | 描述 | 是否可为空
  79. ---|---|---|---
  80. id | string | 书籍ID | N
  81. title | string | 书籍题目 | N
  82. author | string | 作者 | Y
  83. publisher | string | 出版社 | Y
  84. original_title | string | 原书题目 | Y
  85. translator | string | 译者 | Y
  86. pub_year | string | 出版年月 | Y
  87. pages | int | 页数 | Y
  88. price | int | 价格(以分为单位) | N
  89. binding | string | 装帧,精状/平装 | Y
  90. isbn | string | ISBN号 | Y
  91. author_intro | string | 作者简介 | Y
  92. book_intro | string | 书籍简介 | Y
  93. content | string | 样章试读 | Y
  94. tags | array | 标签 | Y
  95. pictures | array | 照片 | Y
  96. tags和pictures:
  97. tags 中每个数组元素都是string类型
  98. picture 中每个数组元素都是string(base64表示的bytes array)类型
  99. #### Response
  100. Status Code:
  101. 码 | 描述
  102. --- | ---
  103. 200 | 添加图书信息成功
  104. 5XX | 卖家用户ID不存在
  105. 5XX | 商铺ID不存在
  106. 5XX | 图书ID已存在
  107. ## 商家添加书籍库存
  108. #### URL
  109. POST http://[address]/seller/add_stock_level
  110. #### Request
  111. Headers:
  112. key | 类型 | 描述 | 是否可为空
  113. ---|---|---|---
  114. token | string | 登录产生的会话标识 | N
  115. Body:
  116. ```json
  117. {
  118. "user_id": "$seller id$",
  119. "store_id": "$store id$",
  120. "book_id": "$book id$",
  121. "add_stock_level": 10
  122. }
  123. ```
  124. key | 类型 | 描述 | 是否可为空
  125. ---|---|---|---
  126. user_id | string | 卖家用户ID | N
  127. store_id | string | 商铺ID | N
  128. book_id | string | 书籍ID | N
  129. add_stock_level | int | 增加的库存量 | N
  130. #### Response
  131. Status Code:
  132. 码 | 描述
  133. --- | :--
  134. 200 | 创建商铺成功
  135. 5XX | 商铺ID不存在
  136. 5XX | 图书ID不存在