字节序列反转

This commit is contained in:
lai
2025-01-10 16:37:08 +08:00
parent da42a95d46
commit 0ee8b25e39
2 changed files with 13 additions and 7 deletions

View File

@@ -54,11 +54,14 @@ echo '<div id="progressText">0%</div>';
for ($k = 0; $k < $userNum; $k++) {
$hlr_detail = $redis->hGetAll($hlruser[$k]);
$imsi = explode(":", $hlruser[$k])[1];
$camel = bin2hex($hlr_detail['camel']);
// 反转字节顺序
$reversedCamel = strrev($hlr_detail['camel']);
// 将反转后的字节序列转换为十六进制字符串
$hexValue = bin2hex($reversedCamel);
$nam = bin2hex($hlr_detail['nam']);
$usedFlag = bin2hex($hlr_detail['enable']);
$updateSql = "INSERT INTO HLR_DB.subscriberData (imsi, inter_msisdn, camel_flag, nam, used_flag) VALUES ('$imsi', '$hlr_detail[msisdn]', '$camel', '$nam', '$usedFlag')";
$updateSql = "INSERT INTO HLR_DB.subscriberData (imsi, inter_msisdn, camel_flag, nam, used_flag) VALUES ('$imsi', '$hlr_detail[msisdn]', '$hexValue', '$nam', '$usedFlag')";
mysqli_query($dbConn, $updateSql);
// 检查错误

View File

@@ -54,11 +54,14 @@ echo '<div id="progressText">0%</div>';
for ($k = 0; $k < $userNum; $k++) {
$hlr_detail = $redis->hGetAll($hlruser[$k]);
$imsi = explode(":", $hlruser[$k])[1];
$camel = bin2hex($hlr_detail['camel']);
// 反转字节顺序
$reversedCamel = strrev($hlr_detail['camel']);
// 将反转后的字节序列转换为十六进制字符串
$hexValue = bin2hex($reversedCamel);
$nam = bin2hex($hlr_detail['nam']);
$usedFlag = bin2hex($hlr_detail['enable']);
$updateSql = "INSERT INTO HLR_DB.subscriberData (imsi, inter_msisdn, camel_flag, nam, used_flag) VALUES ('$imsi', '$hlr_detail[msisdn]', '$camel', '$nam', '$usedFlag')";
$updateSql = "INSERT INTO HLR_DB.subscriberData (imsi, inter_msisdn, camel_flag, nam, used_flag) VALUES ('$imsi', '$hlr_detail[msisdn]', '$hexValue', '$nam', '$usedFlag')";
mysqli_query($dbConn, $updateSql);
// 检查错误
@@ -74,15 +77,15 @@ for ($k = 0; $k < $userNum; $k++) {
document.getElementById('progressBar').style.width = '$progress%';
document.getElementById('progressText').innerText = '$progress%';
</script>";
flush();
flush(); // 刷新输出缓冲区
}
// 更新进度条到 100%
// 最后更新进度条到 100%
echo "<script>
document.getElementById('progressBar').style.width = '100%';
document.getElementById('progressText').innerText = '100%';
</script>";
usleep(100000);
usleep(100000); // 可选:添加延迟以便观察进度条变化
echo "<script>window.location.href = './subscriberListDown.php?sysTypeNo=$sysTypeNo&dataTypeNo=$dataTypeNo&sysNo=$sysNo&sysId=$sysId';</script>";
?>