Пример #1
0
 public string NewVCode(string id, string bizId, TimeSpan timeout)
 {
     lock (syncObj)
     {
         var vcode  = this.NextVerifyCode(this.Rnd);
         var md5Key = GetMd5Key(id, bizId);
         if (vcodeDictionary.ContainsKey(md5Key))
         {
             //对象复用
             vcodeDictionary[md5Key].Reuse(vcode, timeout);
         }
         else
         {
             var vm = BizVerifyModel.Create(md5Key, vcode, timeout);
             vcodeDictionary.Add(vm.Md5Key, vm);
         }
         return(vcode);
     }
 }
Пример #2
0
            public static BizVerifyModel Create(string md5Key, TimeSpan timeout)
            {
                var vcode = Rnd.Next(100000, 999999).ToString();

                return(BizVerifyModel.Create(md5Key, vcode, timeout));
            }