[关闭]
@sewise-dev 2019-03-01T06:08:47.000000Z 字数 4212 阅读 677

华辰用户授权

微录播 华辰


更新历史

编号 版本 说明 作者 日期
1 v1.0 创建文档 GuQiuSheng 2018-02-20

目录

1. 全局返回码说明

HTTP请求状态返回格式

返回字段 字段类型 说明
success Boolean 请求返回码(详细请见状态表)
msg String 错误原因描述
data json 返回结果

错误样例
{
"success": false,
"mgs": "invalid appid"
}
成功样例
{
"success": true,
"data": {"access_token":"ACCESS_TOKEN","expires_in":7200}
}


1.用户授权

1.1 获取用户授权信息

接口地址

/licence/info

HTTP Content-Type

application/json

请求方式

GET

请求参数
参数 必选 类型 说明
QueryParams
to_uid string 被授权用户ID
nick_name String 被授权用户昵称
HTTP 响应状态

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}] } ]}
}

1.2 添加/修改用户授权信息

接口地址

/licence/update

HTTP Content-Type

application/json

请求方式

POST

请求参数
参数 必选 类型 说明
RequestBody
参数如接口【获取用户授权信息】返回结果中Data结构 Object JSONObject结构的授权信息
HTTP 响应状态

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,
}

1.3 检查用户授权

接口说明

检查用户在指定课程的授权情况和播放限制

接口地址

/licence/check

HTTP Content-Type

application/json

请求方式

GET

请求参数
参数 必选 类型 说明
QueryParams
to_uid String 被授权用户ID
cid String 一级分类ID
sub_cid String 二级分类ID
HTTP 响应状态

200

返回字段 字段类型 说明
success int 返回状态码
msg String 返回错误信息
data Array 返回结果
接口示例

Request
curl -X GET http://localhost/licence/check?to_uid=xxxx
Response
{
"success": true
}

2 分类

2.1 获取分类信息

接口说明

在原接口上增加返回二级分类信息

接口地址

/square/subjects

HTTP Content-Type

application/json

请求方式

GET

请求参数
参数 必选 类型 说明
QueryParams

HTTP 响应状态

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}]}]}

3 课程

3.1 提交课程

接口说明

接口扩展,提交增加二级分类信息

接口地址

/course

HTTP 请求方式

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 二级学科分类
HTTP 响应状态

200

返回字段 字段类型 说明
success int 返回请求状态;true请求成功;false请求失败
msg string 返回信息

3.2 获取机构课程总数

接口说明
接口地址

/course/counts

HTTP Content-Type

application/json

请求方式

GET

请求参数
参数 必选 类型 说明
QueryParams

HTTP 响应状态

200

返回字段 字段类型 说明
status Boolean 返回结果
msg String 返回错误信息
data Array 返回结果
接口示例

Request
curl -X GET http://localhost/course/counts
Response
{"success":true,"data":{"counts":1}}

3.3 获取购买的课程

接口地址

/square/myBuyCourse

HTTP Content-Type

application/json

HTTP 请求方式

GET

HTTP 响应状态

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}}}

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注