蓝钻商城
橙旭园儿童编程
获取商品列表
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
{ "product_type": "applab"}
cURL Example
curl http://localhost:8000/market/products/?product_type=1
Response
{ "count": 14, "next": "http://localhost:8000/server/market/products/?page=2", "previous": null, "results": [ { "pk": 30, "name": "橙旭园定制手账本", "content": "橙旭园定制logo手账本,独此一家,错过后悔!", "image": "https://static1.bcjiaoyu.com/logo%20book.jpg", "diamond": 7500, "bought": 11, "create_time": "2018-11-08T13:54:08", "product_type_display": "实际物品", "product_type": 0 }, .... ]}
获取商品详情
Method and URL Structure
| Method |
Method Resource URL |
Descriptions |
Authentications Required |
| GET |
/server/market/product/${pk}/ |
获取商品详情 |
NO |
cURL Example
curl http://localhost:8000/server/market/product/30/'
Response
{ "pk": 30, "name": "橙旭园定制手账本", "content": "橙旭园定制logo手账本,独此一家,错过后悔!", "image": "https://static1.bcjiaoyu.com/logo%20book.jpg", "diamond": 7500, "bought": 11, "create_time": "2018-11-08T13:54:08", "product_type_display": "实际物品", "product_type": 0}
生成商品订单
Method and URL Structure
| Method |
Method Resource URL |
Descriptions |
Authentications Required |
| POST |
/server/market/product/purchase/${pk}/ |
生成商品订单 |
YES |
cURL Example
curl -X POST -H 'Authorization: Token 2db6e330c34d52ba143c34c28ac91e9569f6b0fa' http://localhost:8000/server/market/product/purchase/30/
Response
{ "amount": "7500.00", "rent_course_id": null, "channel": "diamond", "order_number": "12345712755974492736228530", "channel_display": "蓝钻", "status": 0, "status_display": "待付款", "is_done": false, "order_type_display": "蓝钻商品", "apple_product_id": "", "agent_number": null, "create_time": "2019-04-29T17:36:20.638318", "userinfo": "18516271364"}
支付商品订单
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
{ "channel": "diamond"}
cURL Example
curl -X PUT -H 'Content-Type: application/json' --data '{"channel": "diamond"}' -H 'Authorization: Token 2db6e330c34d52ba143c34c28ac91e9569f6b0fa' http://localhost:8000/server/market/order/payment/12345712747406592736228530/
Response
{ "amount": "7500.00", "rent_course_id": null, "channel": "diamond", "order_number": "12345712755974492736228530", "channel_display": "蓝钻", "status": 0, "status_display": "待付款", "is_done": false, "order_type_display": "蓝钻商品", "apple_product_id": "", "agent_number": null, "create_time": "2019-04-29T17:36:20.638318", "userinfo": "18516271364"}
获取兑换列表
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
{ "order_type": "diamond_product", "status": "2"}
cURL Example
curl http://localhost:8000/market/orders/?status=1&order_type=diamond_product
Response
{ "count": 6, "next": null, "previous": null, "results": [ { "amount": "7500.00", "rent_course_id": null, "channel": "diamond", "order_number": "12345712907817862736228530", "channel_display": "蓝钻", "status": 1, "status_display": "已付款", "is_done": false, "order_type_display": "蓝钻商品", "apple_product_id": "", "agent_number": null, "create_time": "2019-04-30T10:55:09.260236", "userinfo": "18516271364", "products": [ { "product": { "pk": 30, "name": "橙旭园定制手账本", "content": "橙旭园定制logo手账本,独此一家,错过后悔!", "image": "https://static1.bcjiaoyu.com/logo%20book.jpg", "amount": 7500, "total_orders": 11, "create_time": "2018-11-08T13:54:08", "product_type_display": "实际物品", "product_type": 0 }, "quantity": 1, "amount": "7500.00" } ] }, ... ]}