public HttpResponseMessage DeleteUserAccount(UserInfoModel model) { string Result = string.Empty; try { //请求中包含的固定参数 model.SOURCE = ParametersFilter.FilterSqlHtml(model.SOURCE, 24); model.CREDENTIALS = ParametersFilter.FilterSqlHtml(model.CREDENTIALS, 24); model.ADDRESS = HttpHelper.IPAddress(); model.TERMINAL = ParametersFilter.FilterSqlHtml(model.TERMINAL, 1); model.INDEX = ParametersFilter.FilterSqlHtml(model.INDEX, 24); model.METHOD = ParametersFilter.FilterSqlHtml(model.METHOD, 24); model.DATA = FilteParameter.FilteSQLStr(model.DATA); //http请求 Result = ApiHelper.HttpRequest(username, password, Url, model); ///写日志 string RequestAction = "api/" + username + "/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); } catch (Exception ex) { LogHelper.LogError(ex.ToString()); } //返回请求结果 HttpResponseMessage Respend = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respend); }
public HttpResponseMessage MerchantAccountList(UserInfoModel model) { string Result = string.Empty; try { //string username = "******"; string username = HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString(); string password = ConfigurationManager.AppSettings[username]; string Url = ApiHelper.GetURL(username); //请求中包含的固定参数 model.SOURCE = ParametersFilter.FilterSqlHtml(model.SOURCE, 15); model.CREDENTIALS = ParametersFilter.FilterSqlHtml(model.CREDENTIALS, 10); model.ADDRESS = HttpHelper.IPAddress(); model.TERMINAL = ParametersFilter.FilterSqlHtml(model.TERMINAL, 1); model.INDEX = ParametersFilter.FilterSqlHtml(model.INDEX, 14); model.METHOD = ParametersFilter.FilterSqlHtml(model.METHOD, 15); model.DATA = FilteParameter.FilteSQLStr(model.DATA); ////去除参数中的特殊字符 model.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 50); model.UserName = ParametersFilter.FilterSqlHtml(model.UserName, 50); model.StartTime = ParametersFilter.FilterSqlHtml(model.StartTime, 50); model.EndTime = ParametersFilter.FilterSqlHtml(model.EndTime, 50); //序列化 var JSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; string Str = JsonConvert.SerializeObject(model, JSetting); //http请求 Result = ApiHelper.HttpRequest(username, password, Url, Str); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } //返回请求结果 HttpResponseMessage Respend = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respend); }
public HttpResponseMessage UpdateState(ActivityManageModel model) { string Result = string.Empty; try { //请求中包含的固定参数 model.SOURCE = ParametersFilter.FilterSqlHtml(model.SOURCE, 24); model.CREDENTIALS = ParametersFilter.FilterSqlHtml(model.CREDENTIALS, 24); model.ADDRESS = HttpHelper.IPAddress(); model.TERMINAL = ParametersFilter.FilterSqlHtml(model.TERMINAL, 1); model.INDEX = ParametersFilter.FilterSqlHtml(model.INDEX, 24); model.METHOD = ParametersFilter.FilterSqlHtml(model.METHOD, 24); model.DATA = FilteParameter.FilteSQLStr(model.DATA); //去除参数中的特殊字符 //model.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 30); //model.FilePosition = ParametersFilter.FilterSqlHtml(model.FilePosition, 50); //model.LinkPosition = ParametersFilter.FilterSqlHtml(model.LinkPosition, 50); //model.StartTime = ParametersFilter.FilterSqlHtml(model.StartTime, 50); //model.PushNum = ParametersFilter.FilterSqlHtml(model.PushNum, 10); //model.TollAmount = ParametersFilter.FilterSqlHtml(model.TollAmount, 10); //model.ApplyTime = ParametersFilter.FilterSqlHtml(model.ApplyTime, 30); //model.PushState = ParametersFilter.FilterSqlHtml(model.PushState, 1); //model.PositionNumber = ParametersFilter.FilterSqlHtml(model.PositionNumber, 2); //model.IndustryName = ParametersFilter.FilterSqlHtml(model.IndustryName, 10); //http请求 Result = ApiHelper.HttpRequest(username, password, Url, model); ///写日志 string RequestAction = "api/" + username + "/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); } catch (Exception ex) { LogHelper.LogError(ex.ToString()); } //返回请求结果 HttpResponseMessage Respend = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respend); }