| | |
| | | public IActionResult GetVueDictionary([FromBody] string[] dicNos) |
| | | { |
| | | List<VueDictionaryDTO> vueDictionaryDTOs = Service.GetVueDictionary(dicNos); |
| | | try |
| | | { |
| | | List<string> cacheDicNos = new List<string>(); |
| | | foreach (string n in dicNos) |
| | | { |
| | | string str = _cacheService.Get(n); |
| | | if (!string.IsNullOrEmpty(str)) |
| | | { |
| | | VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str); |
| | | //try |
| | | //{ |
| | | // List<string> cacheDicNos = new List<string>(); |
| | | // foreach (string n in dicNos) |
| | | // { |
| | | // string str = _cacheService.Get(n); |
| | | // if (!string.IsNullOrEmpty(str)) |
| | | // { |
| | | // VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str); |
| | | |
| | | if (vueDictionary != null) |
| | | { |
| | | vueDictionaryDTOs.Add(vueDictionary); |
| | | cacheDicNos.Add(n); |
| | | } |
| | | } |
| | | } |
| | | List<string> dicList = dicNos.ToList(); |
| | | if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0) |
| | | { |
| | | string str = AppSettings.Configuration["dics"]; |
| | | if (!string.IsNullOrEmpty(str)) |
| | | { |
| | | List<string> cusDics = new List<string>(); |
| | | // if (vueDictionary != null) |
| | | // { |
| | | // vueDictionaryDTOs.Add(vueDictionary); |
| | | // cacheDicNos.Add(n); |
| | | // } |
| | | // } |
| | | // } |
| | | // List<string> dicList = dicNos.ToList(); |
| | | // if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0) |
| | | // { |
| | | // string str = AppSettings.Configuration["dics"]; |
| | | // if (!string.IsNullOrEmpty(str)) |
| | | // { |
| | | // List<string> cusDics = new List<string>(); |
| | | |
| | | List<string> dics = str.Split(",").ToList(); |
| | | // List<string> dics = str.Split(",").ToList(); |
| | | |
| | | foreach (var item in dics) |
| | | { |
| | | dicList.Remove(item); |
| | | cusDics.Add(item); |
| | | } |
| | | // foreach (var item in dics) |
| | | // { |
| | | // dicList.Remove(item); |
| | | // cusDics.Add(item); |
| | | // } |
| | | |
| | | foreach (var item in cusDics) |
| | | { |
| | | VueDictionaryDTO vueDictionaryDTO = GetVueDictionary(item.Trim()); |
| | | if (vueDictionaryDTO != null) |
| | | { |
| | | vueDictionaryDTOs.Add(vueDictionaryDTO); |
| | | if (!_cacheService.Exists(item) && vueDictionaryDTO.SaveCache) |
| | | { |
| | | _cacheService.Add(item, vueDictionaryDTO.Serialize()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | // foreach (var item in cusDics) |
| | | // { |
| | | // VueDictionaryDTO vueDictionaryDTO = GetVueDictionary(item.Trim()); |
| | | // if (vueDictionaryDTO != null) |
| | | // { |
| | | // vueDictionaryDTOs.Add(vueDictionaryDTO); |
| | | // if (!_cacheService.Exists(item) && vueDictionaryDTO.SaveCache) |
| | | // { |
| | | // _cacheService.Add(item, vueDictionaryDTO.Serialize()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | //catch |
| | | //{ |
| | | |
| | | } |
| | | //} |
| | | return Json(vueDictionaryDTOs); |
| | | } |
| | | private VueDictionaryDTO GetVueDictionary(string key) |