public HttpResponseMessage Get([FromUri] GetBjdItemRequest request) { logInfo.Info(string.Format("获取报价单信息接口请求串:{0}", Request.RequestUri)); var item = new BaojiaItemViewModel(); if (!ModelState.IsValid) { item.BusinessStatus = -10000; string msg = ModelState.Values.Where(a => a.Errors.Count == 1).Aggregate(string.Empty, (current, a) => current + (a.Errors[0].ErrorMessage + "; ")); item.StatusMessage = "输入参数错误," + msg; return(item.ResponseToJson()); } try { var response = _bjdService.GetBjdInfo(request, Request.GetQueryNameValuePairs()); item.BusinessStatus = 1; if (request.Test == 1) {//调试用 response.Baodanxinxi = null; } if (response.Baodanxinxi != null && response.Baodanxinxi.Id > 0) { item = response.Baodanxinxi.ConvertToViewModel(response.Baodanxianzhong, response.ClaimDetail, response.Savequote, response.AgentDetail, response.Activitys); } else if (request.JieKouUrl == 0) {//JieKouUrl为防止南北方都没数据循环调用 //南北方机房互相调用 var jifangConfig = ConfigurationManager.AppSettings["JiFangUrl"]; string jifangUrl = string.Empty; if (jifangConfig != null) { jifangUrl = jifangConfig.ToString(); } if (!string.IsNullOrEmpty(jifangUrl)) { string geturl = string.Format("{0}/api/Bjd/Get?JieKouUrl=1&Bxid={1}", jifangUrl, request.Bxid); string result = HttpWebAsk.HttpGet(geturl); item = result.FromJson <BaojiaItemViewModel>(); return(item.ResponseToJson()); } } logInfo.Info(string.Format("获取报价单信息接口返回值:{0}", item.ToJson())); } catch (Exception ex) { item.BusinessStatus = -10003; item.StatusMessage = "服务器发生异常"; logError.Info("获取报价单信息单发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(item.ResponseToJson()); }
public HttpResponseMessage GetShare([FromUri] GetBjdItemRequest request) { _logAppInfo.Info(string.Format("获取分享接口请求串:{0}", Request.RequestUri)); var viewModel = new BaojiaItemViewModel(); if (!ModelState.IsValid) { viewModel.BusinessStatus = -10000; string msg = ModelState.Values.Where(a => a.Errors.Count == 1).Aggregate(string.Empty, (current, a) => current + (a.Errors[0].ErrorMessage + "; ")); viewModel.StatusMessage = "输入参数错误," + msg; return(viewModel.ResponseToJson()); } viewModel = _appAchieveService.GetShare(request, Request.GetQueryNameValuePairs(), Request.RequestUri); //_logAppInfo.Info(string.Format("获取分享接口返回值:{0}", viewModel.ToJson())); return(viewModel.ResponseToJson()); }