public IHttpActionResult Main() { var body = new RequestBody(); var mobile = body.GetPostString("mobile"); var password = body.GetPostString("password"); var code = body.GetPostString("code"); var dbCode = DbCacheManager.GetValue($"SiteServer.API.Controllers.Users.SendSms.{mobile}.Code"); var isRegister = false; string errorMessage; if (code != dbCode) { errorMessage = "短信验证码不正确"; } else { var userInfo = new UserInfo { UserName = mobile, Mobile = mobile, Password = password }; isRegister = BaiRongDataProvider.UserDao.Insert(userInfo, PageUtils.GetIpAddress(), out errorMessage); } return(Ok(new { IsRegister = isRegister, ErrorMessage = errorMessage })); }
public NameValueCollection GetTableNameCache() { NameValueCollection nameValueCollection = null; var cacheValue = DbCacheManager.GetValue(GetTableNameNameValueCollectionDbCacheKey()); if (!string.IsNullOrEmpty(cacheValue)) { nameValueCollection = TranslateUtils.ToNameValueCollection(cacheValue); } return(nameValueCollection); }
public IHttpActionResult IsCodeCorrect() { var body = new RequestBody(); var mobile = body.GetPostString("mobile"); var code = body.GetPostString("code"); var dbCode = DbCacheManager.GetValue($"SiteServer.API.Controllers.Users.SendSms.{mobile}.Code"); var isCorrect = code == dbCode; var token = string.Empty; if (isCorrect) { token = RequestBody.GetUserTokenStr(BaiRongDataProvider.UserDao.GetUserNameByMobile(mobile)); } return(Ok(new { IsCorrect = isCorrect, Token = token })); }
public static bool IsServiceOnline() { var cacheValue = CacheManager.GetCache(CacheKeyStatus) as string; if (TranslateUtils.ToBool(cacheValue)) { return(true); } var retval = true; var value = DbCacheManager.GetValue(CacheKeyStatus); if (string.IsNullOrEmpty(value)) { retval = false; } else { var ts = DateTime.Now - TranslateUtils.ToDateTime(value); if (ts.TotalMinutes > 30) { retval = false; } else { CacheManager.SetCache(CacheKeyStatus, true.ToString(), DateTime.Now.AddMinutes(10)); } } if (!retval) { CacheManager.SetCache(CacheKeyStatus, false.ToString(), DateTime.Now.AddMinutes(10)); } return(retval); }
private static NameValueCollection GetColumnsMap() { var columnsMap = TranslateUtils.ToNameValueCollection(DbCacheManager.GetValue("SiteServer.BackgroundPages.Cms.BackgroundGatherDatabaseRuleAdd.TableMatchColumnsMap")); return(columnsMap); }