勋章文档
橙旭园直播课堂
新建勋章
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
{ "name":"勋章名字", "content":"介绍", "image":"https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"}
cURL Example
curl -X POST -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/create_medal/
Response
{ "id": 3, "pk": 3, "deleted": false, "create_time": "2021-04-28T15:21:23.778744", "order_index": 1000, "name": "勋章名字", "content": "介绍", "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"}
勋章列表
Method and URL Structure
| Method |
Method Resource URL |
Descriptions |
Authentications Required |
| GET |
{{host}}/server/community/list_medal/ |
列表 |
YES |
cURL Example
curl -X GET -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/list_medal/
Response
{ "count": 3, "next": null, "previous": null, "results": [ { "id": 3, "pk": 3, "deleted": false, "create_time": "2021-04-28T15:21:23.778744", "order_index": 1000, "name": "勋章名字", "content": "介绍", "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg" } ]}
勋章奖励
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
{ "username":"15201052252", "medal_id":1}
cURL Example
curl -X POST -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/reward_medal/
Response
{ "id": 1, "pk": 1, "deleted": false, "create_time": "2021-04-28T15:21:16.151716", "order_index": 1000, "name": "勋章名字", "content": "介绍", "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg"}
{ "status": -4, "message": "用户不存在"}
我的勋章
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
{ "owner":"15201052252"}
cURL Example
curl -X GET -H 'Content-Type: application/json' --data '{...}' http://127.0.0.1:8000/server/community/my_medals/?owner=15201052252
Response
{ "count": 1, "next": null, "previous": null, "results": [ { "id": 3, "pk": 3, "medal": { "id": 1, "pk": 1, "deleted": false, "create_time": "2021-04-28T15:21:16.151716", "order_index": 1000, "name": "勋章名字", "content": "介绍", "image": "https://static1.cxy61.com/okm/zhaoxingzhuang2.jpg" }, "deleted": false, "create_time": "2021-04-28T15:51:02.660955", "order_index": 1000, "owner": 367 } ]}