游戏装备
儿童编程
装备列表
Method and Url Structure
Method |
Resource URL |
GET |
/program_face2face/game/equipment_list/ |
cURL Example
curl -X GET -H 'Authorization: Token tester001' -d data{...}
127.0.0.1:8000/program_face2face/game/equipment_list/
JSON Response
{
"count": 5,
"next": null,
"previous": null,
"results": [
{
"pk": 5,
"name": "五彩神牛",
"img": "http://niu.img",
"kind": "mounts",
"kind_display": "坐骑",
"content": "开局一条鲲,进化全靠吞",
"price": 1000,
"only_one": true
},
{
"pk": 4,
"name": "松紧裤腰带",
"img": "http://yao.img",
"kind": "belt",
"kind_display": "腰带",
"content": "",
"price": 100,
"only_one": true
},
{
"pk": 3,
"name": "原谅帽",
"img": "http://mao.img",
"kind": "hat",
"kind_display": "帽子",
"content": "当然是选择原谅她",
"price": 200,
"only_one": true
},
{
"pk": 2,
"name": "书",
"img": "http://shu.img",
"kind": "magic_book",
"kind_display": "魔法书",
"content": "你喜欢看书么,叔也喜欢看你",
"price": 500,
"only_one": true
},
{
"pk": 1,
"name": "屠龙刀",
"img": "http://dao.img",
"kind": "weapon",
"kind_display": "武器",
"content": "我四渣渣飞,是兄弟就来啃我",
"price": 500,
"only_one": true
}
]
}
装备解锁
Method and Url Structure
Method |
Resource URL |
POST |
/program_face2face/game/unlock_equipment/ |
Request and Parameters
Name |
Description |
Required |
Default |
equipment |
装备pk |
YES |
|
Request
{
"equipment": 1
}
cURL Example
curl -X POST -H 'Authorization: Token tester001' -d data{...}
127.0.0.1:8000/program_face2face/game/unlock_equipment/
JSON Response
{
"status": 0,
"message": ""
}
装备穿戴/卸下
Method and Url Structure
Method |
Resource URL |
PUT |
/program_face2face/game/equipment_equip/${pk}/ |
cURL Example
curl -X PUT -H 'Authorization: Token tester001' -d data{...}
127.0.0.1:8000/program_face2face/game/equipment_equip/1/
Request and Parameters
Name |
Description |
Required |
Default |
equip |
是否穿戴 |
YES |
|
Request
{
"equip": true/false
}
JSON Response
{
"pk": 1,
"owner": "tester001",
"equipment": {
"kind": "weapon",
"name": "屠龙刀",
"img": "http://dao.img",
"price": 500,
"content": "我四渣渣飞,是兄弟就来啃我",
"pk": 1,
"only_one": false
},
"equip": true,
"position_x": 0,
"position_y": 0
}
装备移动位置
Method and Url Structure
Method |
Resource URL |
POST |
/program_face2face/game/equipment_position/ |
cURL Example
curl -X POST -H 'Authorization: Token tester001' -d data{...}
127.0.0.1:8000/program_face2face/game/equipment_position/
Request and Parameters
Name |
Description |
Required |
Default |
equipment |
我的装备pk |
YES |
|
position_x |
移动后的x |
YES |
|
position_y |
移动后的y |
YES |
|
Request
{
"equipment": 1,
"position_x": 3,
"position_y": 2
}
JSON Response
{
"status": 0,
"message": ""
}