主题
创建使用记录 3.7.1.Beta1+
接口说明
请求URL:http[s]://{网关地址}/minos-manager/authentication/qrCode/createUsageLog
请求方式: POST
请求内容类型: application/json
响应内容类型: application/json
请求说明
请求体
请求体为数组类型的对象:AuthenticationQrCodeLogRequest 每批次最多100条(包含)
| 字段名 | 参数名 | 必填 | 类型 | 描述 |
|---|---|---|---|---|
| 学工号 | userId | M | String | 学工号 |
| 日志id | corpLogId | O | String | 调用方日志id,可不填 |
| 使用时间 | usageTime | O | String | 格式为:yyyy-MM-dd HH:mm:ss |
| 使用描述 | usageDesc | M | String | 长度限制为20字符 |
请求示例
json
[
{
"userId": "test001",
"usageTime": "2024-01-21 17:20:46",
"usageDesc": "【桃园食堂】发生一笔12.8元的消费"
},
{
"userId": "test001",
"usageTime": "2024-01-21 13:22:46",
"usageDesc": "【桃园食堂】发生一笔12.8元的消费"
},
{
"userId": "test001",
"usageTime": "2024-01-21 09:40:46",
"usageDesc": "【桃园食堂】发生一笔12.8元的消费"
}
]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
响应说明
响应体
| 字段名 | 参数名 | 必填 | 类型 | 描述 |
|---|---|---|---|---|
| 返回码 | errcode | M | String | 返回码,0 成功,其他为错误 |
| 返回码描述 | errmsg | M | Sring | 返回码描述 |
| 返回对象 | data | O | ErrorData | 返回的用户对象 |
| 参数名 | 必填 | 类型 | 描述 |
|---|---|---|---|
| corpLogId | O | String | 学工号 |
| userId | M | String | 日志id |
| usageTime | M | String | 使用时间 |
| usageDesc | M | String | 使用描述 |
| errorMsg | M | String | 错误信息 |
响应示例
json
{
"errcode": "0",
"errmsg": "成功",
"data": null
}1
2
3
4
5
2
3
4
5
部分错误返回:
{
"errcode": "222003",
"errmsg": "所有日志创建失败,请检查数据是否合法",
"data": [
{
"corpLogId": null,
"userId": "yaoqing011102",
"usageTime": "2024-01-21 16:20:46",
"usageDesc": "",
"errorMsg": "必传参数不可为空"
},
{
"corpLogId": null,
"userId": "yaoqing011102",
"usageTime": "2024-02-01",
"usageDesc": "【桃园食堂】发生一笔12.8元的消费",
"errorMsg": "时间格式不正确,应该为yyyy-MM-dd HH:mm:ss"
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
错误码
| 错误码 | 描述 |
|---|---|
| 111001 | 必填参数不能为空 |
| 111002 | 请求参数格式错误 |
| 222003 | 所有日志创建失败,请检查数据是否合法 |
| 222004 | 部分日志创建失败,请检查数据是否合法 |
Demo
java
// 创建客户端
Client client = new DefaultClient(BASE_URL, APP_ID, APP_SECRET);
// 创建请求对象
CreateUsageLogRequest request = new CreateUsageLogRequest();
List<AuthenticationQrCodeLogInfo> data = new ArrayList<>();
AuthenticationQrCodeLogInfo info1 = new AuthenticationQrCodeLogInfo();
info1.setUserId("ampadmin");
info1.setCorpLogId("test0001");
info1.setUsageTime("2024-01-21 17:20:46");
info1.setUsageDesc("【桃园食堂】发生一笔12.8元的消费");
data.add(info1);
AuthenticationQrCodeLogInfo info2= new AuthenticationQrCodeLogInfo();
info2.setUserId("test001");
info2.setCorpLogId("test0002");
info2.setUsageTime("2024-01-21");
info2.setUsageDesc("【桃园食堂】发生一笔12.8元的消费");
data.add(info2);
request.setData(data);
BaseResponse response = client.execute(request);
//调用成功,则处理业务逻辑
if (response.isSuccess()) {
//.....
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

