[关闭]
@chengxuyuan 2019-05-09T08:32:37.000000Z 字数 3464 阅读 423

蓝钻商城

橙旭园儿童编程


获取商品列表

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
GET /server/market/products/ 获取商品列表 NO

Request Parameters

Name Description Required Default
product_type 商品类型: 1: 实物商品 NO

Request

  1. {
  2. "product_type": "applab"
  3. }

cURL Example

  1. curl http://localhost:8000/market/products/?product_type=1

Response

  1. {
  2. "count": 14,
  3. "next": "http://localhost:8000/server/market/products/?page=2",
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 30,
  8. "name": "橙旭园定制手账本",
  9. "content": "橙旭园定制logo手账本,独此一家,错过后悔!",
  10. "image": "https://static1.bcjiaoyu.com/logo%20book.jpg",
  11. "diamond": 7500,
  12. "bought": 11,
  13. "create_time": "2018-11-08T13:54:08",
  14. "product_type_display": "实际物品",
  15. "product_type": 0
  16. },
  17. ....
  18. ]
  19. }

获取商品详情

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
GET /server/market/product/${pk}/ 获取商品详情 NO

cURL Example

  1. curl http://localhost:8000/server/market/product/30/'

Response

  1. {
  2. "pk": 30,
  3. "name": "橙旭园定制手账本",
  4. "content": "橙旭园定制logo手账本,独此一家,错过后悔!",
  5. "image": "https://static1.bcjiaoyu.com/logo%20book.jpg",
  6. "diamond": 7500,
  7. "bought": 11,
  8. "create_time": "2018-11-08T13:54:08",
  9. "product_type_display": "实际物品",
  10. "product_type": 0
  11. }

生成商品订单

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
POST /server/market/product/purchase/${pk}/ 生成商品订单 YES

cURL Example

  1. curl -X POST -H 'Authorization: Token 2db6e330c34d52ba143c34c28ac91e9569f6b0fa' http://localhost:8000/server/market/product/purchase/30/

Response

  1. {
  2. "amount": "7500.00",
  3. "rent_course_id": null,
  4. "channel": "diamond",
  5. "order_number": "12345712755974492736228530",
  6. "channel_display": "蓝钻",
  7. "status": 0,
  8. "status_display": "待付款",
  9. "is_done": false,
  10. "order_type_display": "蓝钻商品",
  11. "apple_product_id": "",
  12. "agent_number": null,
  13. "create_time": "2019-04-29T17:36:20.638318",
  14. "userinfo": "18516271364"
  15. }

支付商品订单

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
PUT /server/market/order/payment/${order_number}/ 生成商品订单 YES

Request Parameters

Name Description Required Default
channel 支付渠道 YES

Request

  1. {
  2. "channel": "diamond"
  3. }

cURL Example

  1. curl -X PUT -H 'Content-Type: application/json' --data '{"channel": "diamond"}' -H 'Authorization: Token 2db6e330c34d52ba143c34c28ac91e9569f6b0fa' http://localhost:8000/server/market/order/payment/12345712747406592736228530/

Response

  1. {
  2. "amount": "7500.00",
  3. "rent_course_id": null,
  4. "channel": "diamond",
  5. "order_number": "12345712755974492736228530",
  6. "channel_display": "蓝钻",
  7. "status": 0,
  8. "status_display": "待付款",
  9. "is_done": false,
  10. "order_type_display": "蓝钻商品",
  11. "apple_product_id": "",
  12. "agent_number": null,
  13. "create_time": "2019-04-29T17:36:20.638318",
  14. "userinfo": "18516271364"
  15. }

获取兑换列表

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
GET /server/market/orders/ 获取商品列表 NO

Request Parameters

Name Description Required Default
order_type diamond_product YES
status 2 YES

Request

  1. {
  2. "order_type": "diamond_product",
  3. "status": "2"
  4. }

cURL Example

  1. curl http://localhost:8000/market/orders/?status=1&order_type=diamond_product

Response

  1. {
  2. "count": 6,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "amount": "7500.00",
  8. "rent_course_id": null,
  9. "channel": "diamond",
  10. "order_number": "12345712907817862736228530",
  11. "channel_display": "蓝钻",
  12. "status": 1,
  13. "status_display": "已付款",
  14. "is_done": false,
  15. "order_type_display": "蓝钻商品",
  16. "apple_product_id": "",
  17. "agent_number": null,
  18. "create_time": "2019-04-30T10:55:09.260236",
  19. "userinfo": "18516271364",
  20. "products": [
  21. {
  22. "product": {
  23. "pk": 30,
  24. "name": "橙旭园定制手账本",
  25. "content": "橙旭园定制logo手账本,独此一家,错过后悔!",
  26. "image": "https://static1.bcjiaoyu.com/logo%20book.jpg",
  27. "amount": 7500,
  28. "total_orders": 11,
  29. "create_time": "2018-11-08T13:54:08",
  30. "product_type_display": "实际物品",
  31. "product_type": 0
  32. },
  33. "quantity": 1,
  34. "amount": "7500.00"
  35. }
  36. ]
  37. },
  38. ...
  39. ]
  40. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注