|
@@ -16,22 +16,49 @@ function getMacBySplitDeviceId(splitDeviceId) {
|
|
|
|
|
|
function getMacByDeviceId(deviceId) {
|
|
|
const lexin_devices = require('../lexin/devices');
|
|
|
- var splitDeviceId = deviceId.split(lexin_devices.leXin);
|
|
|
- if (splitDeviceId.length != 2) {
|
|
|
+ var deviceIdLeXin = deviceId.split(lexin_devices.leXin);
|
|
|
+ var deviceIdJunZheng1 = deviceId.split(lexin_devices.junZheng1);
|
|
|
+ var deviceIdJunZheng2 = deviceId.split(lexin_devices.junZheng2);
|
|
|
+ var deviceIdJunZheng3 = deviceId.split(lexin_devices.junZheng13);
|
|
|
+ var isLeXin = deviceIdLeXin.length == 2;
|
|
|
+ var isJunZheng1 = deviceIdJunZheng1.length == 2;
|
|
|
+ var isJunZheng2 = deviceIdJunZheng2.length == 2;
|
|
|
+ var isJunZheng3 = deviceIdJunZheng3.length == 2;
|
|
|
+ if (!isLeXin && !(isJunZheng1 && !isJunZheng3) && !(isJunZheng2 && !isJunZheng3)) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isLeXin) {
|
|
|
+ return getMacBySplitDeviceId(deviceIdLeXin[1]);
|
|
|
+ } else if ((isJunZheng1 && !isJunZheng3)) {
|
|
|
+ return getMacBySplitDeviceId(deviceIdJunZheng1[1]);
|
|
|
+ } else if ((isJunZheng2 && !isJunZheng3)) {
|
|
|
+ return getMacBySplitDeviceId(deviceIdJunZheng2[1]);
|
|
|
+ } else {
|
|
|
return "";
|
|
|
}
|
|
|
- return getMacBySplitDeviceId(splitDeviceId[1]);
|
|
|
};
|
|
|
|
|
|
///获取设备mac相关
|
|
|
function getDeviceMacId(deviceId) {
|
|
|
const lexin_devices = require('../lexin/devices');
|
|
|
- var splitDeviceId = deviceId.split(lexin_devices.leXin);
|
|
|
- if (splitDeviceId.length != 2) {
|
|
|
+ var deviceIdLeXin = deviceId.split(lexin_devices.leXin);
|
|
|
+ var deviceIdJunZheng1 = deviceId.split(lexin_devices.junZheng1);
|
|
|
+ var deviceIdJunZheng2 = deviceId.split(lexin_devices.junZheng2);
|
|
|
+ var deviceIdJunZheng3 = deviceId.split(lexin_devices.junZheng13);
|
|
|
+ var isLeXin = deviceIdLeXin.length == 2;
|
|
|
+ var isJunZheng1 = deviceIdJunZheng1.length == 2;
|
|
|
+ var isJunZheng2 = deviceIdJunZheng2.length == 2;
|
|
|
+ var isJunZheng3 = deviceIdJunZheng3.length == 2;
|
|
|
+ if (isLeXin) {
|
|
|
+ return `${lexin_devices.junZheng1}${getMacBySplitDeviceId(deviceIdLeXin[1])}`
|
|
|
+ } else if ((isJunZheng1 && !isJunZheng3)) {
|
|
|
+ return `${lexin_devices.junZheng1}${getMacBySplitDeviceId(isJunZheng1[1])}`
|
|
|
+ } else if ((isJunZheng2 && !isJunZheng3)) {
|
|
|
+ return `${lexin_devices.junZheng1}${getMacBySplitDeviceId(isJunZheng2[1])}`
|
|
|
+ } else {
|
|
|
return "";
|
|
|
}
|
|
|
- var mac = getMacBySplitDeviceId(splitDeviceId[1]);
|
|
|
- return `AIrSMArT_${mac}`
|
|
|
};
|
|
|
|
|
|
///通过设备id获取mac地址
|