<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class IdUtil { public static function generate($QCe7q = 'Default') { goto wJvDJ; wJvDJ: static $yNqI3 = array(); goto JNTeH; JNTeH: if (empty($yNqI3[$QCe7q])) { $yNqI3[$QCe7q] = 0; } goto lEQN8; vB2dv: return $QCe7q . '_' . $yNqI3[$QCe7q]; goto RJJmp; lEQN8: $yNqI3[$QCe7q]++; goto vB2dv; RJJmp: } public static function next64BitId() { return intval(microtime(true) * 10000) . getmypid() % 10 . sprintf('%04d', rand(0, 9999)); } public static function next64BitIdSeq($EWtEu = null) { goto Htloz; SEYd7: static $S12pI = null; goto aPhSr; IEUE_: static $wnHAI = 0; goto SEYd7; PxxJO: if (null === $S12pI) { $S12pI = rand(0, 9); } goto Kf8RF; n3qTw: if ($EWtEu === null) { $EWtEu = getmypid(); } goto B_nip; PlFR1: $JF_3e = $B0q5s; goto n3qTw; Htloz: static $JF_3e = null; goto IEUE_; aPhSr: do { $B0q5s = intval(microtime(true) * 10000); if ($B0q5s !== $JF_3e) { $wnHAI = 0; } } while ($wnHAI >= 1000); goto PlFR1; B_nip: $Q6UVf = $EWtEu % 10; goto PxxJO; Kf8RF: return $B0q5s . $Q6UVf . $S12pI . sprintf('%03d', $wnHAI++); goto tW9M7; tW9M7: } public static function generateSN() { return date('YmdHis', time()) . sprintf('%05d', rand(0, 99999)); } }