[关闭]
@fuyb1986 2017-11-22T03:35:12.000000Z 字数 3242 阅读 546

娃娃机

儿童编程


抽奖接口

Method and URL Structure

Method MethodResource URL Descriptions Authentications Required
PUT /program_face2face/lottery/prize_random/ YES

Request Header

Name Description Required Default
Authorization Token db02586eda69b432699b2f9031e02e8f5deda8db YES

cURL Example

  1. curl -X PUT -H 'Authorization: Token db02586eda69b432699b2f9031e02e8f5deda8db'
  2. http://127.0.0.1:8000/program_face2face/lottery/prize_random/

Prize Description

Name Description
name 名称
desc 描述
prize_type 类型
taken_status 是否中奖
taken_token 获奖 token
image_url 图片地址

JSON Response

  1. {
  2. "status": 0,
  3. "message": "",
  4. , "prize_list":[{
  5. "name":"100钻石",
  6. "desc":"100钻石",
  7. "prize_type":2,
  8. "taken_status":true,
  9. "take_token":"5mfns5elsc7xiz5i",
  10. "image_url":"http://example.com/0.png",
  11. "order_index": 101,
  12. },{
  13. "name":"趣味Python编程书",
  14. "desc":"趣味python编程书",
  15. "prize_type":0,
  16. "taken_status":true,
  17. "take_token":"jom6qomqu9fk6xik",
  18. "image_url":"http://example.com/0.png",
  19. "order_index": 103,
  20. },{
  21. "name":"10Q币",
  22. "desc":"10Q币",
  23. "prize_type":3,
  24. "taken_status":true,
  25. "take_token":"7za7cjuzpxw8u3d2",
  26. "image_url":"http://example.com/0.png",
  27. "order_index": 102,
  28. },{
  29. "name":"王者荣耀英雄嬴政",
  30. "desc":"王者荣耀英雄嬴政",
  31. "prize_type":0,
  32. "taken_status":true,
  33. "take_token":"7598iwr8j5jrtodl",
  34. "image_url":"http://example.com/0.png",
  35. "order_index": 104,
  36. }, {
  37. "name":"随机",
  38. "desc":"随机",
  39. "prize_type":4,
  40. "taken_status":true,
  41. "take_token":"6mmewhuh9hy2odfr"
  42. "image_url":"http://example.com/0.png",
  43. "order_index": 100,
  44. }],
  45. }

获取奖品

Method and URL Structure

Method MethodResource URL Descriptions Authentications Required
PUT /program_face2face/lottery/prize_take/ YES

Request Header

Name Description Required Default
Authorization Token db02586eda69b432699b2f9031e02e8f5deda8db YES

Request Data

  1. {
  2. "take_token" :"7598iwr8j5jrtodl"
  3. }

cURL Example

  1. curl -X PUT -H 'Authorization: Token db02586eda69b432699b2f9031e02e8f5deda8db'
  2. --data {...} http://127.0.0.1:8000/program_face2face/lottery/prize_take/

JSON Response

  1. {
  2. "status": 0,
  3. "message": "",
  4. "taken_status":true,
  5. "name":"150钻石",
  6. "prize_type":2,
  7. "take_token":"kmpl836g6o59wi2r",
  8. "image_url":"http://example.com/0.png",
  9. "desc":"150钻石"
  10. }

获取奖品记录

Method and URL Structure

Method Resource URL Authorization
GET /program_face2face/lottery/prize_list/ YES

cURL Example

  1. curl -X GET -H 'Authorization: Token db02586eda69b432699b2f9031e02e8f5deda8db' http://localhost/program_face2face/lottery/prize_list/

Response Data

Name Description
name 名称
desc 描述
image_url 图片地址
taken_time 获奖时间
done 完成处理

Response

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "name":"200钻石",
  7. "desc":"200钻石",
  8. "image_url":"https://static1.bcjiaoyu.com//cxy/app/diamond.png",
  9. "taken_time":"2017-11-13T17:14:23.035504",
  10. "done":true
  11. }]
  12. }

新抽奖接口

Method and URL Structure

Method MethodResource URL Descriptions Authentications Required
PUT /program_face2face/lottery/prize_random/ YES

Request Header

Name Description Required Default
Authorization Token db02586eda69b432699b2f9031e02e8f5deda8db YES

cURL Example

  1. curl -X PUT -H 'Authorization: Token db02586eda69b432699b2f9031e02e8f5deda8db'
  2. http://127.0.0.1:8000/program_face2face/lottery/prize_random/

Prize Description

Name Description
pool_name 奖池
taken_status 是否中奖
taken_token 获奖 token

JSON Response

  1. {
  2. "status": 0,
  3. "message": "",
  4. "prize_list":[{
  5. "take_token":"de9iqpkd8h8ywltd",
  6. "taken_status":true,
  7. "pool_name":"A"
  8. },{
  9. "take_token":"5vs6x6aiu8kx9u4q",
  10. "taken_status":true,
  11. "pool_name":"B"
  12. },{
  13. "take_token":"q9u3ounoxm8jkx2t",
  14. "taken_status":true,
  15. "pool_name":"C"
  16. },{
  17. "take_token":"hafkzu1t2y1sf8iw",
  18. "taken_status":true,
  19. "pool_name":"D"
  20. }]
  21. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注