汽车信息基础库

This commit is contained in:
mzl
2025-09-01 10:08:51 +08:00
parent 5c5ab30bec
commit 847303a8fa
34 changed files with 2167 additions and 230 deletions
+23
View File
@@ -304,6 +304,29 @@ if (!function_exists('generateMsgId')) {
// 随机部分(3位)
$rand = mt_rand(100, 999);
// 拼接:日期时间 + 微秒 + 随机数
return $date . $micro . $rand;
}
}
/**
* 生成sku_code
* 格式:年月日时分秒 + 微秒 + 随机数
* 例如:20250820175530987654321
*
* @return string
*/
if (!function_exists('skuCode')) {
function skuCode(): string
{
// 时间部分(精确到微秒)
$time = microtime(true);
$micro = sprintf("%06d", ($time - floor($time)) * 1e6);
$date = date('YmdHis', (int)$time);
// 随机部分(3位)
$rand = mt_rand(100, 999);
// 拼接:日期时间 + 微秒 + 随机数
return $date . $micro . $rand;
}