| | |
| | | } |
| | | private static readonly ObjectCache Cache = MemoryCache.Default; |
| | | private const string CachePrefix = "ClickProtection_"; |
| | | private const int CacheDurationInSeconds = 2; |
| | | private const int CacheDurationInSeconds = 5; |
| | | |
| | | public static bool IsClickAllowed(string parameter) |
| | | { |
| | |
| | | |
| | | |
| | | var result = new SimpleResult(); |
| | | if (!IsClickAllowed(model.cntr_code)) |
| | | if (!IsClickAllowed("1")) |
| | | { |
| | | // 提示用户5秒内已点击过 |
| | | result.resultMsg = "您已点击过,请2秒后再试。"; |
| | | result.resultMsg = "您已点击过,请5秒后再试。"; |
| | | result.resultCode = 1; |
| | | return result; |
| | | } |
| | |
| | | { |
| | | |
| | | var result = new SimpleResult(); |
| | | if (!IsClickAllowed(model.cntr_code)) |
| | | if (!IsClickAllowed("1")) |
| | | { |
| | | // 提示用户5秒内已点击过 |
| | | result.resultMsg = "您已点击过,请2秒后再试。"; |
| | | result.resultMsg = "您已点击过,请5秒后再试。"; |
| | | result.resultCode = 1; |
| | | return result; |
| | | } |