使用第三方帐号登录网站应用授权,请参考网站接入文档
Access Token是开发者的全局唯一票据,开发者调用各接口时都需使用Access Token。Access Token的有效期目前为2周,需定时刷新,重复获取将导致上次获取的Access Token失效。
注意:此处获取的Access Token是Client Credentials模式的Access Token,请勿和第三方应用接入(即Authorization Code模式)所获取的Access Token混用。
POST
https://open.zafu.edu.cn/oauth/token
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| grant_type | true | string | 设置为固定值”client_credentials” |
| client_id | true | string | 接入应用的client_id,在管理端或开放平台中应用创建时获得 |
| client_secret | true | string | 接入应用的client_secret,在管理端或开放平台中应用创建时获得 |
json数据示例:
{
"grant_type":"client_credentials",
"client_id": [client_id],
"client_secret":[client_secret],
}
注意:post数据时,在请求的header里面增加Content-Type:application/json
正确返回 json示例
{
"access_token": "VrwNIk9VGqrucb6zZukmCuQbvlBhbnwj",//string类型,票据内容
"expires_in": 1209600,//过期时间(秒)
"scope": "base_api",
"token_type": "Bearer"
}
错误返回 json示例
app_secret取值错误的响应码
HTTP Status Code 401
scope取值异常的错误码
HTTP Status Code 403
{
"error": "access_denied",
"error_description": "Unauthorized scope: manaer"
}
grant_type取值异常的错误码
HTTP Status Code 400
{
"error": "unsupported_grant_type",
"error_description": "Unsupported grant type: client_edentials"
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| access_token | string | 请求令牌内容 |
| expires_in | string | 过期时间(秒) |
| scope | string | Scope |
| token_type | string | Bearer |
所有的开放平台接口在访问时都需要access_token。第三方服务器会首先验证access_token合法性,才会进行之后的逻辑。如果验证失败则返回的http状态码为401或403
access_token取值异常的错误码
HTTP Status Code 403
{
"error": "invalid_grant",
"error_description": "Access token is expired"
}
当用户通过第三方客户端启动并访问第三方应用时,第三方服务器可使用该api验证该用户并获取该用户的菜单列表信息.
POST
https://open.zafu.edu.cn/api/menulist?access_token=[access_token]
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| access_token | true | string | 应用服务器获取的access_token |
json示例
{
"type": "success",
"code": "成功",
"content": "成功",
"anchor": "undefined",
"errorFields": [],
"data": [
{
"parent": 1701,
"has_dap": 0,
"lvl": 2,
"menuDaps": [],
"visiable": 1,
"memo": null,
"sort": 40,
"fap_key": "admin.appui.xufg",
"childs": [
{
"parent": 1702,
"has_dap": 0,
"lvl": 3,
"menuDaps": [
{
"name": "新增",
"id": 1,
"menu": 1703,
"fap_key": "admin.xxx.create"
},
{
"name": "删除",
"id": 2,
"menu": 1703,
"fap_key": "admin.xxx.delete"
}
],
"name": "类型设置",
"visiable": 1,
"memo": null,
"icon_class": null,
"id": 1703,
"sort": 1,
"fap_key": "admin.appui.xyfg.fglx",
"url": "http://localhost/appbiz/admin/campusviewtype/list.htm"
},
{
"parent": 1702,
"has_dap": 0,
"lvl": 3,
"menuDaps": [],
"name": "校园风光",
"visiable": 1,
"memo": null,
"icon_class": null,
"id": 1704,
"sort": 2,
"fap_key": "admin.appui.xyfg.xyfg",
"url": "http://localhost/appbiz/admin/campusview/list.htm"
}
],
"url": "#",
"name": "校园",
"icon_class": null,
"id": 1702
}
]
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | string | 返回类型 |
| code | string | 返回码 |
| content | string | 返回消息 |
| anchor | string | 锚 |
| errorFields | string | 错误字段 |
| data | string | 菜单列表 |
| parent | string | 父级菜单id |
| has_dap | Boolean | 可配权限 |
| lvl | int | 菜单级别 |
| menuDaps | string | 菜单功能列表 |
| name | string | 功能名称 |
| id | int | 功能id |
| menu | int | 所属菜单 |
| fap_key | string | 功能权限 |
| visiable | string | 是否可见 |
| memo | string | 备注 |
| sort | string | 排序 |
| childs | string | 子集菜单 |
无
第三方应用服务器通过本方法可以添加修改菜单.
POST
https://open.zafu.edu.cn/api/menusubmit?json=[json]access_token=[access_token]
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| json | true | string | 全部菜单json字符串,格式同列表返回参数的data |
| access_token | true | string | 应用服务器获取的access_token |
json示例
{
"type": "success",
"code": "成功",
"content": "成功",
"anchor": "undefined",
"errorFields": []
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | string | 返回类型 |
| code | string | 返回码 |
| content | string | 返回消息 |
| anchor | string | 锚 |
| errorFields | string | 错误字段 |
无
第三方应用服务器通过本方法可以删除指定的菜单.
POST
https://open.zafu.edu.cn/api/menudelete?id=[id]&access_token=[access_token]
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| id | true | string | 菜单id |
| access_token | true | string | 应用服务器获取的access_token |
json示例
{
"type": "success",
"code": "成功",
"content": "成功",
"anchor": "undefined",
"errorFields": []
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | string | 返回类型 |
| code | string | 返回码 |
| content | string | 返回消息 |
| anchor | string | 锚 |
| errorFields | string | 错误字段 |
无
第三方应用服务器通过本方法可以推送短信消息、app通知给用户.
POST
https://open.zafu.edu.cn/api/msgcreate?content=123&scope=1&userno=20121032&channel=1&access_token=[access_token]
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| content | true | string | 要推送的内容 |
| scope | true | Integer | 1.全体师生 ,2.全体老师,3.全体学生,4.全体本科生,5.全体研究生,6.单人 |
| userno | true | string | 学工号 |
| channel | true | string | 1.短信 2.app通知等 |
| appId | true | string | appId |
| access_token | true | string | 应用服务器获取的access_token |
| mobile | false | string | 手机号(非必填,默认学工号的手机号码,填了以手机号为准) |
json示例
{
"message": "推送内容、推送范围或推送渠道为空",
"status": 0
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| message | String | 返回消息 |
| status | Integer | 返回状态:0.错误,1.成功 |
无
第三方应用服务器通过本方法可以推送短信消息、app通知给用户.
POST
https://open.zafu.edu.cn/api/msgsend?content=123&scope=1&userno=20121032&channel=1&access_token=[access_token]
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| content | true | string | 消息内容,(微信公众号类型传json字符串)必填 |
| xgh | true | String | 学工号,App内部消息时,必填。其他类型选填也可发送 |
| messageType | true | string | 1.短信 3.微信公众号 4.邮件 5.App普通消息 6.App重要消息 7.App必做任务 8.App通知公告 |
| messageTo | true | string | 1.发短信,传手机号,必填 3.发微信公众号消息,传OpenId,必填 4.发邮件,传邮箱,必填 5/6.发App消息,传跳转url 选填 7/8.发App任务,传任务id 必填 (参考查询任务列表) |
| templateId | false | string | 发送微信公众号消息,传模板id,必填,其他类型不填 |
| appId | false | string | appId |
| dataKey | false | string | 原表数据的真实主键,用于查询是否已阅 |
| access_token | true | string | Access Token是开发者的全局唯一票据,开发者调用各接口时都需使用Access Token。Access Token的有效期目前为2周,需定时刷新,重复获取将导致上次获取的Access Token失效。必填 |
| 参数名 | 类型 | 说明 |
|---|---|---|
| status | Integer | 成功状态,成功为1,失败为0 |
| message | String | 成功或失败说明 |
| errorFields | String | 错误参数说明 |
无
第三方应用服务器通过本方法可以获取自己发送的消息是否被用户阅读,目前支持App消息、App通知公告.
POST
https://open.zafu.edu.cn/api/getMessageStatus
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| xgh | true | String | 接收人的学工号 |
| messageType | true | string | 5.App重要消息 6.App普通消息 8.App通知公告 |
| messageTo | true | string | 5/6.发App消息,传跳转url 选填 8.发App任务,传任务id 必填 (参考查询任务列表) |
| dataKey | false | string | 原表数据的真实主键,用于查询是否已阅 |
| access_token | true | string | Access Token是开发者的全局唯一票据,开发者调用各接口时都需使用Access Token。Access Token的有效期目前为2周,需定时刷新,重复获取将导致上次获取的Access Token失效。必填 |
json示例
{
"type": "success",
"code": "0",
"content": "成功",
"anchor": "undefined",
"errorFields": null,
"data": [
{
"is_read": "1",
"message_content": "东湖,共44个摄像头不在线,请及时安排检修!",
"id": 404105,
"read_date": 1720053352000
}
]
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 成功状态,成功为success,失败为error |
| content | String | 成功或失败说明 |
| errorFields | String | 错误参数说明 |
| data | List | 返回的数据 is_read: 是否已读,0为未读,1为已读 message_content: 消息内容 id: 消息id read_date: 阅读时间 |
无
第三方应用服务器通过本方法可以获取App后端配置的所有任务列表.
POST
https://open.zafu.edu.cn/api/mustTaskList
无
json示例
{
"type": "success",
"code": "成功",
"content": "成功",
"anchor": "undefined",
"errorFields": [],
"data": [
{
"id": 14,
"title": "关于清理校内废弃自行车、电瓶车的通知"
},
{
"id": 16,
"title": "测试学生销假"
},
{
"id": 18,
"title": "预警信息"
}
]
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 成功状态,成功为success,失败为error |
| content | String | 成功或失败说明 |
| errorFields | String | 错误参数说明 |
| data | List | 返回的数据 id: 任务id text: 任务名称 |
无
消费记录
POST
https://open.zafu.edu.cn/api/scanrecord.jhtm
| 参数名 | 必填 | 类型 | 说明 |
|---|---|---|---|
| termName | true | string | 终端名称 采用 utf-8 编码 |
| termSn | true | String | 终端序列号 |
| name | true | string | 姓名 |
| xgh | true | string | 学工号 |
| idCard | true | string | 身份证号 aes 加密 ,appId 向前补0到16位 ,如 appid = 01 ,补成 0000000000000001 |
| userType | true | string | 身份 用户的类型:教师 |
| scanDate | true | string | 扫码时间 yy-MM-dd hh:mm:ss 编码格式 |
| appId | true | string | 应用id |
| access_token | true | string | 应用服务器获取的access_token |
json示例
{
"type":"success",
"code":"1",
"content":"成功",
"anchor":"undefined",
"errorFields":[],
"data":null
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | string | 返回类型 |
| code | string | 返回码 |
| content | string | 返回消息 |
| anchor | string | 锚 |
| errorFields | string | 错误字段 |
无