|  |  |  | 
|---|
|  |  |  | WebResponseContent content = new WebResponseContent(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string requestKey = JsonConvert.SerializeObject(json); | 
|---|
|  |  |  | // 检查请求次数和时间限制 | 
|---|
|  |  |  | if (requestTracker.TryGetValue(requestKey, out var requestInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (requestInfo.Count >= 9 && DateTime.Now < requestInfo.LastRequestTime.AddMinutes(5)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // 如果请求次数超过限制且未超过10分钟,抛出异常 | 
|---|
|  |  |  | throw new InvalidOperationException("请求次数已达到限制,请稍后再试。"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //string requestKey = JsonConvert.SerializeObject(json); | 
|---|
|  |  |  | //// 检查请求次数和时间限制 | 
|---|
|  |  |  | //if (requestTracker.TryGetValue(requestKey, out var requestInfo)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    if (requestInfo.Count >= 9 && DateTime.Now < requestInfo.LastRequestTime.AddMinutes(5)) | 
|---|
|  |  |  | //    { | 
|---|
|  |  |  | //        // 如果请求次数超过限制且未超过10分钟,抛出异常 | 
|---|
|  |  |  | //        throw new InvalidOperationException("请求次数已达到限制,请稍后再试。"); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 更新请求跟踪信息 | 
|---|
|  |  |  | if (requestTracker.ContainsKey(requestKey)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | requestTracker[requestKey] = (requestInfo.Count + 1, DateTime.Now); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | requestTracker[requestKey] = (1, DateTime.Now); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //// 更新请求跟踪信息 | 
|---|
|  |  |  | //if (requestTracker.ContainsKey(requestKey)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    requestTracker[requestKey] = (requestInfo.Count + 1, DateTime.Now); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    requestTracker[requestKey] = (1, DateTime.Now); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //LogFactory.GetLog("常温3出库至包装").Info(true, $"常温3出库至包装传入参数:" + JsonConvert.SerializeObject(json, Formatting.Indented)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position && x.stationType == 12 && x.stationArea == "Call"); | 
|---|