Common/CommonFunction.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common
{
public class CommonFunction
{
/// <summary>
/// 产生推荐码
/// </summary>
/// <param name="isAlphanumericCombination">是否为数字字母组合,默认为数字</param>
/// <returns>author:zhangbo 2015-5-15</returns>
public static string CreateRecCode(bool isAlphanumericCombination)
{
string code = string.Empty;
string[] alpCom = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "x", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
var ran = new Random();
if (isAlphanumericCombination == false)
{
code = ran.Next(100, 999).ToString();
}
else
{
var list = new ArrayList();
//随机获取字符
for (int i = 0; i < 6; i++)
{
list.Add(alpCom[ran.Next(alpCom.Length - i)]);
}
code = list.Cast<object>().Aggregate(code, (current, t) => current + t.ToString());
}
return code.ToLower();
}
/// <summary>
/// 交易号
/// </summary>
/// <returns></returns>
public static string GetTradeNumber()
{
return DateTime.Now.ToString("yyyyMMddHHmmssffff") + new Random().Next(9);
}
/// <summary>
/// 借款编号
/// </summary>
/// <returns></returns>
public static string GetPackageCode()
{
Random rd = new Random();
string str = CreateRandom(4);
return "NC" + DateTime.Now.ToString("yyyyMMdd") + str;
}
后面还有 96 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
