#region 订单号生成(支持每秒1000个并发) private static object locker = new object(); private static int sn = 0; public static string GetOrderNO() { lock (locker) { if (sn == 999) sn = 0; else sn++; return DateTime.Now.ToString("yyMMddHHmmssfff") + sn.ToString().PadLeft(3, ‘0‘); } } #endregion
原文地址:https://www.cnblogs.com/jfeng/p/11024483.html
时间: 2024-11-07 11:39:09