public async Task <GetViolationInfoResponse> GetList(GetViolationInfoRequest request) { GetViolationInfoResponse response = new GetViolationInfoResponse(); var chuxianCacheKey = CommonCacheKeyFactory.CreateKeyWithLicenseAndAgentAndCustKey(request.LicenseNo, request.Agent, request.CustKey + request.RenewalCarType); var chuxianKey = string.Format("{0}-violation-key", chuxianCacheKey); ; var cacheValue = string.Format("{0}-violationl", chuxianCacheKey); var cacheKey = CacheProvider.Get <string>(chuxianKey); if (cacheKey == null) { for (int i = 0; i < 100; i++) { cacheKey = CacheProvider.Get <string>(chuxianKey); if (!string.IsNullOrWhiteSpace(cacheKey)) { break; } else { await Task.Delay(TimeSpan.FromSeconds(1)); } } } if (cacheKey != null) { if (cacheKey == "1") { response.List = CacheProvider.Get <IEnumerable <bx_violationlog> >(cacheValue).ToList(); } else { response.List = new List <bx_violationlog>(); } } else { response.List = null; } return(response); }
public async Task <GetViolationInfoResponse> GetViolationList(GetViolationInfoRequest request, IEnumerable <KeyValuePair <string, string> > pairs) { GetViolationInfoResponse response = new GetViolationInfoResponse(); //根据经纪人获取手机号 IBxAgent agentModel = GetAgentModelFactory(request.Agent); if (!agentModel.AgentCanUse()) { response.Status = HttpStatusCode.Forbidden; return(response); } //参数校验 if (!ValidateReqest(pairs, agentModel.SecretKey, request.SecCode)) { response.Status = HttpStatusCode.Forbidden; return(response); } try { //微信端逻辑 次级代理 if (request.ChildAgent > 0) { request.Agent = request.ChildAgent; } response = await _userClaimCache.GetList(request); if (response == null) { response = new GetViolationInfoResponse(); response.Status = HttpStatusCode.ExpectationFailed; } } catch (Exception ex) { response = new GetViolationInfoResponse(); response.Status = HttpStatusCode.ExpectationFailed; } return(response); }