|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
// 公共助手函数
|
|
|
|
|
|
+use fast\Random;
|
|
|
use Symfony\Component\VarExporter\VarExporter;
|
|
|
|
|
|
if (!function_exists('__')) {
|
|
@@ -630,3 +631,16 @@ function createUniqueNo($prifix = 'P',$id = 0)
|
|
|
|
|
|
return $rt;
|
|
|
}
|
|
|
+if (!function_exists('getUinqueId')) {
|
|
|
+ /**
|
|
|
+ * 生成不重复的随机数字
|
|
|
+ */
|
|
|
+ function getUinqueId($length = 8, $ids = [])
|
|
|
+ {
|
|
|
+ $newid = Random::build("nozero", $length);
|
|
|
+ if (in_array($newid, $ids)) {
|
|
|
+ $newid = $this->getUinqueId($length, $ids);
|
|
|
+ }
|
|
|
+ return $newid;
|
|
|
+ }
|
|
|
+}
|