某处是否有测试 IMEI 号码列表?

问题描述 投票:0回答:2

与信用卡处理器(例如 Stripe、Auth.net 等)集成时,通常会有一个有效和无效的测试信用卡号列表,开发人员可以在构建系统时使用这些卡号,以确保其正常运行。即将上线。

是否有类似的 IMEI 号码列表?

testing att imei
2个回答
0
投票

因为我来这里是为了测试目的寻找随机 IMEI:

function generateIMEICode() {
  const randomDigits = Array.from({
    length: 14
  }, () => Math.floor(Math.random() * 10));
  document.getElementById("imei-number").innerHTML = randomDigits.join("") + checkDigit(randomDigits);
}

const checkDigit = (digits) => {
  let sum = digits.reduce((acc, digit, index) => {
    let doubledDigit = index % 2 === 0 ? digit : digit * 2;
    return acc + (doubledDigit > 9 ? doubledDigit - 9 : doubledDigit);
  }, 0);

  return (Math.ceil(sum / 10) * 10) - sum;
}
#imei-number {
  font-family: sans-serif;
  font-size: 2em;
}
<button type="button" onclick="generateIMEICode();">Generate random test IMEI</button>
<p id="imei-number"></p>


-1
投票

如果您找不到服务提供商提供的预定测试列表,那么也许您可以通过使用随机数生成器针对某些有效的已知 IMEI 结构来构建自己的测试号码列表,或者对该结构进行逆向工程以检查任何输入号码是否正确有效的 IMEI 吗?

此链接可能有助于理解 IMEI 号码的结构 -

https://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity#Structure_of_the_IMEI_and_IMEISV_.28IMEI_Software_Version.29

祝你好运!

© www.soinside.com 2019 - 2024. All rights reserved.