[关闭]
@chengxuyuan 2021-05-06T03:24:01.000000Z 字数 2444 阅读 289

勋章文档

橙旭园直播课堂


新建勋章

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
POST {{host}}/server/community/create_medal/ 新建勋章 YES

Request Parameters

Name Description Required Default
name 勋章名字 YES
content 介绍 YES
image 图标 YES

Request Data

  1. {
  2. "name":"勋章名字",
  3. "content":"介绍",
  4. "image":"https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"
  5. }

cURL Example

  1. curl -X POST -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/create_medal/

Response

  1. {
  2. "id": 3,
  3. "pk": 3,
  4. "deleted": false,
  5. "create_time": "2021-04-28T15:21:23.778744",
  6. "order_index": 1000,
  7. "name": "勋章名字",
  8. "content": "介绍",
  9. "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"
  10. }

勋章列表

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
GET {{host}}/server/community/list_medal/ 列表 YES

cURL Example

  1. curl -X GET -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/list_medal/

Response

  1. {
  2. "count": 3,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "id": 3,
  8. "pk": 3,
  9. "deleted": false,
  10. "create_time": "2021-04-28T15:21:23.778744",
  11. "order_index": 1000,
  12. "name": "勋章名字",
  13. "content": "介绍",
  14. "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"
  15. }
  16. ]
  17. }

勋章奖励

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
POST {{host}}/server/community/reward_medal/ 发放勋章 YES

Request Parameters

Name Description Required Default
username 用户账号 YES
medal_id 勋章id YES

Request Data

  1. {
  2. "username":"15201052252",
  3. "medal_id":1
  4. }

cURL Example

  1. curl -X POST -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/reward_medal/

Response

  1. {
  2. "id": 1,
  3. "pk": 1,
  4. "deleted": false,
  5. "create_time": "2021-04-28T15:21:16.151716",
  6. "order_index": 1000,
  7. "name": "勋章名字",
  8. "content": "介绍",
  9. "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"
  10. }
  1. {
  2. "status": -4,
  3. "message": "用户不存在"
  4. }

我的勋章

Method and URL Structure

Method Method Resource URL Descriptions Authentications Required
GET {{host}}/server/community/my_medals/ 我的勋章 YES

Request Parameters

Name Description Required Default
owner 用户账号 NO

Request Data

  1. {
  2. "owner":"15201052252"
  3. }

cURL Example

  1. curl -X GET -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/my_medals/?owner=15201052252

Response

  1. {
  2. "count": 1,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "id": 3,
  8. "pk": 3,
  9. "medal": {
  10. "id": 1,
  11. "pk": 1,
  12. "deleted": false,
  13. "create_time": "2021-04-28T15:21:16.151716",
  14. "order_index": 1000,
  15. "name": "勋章名字",
  16. "content": "介绍",
  17. "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"
  18. },
  19. "deleted": false,
  20. "create_time": "2021-04-28T15:51:02.660955",
  21. "order_index": 1000,
  22. "owner": 367
  23. }
  24. ]
  25. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注