예제 #1
0
            public static BizVerifyModel Create(string md5Key, string vcode, TimeSpan timeout)
            {
                var model = new BizVerifyModel();

                model.CreateDate = DateTime.Now;
                model.Timeout    = timeout;
                model.VerifyCode = vcode;
                model.Md5Key     = md5Key;
                return(model);
            }
예제 #2
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);
     }
 }
예제 #3
0
            public static BizVerifyModel Create(string md5Key, TimeSpan timeout)
            {
                var vcode = Rnd.Next(100000, 999999).ToString();

                return(BizVerifyModel.Create(md5Key, vcode, timeout));
            }
 public static BizVerifyModel Create(string md5Key, string vcode, TimeSpan timeout)
 {
     var model = new BizVerifyModel();
     model.CreateDate = DateTime.Now;
     model.Timeout = timeout;
     model.VerifyCode = vcode;
     model.Md5Key = md5Key;
     return model;
 }