public GetAgentResponse GetAgentByOpenIdOld(GetByOpenIdRequest request, IEnumerable <KeyValuePair <string, string> > pairs) { var response = new GetAgentResponse(); var agent = _agentRepository.GetAgentByTopParentAgent(request.OpenId, request.TopParentAgent); if (agent != null) { response.agent = ToModel(agent, request.TopParentAgent); return(response); } else { response.ErrCode = -1;//无值 return(response); } }
public HttpResponseMessage GetAgentByOpenIdOld([FromUri] GetByOpenIdRequest request) { _logInfo.Info(string.Format("获取代理人接口(老)请求串:{0}", Request.RequestUri)); var viewModel = new AgentViewModel(); if (!ModelState.IsValid) { viewModel.BusinessStatus = -10000; string msg = ModelState.Values.Where(item => item.Errors.Count == 1).Aggregate(string.Empty, (current, item) => current + (item.Errors[0].ErrorMessage + "; ")); viewModel.StatusMessage = "输入参数错误," + msg; return(viewModel.ResponseToJson()); } var response = _agentService.GetAgentByOpenIdOld(request, Request.GetQueryNameValuePairs()); if (response.Status == HttpStatusCode.BadRequest || response.Status == HttpStatusCode.Forbidden) { viewModel.BusinessStatus = -10001; viewModel.StatusMessage = "参数校验错误,请检查您的校验码"; return(viewModel.ResponseToJson()); } if (response.Status == HttpStatusCode.ExpectationFailed) { viewModel.BusinessStatus = -10003; viewModel.StatusMessage = "服务发生异常"; } if (response.ErrCode == -1) { viewModel.BusinessStatus = -1; viewModel.StatusMessage = "无代理人信息"; } else { viewModel.Agent = response.agent.ConverToViewModel(); viewModel.BusinessStatus = 1; } return(viewModel.ResponseToJson()); }