@cpzxrobot/sdk 1.3.81 → 1.3.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/device_gateway.ts +0 -23
- package/dist/device_gateway.js +0 -22
- package/package.json +1 -1
package/device_gateway.ts
CHANGED
|
@@ -1112,15 +1112,6 @@ export class DeviceGateway extends Object {
|
|
|
1112
1112
|
if (topN !== undefined && topN <= 0) {
|
|
1113
1113
|
throw new Error('topN参数必须大于0');
|
|
1114
1114
|
}
|
|
1115
|
-
if (fromDate && !this.isValidDateTime(fromDate)) {
|
|
1116
|
-
throw new Error('fromDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
|
|
1117
|
-
}
|
|
1118
|
-
if (toDate && !this.isValidDateTime(toDate)) {
|
|
1119
|
-
throw new Error('toDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
|
|
1120
|
-
}
|
|
1121
|
-
if (fromDate && toDate && fromDate > toDate) {
|
|
1122
|
-
throw new Error('fromDate不能晚于toDate');
|
|
1123
|
-
}
|
|
1124
1115
|
|
|
1125
1116
|
// 构建请求参数
|
|
1126
1117
|
const params: any = { factoryId: _factoryId };
|
|
@@ -1144,19 +1135,5 @@ export class DeviceGateway extends Object {
|
|
|
1144
1135
|
});
|
|
1145
1136
|
}
|
|
1146
1137
|
|
|
1147
|
-
/**
|
|
1148
|
-
* 验证日期时间格式(YYYY-MM-DD HH:mm:ss)
|
|
1149
|
-
* @param dateTime 日期时间字符串
|
|
1150
|
-
* @returns 是否有效
|
|
1151
|
-
*/
|
|
1152
|
-
private isValidDateTime(dateTime: string): boolean {
|
|
1153
|
-
const regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
|
|
1154
|
-
if (!regex.test(dateTime)) {
|
|
1155
|
-
return false;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
const date = new Date(dateTime);
|
|
1159
|
-
return !isNaN(date.getTime());
|
|
1160
|
-
}
|
|
1161
1138
|
|
|
1162
1139
|
}
|
package/dist/device_gateway.js
CHANGED
|
@@ -892,15 +892,6 @@ class DeviceGateway extends Object {
|
|
|
892
892
|
if (topN !== undefined && topN <= 0) {
|
|
893
893
|
throw new Error('topN参数必须大于0');
|
|
894
894
|
}
|
|
895
|
-
if (fromDate && !this.isValidDateTime(fromDate)) {
|
|
896
|
-
throw new Error('fromDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
|
|
897
|
-
}
|
|
898
|
-
if (toDate && !this.isValidDateTime(toDate)) {
|
|
899
|
-
throw new Error('toDate参数格式错误,应为YYYY-MM-DD HH:mm:ss格式');
|
|
900
|
-
}
|
|
901
|
-
if (fromDate && toDate && fromDate > toDate) {
|
|
902
|
-
throw new Error('fromDate不能晚于toDate');
|
|
903
|
-
}
|
|
904
895
|
// 构建请求参数
|
|
905
896
|
const params = { factoryId: _factoryId };
|
|
906
897
|
if (topN !== undefined) {
|
|
@@ -922,18 +913,5 @@ class DeviceGateway extends Object {
|
|
|
922
913
|
});
|
|
923
914
|
});
|
|
924
915
|
}
|
|
925
|
-
/**
|
|
926
|
-
* 验证日期时间格式(YYYY-MM-DD HH:mm:ss)
|
|
927
|
-
* @param dateTime 日期时间字符串
|
|
928
|
-
* @returns 是否有效
|
|
929
|
-
*/
|
|
930
|
-
isValidDateTime(dateTime) {
|
|
931
|
-
const regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
|
|
932
|
-
if (!regex.test(dateTime)) {
|
|
933
|
-
return false;
|
|
934
|
-
}
|
|
935
|
-
const date = new Date(dateTime);
|
|
936
|
-
return !isNaN(date.getTime());
|
|
937
|
-
}
|
|
938
916
|
}
|
|
939
917
|
exports.DeviceGateway = DeviceGateway;
|