更新 simpleadmin/www/index.html
This commit is contained in:
parent
7fdd2f65b7
commit
8f7fc19477
@ -654,7 +654,7 @@
|
|||||||
this.atcmd =
|
this.atcmd =
|
||||||
'AT+QTEMP;+QUIMSLOT?;+QSPN;+CGCONTRDP=1;+QMAP="WWANIP";+QENG="servingcell";+QCAINFO;+QSIMSTAT?;+CSQ;+QGDNRCNT?;+QGDCNT?';
|
'AT+QTEMP;+QUIMSLOT?;+QSPN;+CGCONTRDP=1;+QMAP="WWANIP";+QENG="servingcell";+QCAINFO;+QSIMSTAT?;+CSQ;+QGDNRCNT?;+QGDCNT?';
|
||||||
|
|
||||||
// 定义运营商映射表 | Define operator mapping table
|
// ---------- 运营商名称处理 | Operator Information Processing ----------
|
||||||
const operatorMap = {
|
const operatorMap = {
|
||||||
// 中国大陆 (460) | Mainland China (460)
|
// 中国大陆 (460) | Mainland China (460)
|
||||||
"46000": "中国移动 (CMCC)",
|
"46000": "中国移动 (CMCC)",
|
||||||
@ -832,45 +832,30 @@
|
|||||||
this.activeSim = "无SIM卡";
|
this.activeSim = "无SIM卡";
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Network Provider ---
|
// ---------- 运营商信息处理 | Operator Information Processing ----------
|
||||||
// 获取 PLMN 码 | Get PLMN code
|
const parts = lines
|
||||||
const plmn = lines
|
|
||||||
.find((line) => line.includes("+QSPN:"))
|
.find((line) => line.includes("+QSPN:"))
|
||||||
.split(",")[4]
|
.split(",");
|
||||||
.replace(/"/g, "")
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
console.log("PLMN:", plmn);
|
// 获取 PLMN 码和运营商名称 | Get PLMN code and operator name
|
||||||
console.log("Mapped operator:", operatorMap[plmn]);
|
const plmn = parts[4]?.replace(/"/g, "").trim();
|
||||||
|
const network_provider = parts[0]?.replace("+QSPN: ", "").replace(/"/g, "").trim();
|
||||||
const network_provider = lines
|
|
||||||
.find((line) => line.includes("+QSPN:"))
|
|
||||||
.split(",")[0]
|
|
||||||
.replace("+QSPN: ", "")
|
|
||||||
.replace(/"/g, "")
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
|
// 按优先级处理运营商名称 | Process operator name by priority
|
||||||
if (operatorMap[plmn]) {
|
if (operatorMap[plmn]) {
|
||||||
|
// 1. 优先使用预定义的运营商映射 | First priority: use predefined operator mapping
|
||||||
this.networkProvider = operatorMap[plmn];
|
this.networkProvider = operatorMap[plmn];
|
||||||
} else if (network_provider.match(/^[0-9A-Fa-f]+$/) != null) {
|
} else if (network_provider.match(/^[0-9A-Fa-f]+$/) != null) {
|
||||||
// 处理16进制编码的运营商名称
|
// 2. 处理16进制编码的运营商名称 | Second priority: decode hex-encoded operator name
|
||||||
// Process operator names encoded in hexadecimal
|
|
||||||
try {
|
try {
|
||||||
const hexString = network_provider.replace(/^0x/, '');
|
const hexString = network_provider.replace(/^0x/, '');
|
||||||
const bytes = new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
|
const bytes = new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
|
||||||
const decoder = new TextDecoder('utf-8');
|
this.networkProvider = new TextDecoder('utf-8').decode(bytes);
|
||||||
this.networkProvider = decoder.decode(bytes);
|
} catch {
|
||||||
} catch (e) {
|
|
||||||
console.log("Error decoding hex operator name:", e);
|
|
||||||
this.networkProvider = network_provider;
|
this.networkProvider = network_provider;
|
||||||
}
|
}
|
||||||
} else if (network_provider.match(/^[0-9]+$/) != null) {
|
|
||||||
this.networkProvider = lines
|
|
||||||
.find((line) => line.includes("+QSPN:"))
|
|
||||||
.split(",")[2]
|
|
||||||
.replace(/"/g, "")
|
|
||||||
.trim();
|
|
||||||
} else {
|
} else {
|
||||||
|
// 3. 使用运营商提供的原始名称 | Third priority: use original operator name
|
||||||
this.networkProvider = network_provider;
|
this.networkProvider = network_provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user