diff --git a/simpleadmin/www/index.html b/simpleadmin/www/index.html index 9df1fc9..79e0333 100644 --- a/simpleadmin/www/index.html +++ b/simpleadmin/www/index.html @@ -654,6 +654,122 @@ this.atcmd = 'AT+QTEMP;+QUIMSLOT?;+QSPN;+CGCONTRDP=1;+QMAP="WWANIP";+QENG="servingcell";+QCAINFO;+QSIMSTAT?;+CSQ;+QGDNRCNT?;+QGDCNT?'; + // 定义运营商映射表 | Define operator mapping table + const operatorMap = { + // 中国大陆 (460) | Mainland China (460) + "46000": "中国移动 (CMCC)", + "46001": "中国联通 (CU)", + "46002": "中国移动 (CMCC)", + "46003": "中国电信 (CT)", + "46004": "中国移动 (CMCC)", + "46005": "中国电信 (CT)", + "46006": "中国联通 (CU)", + "46007": "中国移动 (CMCC)", + "46008": "中国移动 (CMCC)", + "46009": "中国联通 (CU)", + "46011": "中国电信 (CT)", + + // 中国香港 (454) | Hong Kong, China (454) + "45400": "香港移动通讯 (CSL)", + "45401": "香港移动通讯 (CSL)", + "45402": "香港移动通讯 (CSL)", + "45403": "和记电讯 (3 HK)", + "45404": "和记电讯 (3 HK)", + "45405": "和记电讯 (3 HK)", + "45406": "数码通 (SmarTone)", + "45412": "中国移动香港 (CMHK)", + "45413": "中国移动香港 (CMHK)", + "45415": "数码通 (SmarTone)", + "45416": "香港电讯 (PCCW)", + "45417": "数码通 (SmarTone)", + "45419": "香港电讯 (PCCW)", + "45420": "香港电讯 (PCCW)", + + // 中国澳门 (455) | Macau, China (455) + "45501": "澳门电讯 (CTM)", + "45502": "中国电信澳门 (CT Macau)", + "45503": "和记澳门 (3 Macau)", + "45505": "和记澳门 (3 Macau)", + "45506": "数码通澳门 (SmarTone Macau)", + + // 美国 (310-316) | United States (310-316) + "310030": "AT&T Mobility", + "310070": "AT&T Mobility", + "310150": "AT&T Mobility", + "310170": "AT&T Mobility", + "310280": "AT&T Mobility", + "310410": "AT&T Mobility", + "310980": "AT&T Mobility", + "311180": "AT&T Mobility", + "310120": "Sprint", + "310260": "T-Mobile USA", + "310160": "T-Mobile USA", + "311480": "Verizon Wireless", + "310004": "Verizon Wireless", + "310012": "Verizon Wireless", + + // 加拿大 (302) | Canada (302) + "302220": "Telus Mobility", + "302221": "Telus Mobility", + "302222": "Telus Mobility", + "302270": "EastLink", + "302320": "Rogers Wireless", + "302370": "Rogers Wireless", + "302720": "Rogers Wireless", + "302490": "Freedom Mobile", + "302500": "Videotron", + "302610": "Bell Mobility", + "302640": "Bell Mobility", + "302690": "Bell Mobility", + + // 西班牙 (214) | Spain (214) + "21401": "Vodafone España", + "21403": "Orange España", + "21404": "Yoigo", + "21405": "Movistar España", + "21406": "Vodafone España", + "21407": "Movistar España", + "21408": "Euskaltel", + "21409": "Orange España", + + // 日本 (440-441) | Japan (440-441) + "44000": "Y!mobile", + "44001": "NTT DOCOMO", + "44002": "NTT DOCOMO", + "44003": "NTT DOCOMO", + "44004": "SoftBank", + "44006": "SoftBank", + "44007": "KDDI (au)", + "44008": "KDDI (au)", + "44009": "NTT DOCOMO", + "44010": "NTT DOCOMO", + "44020": "SoftBank", + "44021": "NTT DOCOMO", + "44051": "KDDI (au)", + "44052": "KDDI (au)", + "44053": "KDDI (au)", + "44054": "KDDI (au)", + "44070": "KDDI (au)", + "44071": "KDDI (au)", + "44072": "KDDI (au)", + "44073": "KDDI (au)", + "44074": "KDDI (au)", + "44075": "KDDI (au)", + "44076": "KDDI (au)", + + // 澳大利亚 (505) | Australia (505) + "50501": "Telstra", + "50502": "Optus", + "50503": "Vodafone Australia", + "50506": "Three Australia", + "50507": "Vodafone Australia", + "50508": "One.Tel", + "50512": "Three Australia", + "50571": "Telstra", + "50572": "Telstra", + "50590": "Optus" + }; + fetch( "/cgi-bin/get_atcommand?" + new URLSearchParams({ @@ -717,8 +833,13 @@ } // --- Network Provider --- - // find this example value from lines "+QSPN: \"515 66\",\"515 66\",\"DITO\",0,\"51566\"" - // remove any spaces + // 获取 PLMN 码 | Get PLMN code + const plmn = lines + .find((line) => line.includes("+QSPN:")) + .split(",")[4] + .replace(/"/g, ""); + + // 获取原始运营商名称 | Get original operator name const network_provider = lines .find((line) => line.includes("+QSPN:")) .split(",")[0] @@ -726,16 +847,37 @@ .replace(/"/g, "") .replace(/ /g, ""); - // if network provider is composed of numbers and spaces, and no letters then use .split(",")[2] - if (network_provider.match(/^[0-9]+$/) != null) { + // 处理运营商名称显示 | Process operator name display + if (operatorMap[plmn]) { + // 如果在映射表中找到对应的运营商名称,直接使用 + // If found in mapping table, use the mapped operator name + this.networkProvider = operatorMap[plmn]; + } else if (network_provider.length === 24 && /^[0-9A-F]+$/i.test(network_provider)) { + // 如果是24位十六进制编码,进行解码 + // If it's a 24-bit hexadecimal encoding, decode it + this.networkProvider = hexToAscii(network_provider); + } else if (network_provider.match(/^[0-9]+$/) != null) { + // 如果是纯数字,使用 plmn_name + // If it's pure numbers, use plmn_name this.networkProvider = lines .find((line) => line.includes("+QSPN:")) .split(",")[2] .replace(/"/g, ""); } else { + // 其他情况直接使用原始名称 + // For other cases, use the original name this.networkProvider = network_provider; } + // 十六进制解码函数 | Hexadecimal decoding function + function hexToAscii(hex) { + let ascii = ''; + for (let i = 0; i < hex.length; i += 2) { + ascii += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); + } + return ascii; + } + // --- MCCMNC --- this.mccmnc = lines .find((line) => line.includes("+QSPN:")) @@ -1833,4 +1975,4 @@ } - + \ No newline at end of file