接口约定
- 使用https
- restful风格
- 用户端:https://{域名}/api/{接口版本号}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
- 管理端:https://{域名}/admin/api/{接口版本号}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
- 测试环境域名babieta.xivan.cn
- 正式环境域名待定
- 公共参数放在header,如userid,session_key,unionid,version等
- resource: homepage
接口
GET /homepage
name | cname | type | Description |
---|---|---|---|
用途 | 获取首页内容 | ||
方式 | GET | ||
版本号 | v1.0 |
请求数据:
query_string 参数/可选参数
例
curl -i "https://babieta.xivan.cn/api/v1.0/homepage" -H "userid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"
wx.request({
"url":"https://babieta.xivan.cn/api/v1.0/homepage",
"method":"GET",
"success": res =>{
console.log(res)
},
"data":{},
"dataType":"json",
"header": { "content-type":"application/x-www-form-urlencoded",
"userid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
"complete": res => {
console.log(res)
}
})
返回数据:
name | cname | type | Description |
---|---|---|---|
code | int | 返回码 0成功 非0失败 | |
msg | string | 错误信息 | |
weekly | list<object> | 周进度 | |
daily | object | 日进度 | |
statistics | object | 历史统计 |
例
{
"msg": "",
"code": 0,
"weekly": [ //周报
{
"date":1537027200, //时间点
"day_week":0, //周天
"score":{ //得分
"obtain":5, //已获取得分
"max":25 //当日最大可获取得分
},
"task": {
"express":{"word_count":5, "max_word_count":10},
"soak":{"duration":550, "max_duration":1500},
"communication":{"duration":550, "max_duration":1500}
}
},...
],
"daily": {
"date":1537027200,
"day_week":0,
"score": {
"obtain":5,
"max":25
}
"task": {
"express":{"word_count":5, "max_word_count":10},
"soak":{"duration":550, "max_duration":1500},
"communication":{"duration":550, "max_duration":1500}
}
}
"statistics":{
"express":{ "word_count":54},
"soak":{"duration":60000},
"communication":{"duration":5555}
}
}