C#生成订单号


        /// <summary>
        /// 生成订单号
        /// </summary>
        /// <param name="topId">类目ID,商品编号</param>
        /// <param name="tableNum">表名尾数</param>
        /// <param name="userid">用户ID</param>
        /// <returns></returns>2+13+3
        public string GetSysOrderID(string topId, string tableNum, string userid)
        {
            int hash = System.Guid.NewGuid().GetHashCode();
            if (hash < 0)
            {
                hash = -hash;
            }
            string temp = hash.ToString() + "00000000";
            temp = temp.Substring(0, 8);
            string orderid = topId + temp + DateTime.Now.ToString("MMddHHmmss");
            return orderid;
        }

发布了41 篇原创文章 · 获赞 13 · 访问量 9494

猜你喜欢

转载自blog.csdn.net/qq_36664772/article/details/100097439
今日推荐