@sewise-dev
2019-03-01T06:08:47.000000Z
字数 4212
阅读 677
微录播
华辰
编号 | 版本 | 说明 | 作者 | 日期 |
---|---|---|---|---|
1 | v1.0 | 创建文档 | GuQiuSheng | 2018-02-20 |
HTTP请求状态返回格式
返回字段 | 字段类型 | 说明 |
---|---|---|
success | Boolean | 请求返回码(详细请见状态表) |
msg | String | 错误原因描述 |
data | json | 返回结果 |
错误样例
{
"success": false,
"mgs": "invalid appid"
}
成功样例
{
"success": true,
"data": {"access_token":"ACCESS_TOKEN","expires_in":7200}
}
/licence/info
application/json
GET
参数 必选 类型 说明 QueryParams to_uid 是 string 被授权用户ID nick_name 是 String 被授权用户昵称
200
返回字段 | 字段类型 | 说明 |
---|---|---|
success | Boolean | 请求结果 |
msg | String | 返回错误信息 |
data | Array | 返回结果,详细信息请看 Data Item |
Data Item
返回字段 | 字段类型 | 说明 |
---|---|---|
to_uid | String | 被授权用户ID |
nick_name | String | 被授权用户昵称 |
max_count | Integer | 最大播放次数 |
current_count | Integer | 当前已播放次数 |
expire_time | String | 授权过期时间,格式如 "2019-02-20" |
categorys | Array | JSONArray结构的分类信息,详细信息请见 Category Item |
Category Item
返回字段 | 字段类型 | 说明 |
---|---|---|
cid | String | 一级分类ID |
cname | String | 一级分类名称 |
status | Integer | 分类授权状态 1已授权 0未授权 |
data | Array | JSONArray结构的二级分类信息,详细信息请见 Data Item |
Data Item
返回字段 | 字段类型 | 说明 |
---|---|---|
sub_cid | String | 二级分类ID |
sub_cname | String | 二级分类名称 |
status | Integer | 二级分类授权状态 1已授权 0未授权 |
Request
curl -X GET http://localhost/license/info?to_uid=xxxx&nick_name=xxxxx
Response
{"success":true,"data":{ to_uid: 'xxxx1',
expire_time: '2019-02-24',
nick_name: 'xxxx',
max_count: 20,
current_count: 0,
categorys:
[ { cid: '1', cname: '分类1', status: 1, data: [{sub_cid:'11',sub_cname:'xxxxx',status:1}] },
{ cid: '2', cname: '分类2', status: 0, data: [{sub_cid:'12',sub_cname:'xxxxx',status:1}] } ]}
}
/licence/update
application/json
POST
参数 必选 类型 说明 RequestBody 参数如接口【获取用户授权信息】返回结果中Data结构 是 Object JSONObject结构的授权信息
200
返回字段 | 字段类型 | 说明 |
---|---|---|
success | int | 返回状态码 |
msg | String | 返回错误信息 |
data | Array | 返回结果 |
Request
curl -X POST -H "Content-Type:application/json" -d { to_uid: 'xxxx1',
expire_time: '2019-02-24',
nick_name: 'xxxx',
max_count: 20,
categorys:
[ { cid: '1', cname: '分类1', status: 1, data: [{sub_cid:'11',sub_cname:'xxxxx',status:1}] },
{ cid: '2', cname: '分类2', status: 0, data: [{sub_cid:'12',sub_cname:'xxxxx',status:1}] } ]} http://localhost/licence/update
Response
{
"success": true,
}
检查用户在指定课程的授权情况和播放限制
/licence/check
application/json
GET
参数 必选 类型 说明 QueryParams to_uid 是 String 被授权用户ID cid 否 String 一级分类ID sub_cid 否 String 二级分类ID
200
返回字段 | 字段类型 | 说明 |
---|---|---|
success | int | 返回状态码 |
msg | String | 返回错误信息 |
data | Array | 返回结果 |
Request
curl -X GET http://localhost/licence/check?to_uid=xxxx
Response
{
"success": true
}
在原接口上增加返回二级分类信息
/square/subjects
application/json
GET
参数 必选 类型 说明 QueryParams 无
200
返回字段 | 字段类型 | 说明 |
---|---|---|
status | Boolean | 返回结果 |
msg | String | 返回错误信息 |
subjects | Array | 返回结果 |
Request
curl -X GET http://localhost/licence/check?to_uid=xxxx
Response
{"status":true,"subjects":[{"name":"国考","code":"762","avatar":"http://vztsd.sewise.com/icons/icon_lawer.png","data":[{"sub_name":"基础","sub_code":"798","sub_avatar":null,"id":"85","kind":6},{"sub_name":"强化","sub_code":"799","sub_avatar":null,"id":"85","kind":6},{"sub_name":"冲刺","sub_code":"800","sub_avatar":null,"id":"85","kind":6}]}]}
接口扩展,提交增加二级分类信息
/course
POST
参数 必选 类型 说明 username 是 string 用户名称 userType 是 int 用户类型 local 否 int local=1表示微录播主机可见,local=0表示云空间不可见 nickname 是 string 用户昵称 courseid 否 string 课程id;修改时必传 poster 否 string 封面 summary 否 string 简介 grade 否 string 年级;(大学时为科目) subject 否 string 学科;(大学时为科目下的专业) subject_category 否 string (大学时)学科分类 title 否 string 标题 sn 否 string 微录播主机sn mark 否 string 标记 freeTime 否 string 免费时间 price 否 string 价格 sub_subject 否 String 二级学科分类
200
返回字段 | 字段类型 | 说明 |
---|---|---|
success | int | 返回请求状态;true请求成功;false请求失败 |
msg | string | 返回信息 |
/course/counts
application/json
GET
参数 必选 类型 说明 QueryParams 无
200
返回字段 | 字段类型 | 说明 |
---|---|---|
status | Boolean | 返回结果 |
msg | String | 返回错误信息 |
data | Array | 返回结果 |
Request
curl -X GET http://localhost/course/counts
Response
{"success":true,"data":{"counts":1}}
/square/myBuyCourse
application/json
GET
200
RequestBody
参数 必选 类型 说明 page 否 string 页数,默认为1 size 否 string 一页显示数量,默认为3 userinfo 是 json 用户登陆信息
返回字段 | 字段类型 | 说明 |
---|---|---|
success | boolean | 结果 |
data | array | 课程内容;参考原有课程列表结构 |
Request
url: http://ip:port/square/experts
Response
{"success":true,"data":{"data":[{"courseid":'xxx',name:'xxx',count:'xx'}],"total":1,"totalPage":1}}}