public HttpResponseMessage EnumEndActivityList(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 = ParametersFilter.FilterSqlHtml(model.DATA, 50); //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 SelectAddressInfo(AddressModel 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.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 24); 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 Respond = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respond); }
public HttpResponseMessage ScanVerification(CabinetModel 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.QRCODE = ParametersFilter.StripSQLInjection(model.QRCODE); //返回结果 Result = ApiHelper.HttpRequest(username, password, Url, model); } 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 GetAuthCode(RedisModel.BaseModel 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.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); //请求验证码 Result = ApiHelper.HttpRequest(ApiHelper.GetAuthCodeURL("smsCodeIp", "sms", "GetAuthCode"), 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 Responsed = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Responsed); }
public HttpResponseMessage LanboerBusinessPosition(TerminalModel 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 = ParametersFilter.StripSQLInjection(model.DATA); //返回结果 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 CommodityAdd(ProductCodeInfoModel 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 = ParametersFilter.StripSQLInjection(model.DATA); model.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 64); #region base64上传 //string ImgString = model.FilePath.Split(new char[] { ',' })[1]; ////图片Model //ImgModel imgModel = new ImgModel(); //imgModel.ImgIp = ApiHelper.ImgURL(); //imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); //imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); //imgModel.ImgAttribute = "commodity"; //imgModel.UserAccount = model.UserAccount; //imgModel.ImgName = ReDateTime.GetTimeStamp(); //imgModel.ImgString = ImgString; //model.FilePath = ApiHelper.HttpRequest(ApiHelper.GetImgUploadURL("imgUploadIp", "imgUpload"), imgModel); //model.FilePath = model.FilePath.Replace("\"", ""); #endregion ///商品轮播图地址 model.FilePath = ApiHelper.ImgURL() + model.UserAccount + "/Commodity/"; ///商品详情图地址 model.CommodityProfile = ApiHelper.ImgURL() + model.UserAccount + "/Commodity/"; //返回结果 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 MobileLogin(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.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); model.LoginIP = HttpHelper.IPAddress(); model.Verification = ParametersFilter.FilterSqlHtml(model.Verification, 6); //获取Redis中的验证码 string GetRedisAuthCode = ApiHelper.HttpRequest(ApiHelper.GetAuthCodeURL("smsCodeIp", "sms", "VerifyAuthCode"), model); JObject jsons = (JObject)JsonConvert.DeserializeObject(GetRedisAuthCode); if (jsons["result"].ToString() == "1") { Result = ApiHelper.HttpRequest(username, password, Url, model); JObject jsonData = (JObject)JsonConvert.DeserializeObject(Result); if (jsonData["DATA"][0].ToString() == "1") { model.UserAccount = jsonData["UserAccount"].ToString(); //返回凭证 jsonData["CREDENTIALS"] = AuthHelper.AuthUserSet(model); Result = JsonConvert.SerializeObject(jsonData); } } else { Result = "{\"DATA\":" + GetRedisAuthCode + "}"; } ///写日志 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 VerifyAuthCode(RedisModel.BaseModel 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.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); model.Verification = ParametersFilter.FilterSqlHtml(model.Verification, 6); //获取Redis中的验证码 string GetRedisAuthCode = ApiHelper.HttpRequest(ApiHelper.GetAuthCodeURL("smsCodeIp", "sms", "VerifyAuthCode"), model); JObject jsons = (JObject)JsonConvert.DeserializeObject(GetRedisAuthCode); if (jsons["result"].ToString() == "2") { Result = "{\"DATA\":[{\"result\":\"验证码已过时\"}]}"; } else if (jsons["result"].ToString() == "1") { Result = "{\"DATA\":[{\"result\":\"true\"}]}"; } else { Result = "{\"DATA\":[{\"result\":\"验证码错误\"}]}"; } ///写日志 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 Settlement(ShoppingCartModel 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.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 24); model.CommodityNumber = ParametersFilter.StripSQLInjection(model.CommodityNumber); model.AddresseeName = ParametersFilter.StripSQLInjection(model.AddresseeName); model.Telephone = ParametersFilter.StripSQLInjection(model.Telephone); model.Province = ParametersFilter.StripSQLInjection(model.Province); model.RegionCity = ParametersFilter.StripSQLInjection(model.RegionCity); model.CountyDistrict = ParametersFilter.StripSQLInjection(model.CountyDistrict); model.DetailedAddress = ParametersFilter.StripSQLInjection(model.DetailedAddress); //if (model.TERMINAL=="2") //{ // model.CommodityName = System.Web.HttpUtility.UrlEncode(model.CommodityName); // model.AddresseeName = System.Web.HttpUtility.UrlEncode(model.AddresseeName); // model.TelephoneProvince = System.Web.HttpUtility.UrlEncode(model.TelephoneProvince); // model.RegionCity = System.Web.HttpUtility.UrlEncode(model.RegionCity); // model.CountyDistrict = ParametersFilter.StripSQLInjection(model.CountyDistrict); // model.DetailedAddress = ParametersFilter.StripSQLInjection(model.DetailedAddress); //} 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 Respond = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respond); }
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); }
public HttpResponseMessage ModifyPayPasswd(ProductInfoModel model) { string Result = string.Empty; //bool ReturnCode = AuthHelper.AuthUserStatus(model); try { //if (ReturnCode) //{ //请求中包含的固定参数 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); if (model.TERMINAL == "2") { model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); } //返回结果 Result = ApiHelper.HttpRequest(username, password, Url, model); ///写日志 string RequestAction = "api/" + username + "/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); } // else // { // Result = "{\"RETURNCODE\":\"403\"}"; // } //} catch (Exception ex) { LogHelper.LogError(ex.ToString()); Result = ex.ToString(); } HttpResponseMessage Respend = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respend); }
public HttpResponseMessage PayUserLogin(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.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 50); model.UserPasswd = ParametersFilter.FilterSqlHtml(model.UserPasswd, 128); //http请求 Result = ApiHelper.HttpRequest(username, password, Url, model); ///写日志 string RequestAction = "api/" + username + "/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); JObject jsons = (JObject)JsonConvert.DeserializeObject(Result); if (jsons["DATA"][0]["login_msg"].ToString() == "Login successful") { model.UserMobile = jsons["DATA"][0]["UserMobile"].ToString(); //返回凭证 jsons["CREDENTIALS"] = AuthHelper.AuthUserSet(model); Result = JsonConvert.SerializeObject(jsons); } } 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 CounterRollBack(ShoppingCartModel 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.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 24); model.UserName = ParametersFilter.FilterSqlHtml(model.UserName, 24); model.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); model.BUserAccount = ParametersFilter.FilterSqlHtml(model.BUserAccount, 32); model.ShelvesAccount = ParametersFilter.FilterSqlHtml(model.ShelvesAccount, 32); model.ShelvesType = ParametersFilter.FilterSqlHtml(model.ShelvesType, 1); model.CommodityCode = ParametersFilter.StripSQLInjection(model.CommodityCode); model.DATA = ParametersFilter.StripSQLInjection(model.DATA); if (model.TERMINAL == "2") { model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); } //返回结果 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 UpdateServiceProduct(PlatformServiceModel 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.ServiceProduct = ParametersFilter.FilterSqlHtml(model.ServiceProduct, 50); //model.EnServiceProduct = ParametersFilter.FilterSqlHtml(model.EnServiceProduct, 50); //model.ChargePrice = ParametersFilter.FilterSqlHtml(model.ChargePrice, 10); //model.ChargeUnit = ParametersFilter.FilterSqlHtml(model.ChargeUnit, 10); //model.ContainOption = ParametersFilter.FilterSqlHtml(model.ContainOption, 10); //model.ServiceIntroduce = ParametersFilter.FilterSqlHtml(model.ServiceIntroduce, 500); //model.EditTime = System.DateTime.Now.ToString(); model.DATA = ParametersFilter.StripSQLInjection(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 AccountProving(RedisModel.BaseModel 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.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); Result = ApiHelper.HttpRequest(username, password, Url, model); JObject json = (JObject)JsonConvert.DeserializeObject(Result); ///写日志 string RequestAction = "api/" + username + "/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); if (json["DATA"][0]["result"].ToString() == "false") { string AuthCode = ApiHelper.HttpRequest(username, password, ApiHelper.GetAuthCodeURL("smsCodeIp", "sms", "GetAuthCode"), model); } } catch (Exception ex) { LogHelper.LogError(ex.ToString()); } HttpResponseMessage Respond = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respond); }
public HttpResponseMessage querySendDetails(BaseModel 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.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); Result = SMSCode.SMSCode.querySendDetails(model.UserMobile); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } #region 缓存验证码 //if (RuntimeCache.Cache.Get(model.UserMobile) != null) //{ // RuntimeCache.Cache.Update(model.UserMobile, v => model.Verification); //} //else //{ // //缓存验证码 // RuntimeCache.Cache.Add(model.UserMobile, model.Verification); //} #endregion HttpResponseMessage Responsed = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Responsed); }
public HttpResponseMessage ActivationCode(FaultToleranceModel 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.PageNum = ParametersFilter.FilterSqlHtml(model.PageNum, 10); model.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 64); model.CommodityName = ParametersFilter.FilterSqlHtml(model.CommodityName, 128); //返回结果 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 ChangeUserAvatar(UserInfoModel model) { string Result = string.Empty; //bool ReturnCode = AuthHelper.AuthUserStatus(model); try { //if (ReturnCode) //{ //请求中包含的固定参数 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.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 30); if (model.TERMINAL == "2") { model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); } //图片Model ImgModel imgModel = new ImgModel(); imgModel.ImgIp = ApiHelper.ImgURL(); imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); imgModel.ImgAttribute = "user"; imgModel.UserAccount = model.UserAccount; imgModel.ImgName = "useravatar"; imgModel.ImgString = model.UserAvatar; //保存用户头像 model.UserAvatar = ApiHelper.HttpRequest(ApiHelper.GetImgUploadURL("imgUploadIp", "imgUpload"), imgModel); model.UserAvatar = model.UserAvatar.Replace("\"", ""); //返回结果 if (model.UserAvatar.Length > 16) { Result = "{ \"Result\":\"Success\"}"; } else { Result = "{\"Result\":\"Fail\"}"; } //} //else //{ // Result = "{\"RETURNCODE\":\"403\"}"; //} ///写日志 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 CommodityUpdate(ProductCodeInfoModel 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.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 64); //去除用户参数中包含的特殊字符 model.DATA = ParametersFilter.StripSQLInjection(model.DATA); #region MyRegion //model.DATA = System.Web.HttpUtility.UrlDecode(model.DATA); //string ImgString = string.Empty; //if (model.FilePath.Substring(model.FilePath.Length - 3, 3) != "jpg") //{ // ImgString = model.FilePath.Split(new char[] { ',' })[1]; //} //else //{ // ImgString = model.FilePath; //} //string datatojson = ApiHelper.DATAToJson(model.DATA); //string CommodityCode = JObject.Parse(datatojson)["CommodityCode"].ToString(); ////图片Model //ImgModel imgModel = new ImgModel(); //imgModel.ImgIp = ApiHelper.ImgURL(); //imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); //imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); //imgModel.ImgAttribute = "commodity"; //imgModel.UserAccount = model.UserAccount; //imgModel.ImgName = CommodityCode; //imgModel.ImgString = ImgString; //model.FilePath = ApiHelper.HttpRequest(ApiHelper.GetImgUploadURL("imgUploadIp", "imgUpload"), imgModel); //model.FilePath = model.FilePath.Replace("\"", ""); ////URL编码 //model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); #endregion //返回结果 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 VerifyAuthCode(BaseModel model) { string Result = string.Empty; //实例化发送短信类 SMSCode.SMSCode AuthCode = new SMSCode.SMSCode(); 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.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); model.Verification = ParametersFilter.FilterSqlHtml(model.Verification, 6); BaseModel redis = new BaseModel(); redis.RedisIP = SingleXmlInfo.GetInstance().GetWebApiConfig("redisAddress"); redis.RedisPort = SingleXmlInfo.GetInstance().GetWebApiConfig("redisPort"); redis.RedisPassword = SingleXmlInfo.GetInstance().GetWebApiConfig("redisPassword"); redis.RedisKey = "User_Account_Auth_" + model.UserMobile; redis.LifeCycle = "120"; redis.RedisFunction = "StringGet"; string CacheCode = (ApiHelper.HttpRequest(ApiHelper.GetRedisURL("redisIp", "redis", redis.RedisFunction), redis)); if (CacheCode == model.Verification) { Result = "{\"result\":\"1\"}"; } else if (CacheCode == "null") { Result = "{\"result\":\"2\"}"; } else { Result = "{\"result\":\"0\"}"; } ///写日志 string RequestAction = "api/SMSCodeAPI/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } #region 缓存验证码 //if (RuntimeCache.Cache.Get(model.UserMobile) != null) //{ // RuntimeCache.Cache.Update(model.UserMobile, v => model.Verification); //} //else //{ // //缓存验证码 // RuntimeCache.Cache.Add(model.UserMobile, model.Verification); //} #endregion HttpResponseMessage Responsed = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Responsed); }
public HttpResponseMessage GetAuthCode(BaseModel 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.UserMobile = ParametersFilter.FilterSqlHtml(model.UserMobile, 11); //生成六位随机验证码 model.Verification = SMSCode.SMSCode.GetAuthCode(100000, 999999); BaseModel redis = new BaseModel(); redis.RedisIP = SingleXmlInfo.GetInstance().GetWebApiConfig("redisAddress"); redis.RedisPort = SingleXmlInfo.GetInstance().GetWebApiConfig("redisPort"); redis.RedisPassword = SingleXmlInfo.GetInstance().GetWebApiConfig("redisPassword"); redis.RedisKey = "User_Account_Auth_" + model.UserMobile; redis.RedisValue = model.Verification; redis.LifeCycle = "120"; redis.RedisFunction = "StringSet"; //发送短信 string Code = SMSCode.SMSCode.SendMessage(model.UserMobile, model.Verification); LogHelper.LogResopnse("Code:" + Code); if (Code == "OK") { if ((ApiHelper.HttpRequest(ApiHelper.GetRedisURL("redisIp", "redis", redis.RedisFunction), redis)) == "True") { ////发送短信 //SMSCode.SMSCode.SendMessage(model.UserMobile, model.Verification); model.Code = "1"; } } else { model.Verification = null; model.Code = "0"; } Result = JsonConvert.SerializeObject(model, JSetting); ///写日志 string RequestAction = "api/SMSCodeAPI/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } #region 缓存验证码 //if (RuntimeCache.Cache.Get(model.UserMobile) != null) //{ // RuntimeCache.Cache.Update(model.UserMobile, v => model.Verification); //} //else //{ // //缓存验证码 // RuntimeCache.Cache.Add(model.UserMobile, model.Verification); //} #endregion HttpResponseMessage Responsed = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Responsed); }
public HttpResponseMessage UpdateCommodityFilePath(ProductCodeInfoModel 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.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 64); model.Status = ParametersFilter.FilterSqlHtml(model.Status, 1); model.CommodityNumber = ParametersFilter.StripSQLInjection(model.CommodityNumber); model.ImgStatus = ParametersFilter.FilterSqlHtml(model.ImgStatus, 1); ///原图片地址 string ImgPath = model.FilePath; if (model.Status == "0") { model.FilePath = model.FilePath.Substring(model.FilePath.LastIndexOf("."), model.FilePath.Length - model.FilePath.LastIndexOf(".")); } //返回结果 Result = ApiHelper.HttpRequest(username, password, Url, model); //解析返回结果 JObject jsons = (JObject)JsonConvert.DeserializeObject(Result); ///添加商品 if (model.Status == "0") { ImgModel imgModel = new ImgModel(); imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); imgModel.UserAccount = model.UserAccount; imgModel.ImgAttribute = "commodity"; imgModel.SourceFileName = ImgPath; imgModel.ImgName = jsons["FilePath"].ToString(); string Return = ApiHelper.HttpRequest(ApiHelper.MoveCommodityImg("imgUploadIp", "imgUpload"), imgModel); if (Return != "1") { jsons["DATA"][0] = 0; } else { jsons["DATA"][0] = 1; } Result = JsonConvert.SerializeObject(jsons); } else if (model.Status == "1") { if (jsons["DATA"][0].ToString() == "1") { ImgModel imgModel = new ImgModel(); imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); imgModel.UserAccount = model.UserAccount; imgModel.ImgAttribute = "commodity"; imgModel.SourceFileName = ImgPath; string DeleteImg = ApiHelper.HttpRequest(ApiHelper.DeleteCommodityImg("imgUploadIp", "imgUpload"), imgModel); if (DeleteImg != "1") { jsons["DATA"][0] = 0; } Result = JsonConvert.SerializeObject(jsons); } } ///写日志 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 AdvertisingUpdate(AdvertiseMentModel 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 = ParametersFilter.StripSQLInjection(model.DATA); model.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 64); string ImgString = string.Empty; #region Base64 //if (model.FilePosition.Substring(model.FilePath.Length - 3, 3) != "jpg") //{ // ImgString = model.FilePosition.Split(new char[] { ',' })[1]; //} //else //{ // ImgString = model.FilePosition; //} //图片Model //ImgModel imgModel = new ImgModel(); //imgModel.ImgIp = ApiHelper.ImgURL(); //imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); //imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); //imgModel.ImgAttribute = "advertisement"; //imgModel.UserAccount = model.UserAccount; //imgModel.ImgName = ReDateTime.GetTimeStamp(); //imgModel.ImgString = ImgString; //model.FilePosition = ApiHelper.HttpRequest(ApiHelper.GetImgUploadURL("imgUploadIp", "imgUpload"), imgModel); //model.FilePosition = model.FilePosition.Replace("\"", ""); #endregion #region fileStream ImgModel imgModel = new ImgModel(); imgModel.ImgIp = ApiHelper.ImgURL(); imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); imgModel.ImgAttribute = "advertisement"; imgModel.UserAccount = model.UserAccount; ///临时文件夹地址 imgModel.SourceFileName = model.FilePosition; ///保存图片名字 imgModel.ImgName = ReDateTime.GetTimeStamp(); model.FilePosition = ApiHelper.HttpRequest(ApiHelper.MoveImg("imgUploadIp", "imgUpload"), imgModel); #endregion //返回结果 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 UserRegister(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 = ParametersFilter.StripSQLInjection(model.DATA); model.UserAccount = ParametersFilter.FilterSqlHtml(model.UserAccount, 64); model.DATA = System.Web.HttpUtility.UrlDecode(model.DATA); string datatojson = ApiHelper.DATAToJson(model.DATA); model.Verification = JObject.Parse(datatojson)["Verification"].ToString(); model.UserMobile = JObject.Parse(datatojson)["UserMobile"].ToString(); model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); //获取Redis中的验证码 string GetRedisAuthCode = ApiHelper.HttpRequest(ApiHelper.GetAuthCodeURL("smsCodeIp", "sms", "VerifyAuthCode"), model); JObject json = (JObject)JsonConvert.DeserializeObject(GetRedisAuthCode); //if (json["result"].ToString() == "1") //{ #region Base64 //string ImgString = model.UserAvatar.Split(new char[] { ',' })[1]; ////图片Model //ImgModel imgModel = new ImgModel(); //imgModel.ImgIp = ApiHelper.ImgURL(); //imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); //imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); //imgModel.ImgAttribute = "user"; //imgModel.UserAccount = model.UserAccount; //imgModel.ImgName = "useravatar"; //imgModel.ImgString = ImgString; //model.UserAvatar = ApiHelper.HttpRequest(ApiHelper.GetImgUploadURL("imgUploadIp", "imgUpload"), imgModel); //model.UserAvatar = model.UserAvatar.Replace("\"", ""); #endregion ImgModel imgModel = new ImgModel(); imgModel.ImgIp = ApiHelper.ImgURL(); imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); imgModel.ImgAttribute = "user"; imgModel.UserAccount = model.UserAccount; ///临时文件夹地址 imgModel.SourceFileName = model.UserAvatar; ///保存图片名字 imgModel.ImgName = "useravatar"; model.UserAvatar = ApiHelper.HttpRequest(ApiHelper.MoveImg("imgUploadIp", "imgUpload"), imgModel); //返回结果 Result = ApiHelper.HttpRequest(username, password, Url, model); //} //else if(json["result"].ToString()=="0") //{ // ///验证码错误 // Result = "{\"DATA\":[5]}"; //} //else //{ // ///验证码超时 // Result = "{\"DATA\":[6]}"; //} ///写日志 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 UserInfo(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 = System.Web.HttpUtility.UrlDecode(model.DATA); #region MyRegion //DATA装换为json字符串 string datatojson = ApiHelper.DATAToJson(model.DATA); string UserAccount = JObject.Parse(datatojson)["UserAccount"].ToString(); //图片Model ImgModel imgModel = new ImgModel(); imgModel.ImgIp = ApiHelper.ImgURL(); imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); imgModel.ImgAttribute = "user"; imgModel.UserAccount = UserAccount; imgModel.ImgName = "userAvatar"; imgModel.ImgString = model.UserAvatar; //URL编码 model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); //保存的图片名称 model.UserAvatar = imgModel.ImgIp + imgModel.UserAccount + "/" + imgModel.ImgAttribute + "/" + imgModel.ImgName + ".jpg"; //返回结果 Result = ApiHelper.HttpRequest(username, password, Url, model); ////解析返回结果 JObject jsons = (JObject)JsonConvert.DeserializeObject(Result); if (jsons["DATA"][0]["Result"].ToString() == "1") { ApiHelper.HttpRequest(ApiHelper.GetImgUploadURL("imgUploadIp", "imgUpload"), imgModel); model.UserMobile = jsons["DATA"][0]["UserMobile"].ToString(); model.UserAccount = jsons["DATA"][0]["UserAccount"].ToString(); //返回凭证 jsons["CREDENTIALS"] = AuthHelper.AuthUserSet(model); Result = JsonConvert.SerializeObject(jsons); } #endregion #region Redis_DATA //UserCheckBLL B = new UserCheckBLL(); //Dictionary<string, string> redisData = B.UserInfo_Redis(model.DATA); //string imgStr = model.UserAvatar; //model.UserAvatar = redisData["UserAvatar"]; //string Str = JsonConvert.SerializeObject(model, JSetting); ////返回结果 //Result = ApiHelper.HttpRequest(username, password, Url, Str); //////解析返回结果 //JObject jsons = (JObject)JsonConvert.DeserializeObject(Result); //if (jsons["DATA"][0]["Result"].ToString() == "1") //{ // // CharConversion.SaveImg(imgStr, model.UserAvatar, "~/Avatar/"); // //实例化Redis请求参数 // RedisModel.BaseModel redis = new RedisModel.BaseModel(); // redis.RedisIP = SingleXmlInfo.GetInstance().GetWebApiConfig("redisAddress"); // redis.RedisPort = SingleXmlInfo.GetInstance().GetWebApiConfig("redisPort"); // redis.RedisPassword = SingleXmlInfo.GetInstance().GetWebApiConfig("redisPassword"); // redis.RedisKey = "PAY_USER_Info_ " + redisData["UserAccount"]; // redis.RedisValue = ApiHelper.DictionaryToStr(redisData); // redis.LifeCycle = "50000"; // redis.RedisFunction = "StringSet"; // //获取Redis中的验证码 // string b = ApiHelper.HttpRequest(ApiHelper.GetRedisURL(redis.RedisFunction), redis); //} #endregion ///写日志 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 ChangePhoneNumber(RedisModel.BaseModel model) { string Result = string.Empty; //bool ReturnCode = AuthHelper.AuthUserStatus(model); try { //if (ReturnCode) //{ //请求中包含的固定参数 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 = System.Web.HttpUtility.UrlDecode(model.DATA); string datatojson = ApiHelper.DATAToJson(model.DATA); model.Verification = JObject.Parse(datatojson)["Verification"].ToString(); model.UserMobile = JObject.Parse(datatojson)["NewPhoneNumber"].ToString(); model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); #region 注释代码 #region MyRegion //string UserAccount = JObject.Parse(datatojson)["UserAccount"].ToString(); ////获取上传的DATA参数 //string postData = System.Web.HttpUtility.UrlDecode(model.DATA); //Dictionary<string, string> data = new Dictionary<string, string>(); //var Object = JToken.Parse(postData); ////遍历存入字典 //for (int i = 0; i < Object.First.Count(); i++) //{ // data.Add(Object.First[i].ToString(), Object.Last[i].ToString()); //} //model.Verification = data["Verification"].ToString(); //model.NewPhoneNumber = data["NewPhoneNumber"].ToString(); #endregion #region 判断缓存验证码 ////判断验证码是否正确 //if (RuntimeCache.Cache.Get(data["NewPhoneNumber"].ToString()) != null) //{ // if (RuntimeCache.Cache.Get(data["NewPhoneNumber"].ToString()).ToString() == model.Verification) // { // var JSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; // string Str = JsonConvert.SerializeObject(model, JSetting); // //返回结果 // Result = ApiHelper.HttpRequest(username, password, Url, Str); // } // else // { // Result = "{\"DATA\":[{\"result\":\"验证码错误\"}]}"; // } //} //else { // Result = "{\"DATA\":[{\"result\":\"验证码已过时\"}]}"; //} #endregion #region 实例化redis请求参数 ////实例化Redis请求参数 //RedisModel.BaseModel redis = new RedisModel.BaseModel(); //redis.RedisIP = "127.0.0.1"; //redis.RedisPort = SingleXmlInfo.GetInstance().GetWebApiConfig("redisPort"); //redis.RedisPassword = "******"; //redis.RedisKey = "AuthCode_" + model.NewPhoneNumber; //redis.RedisValue = model.Verification; //redis.LifeCycle = "60"; //redis.RedisFunction = "StringGet"; ////获取Redis中的验证码 //string GetRedisAuthCode = ApiHelper.HttpRequest(ApiHelper.GetRedisURL(redis.RedisFunction), redis); //if (GetRedisAuthCode == "null") //{ // Result = "{\"DATA\":[{\"result\":\"验证码已过时\"}]}"; //} //else if (GetRedisAuthCode == model.Verification) //{ // var JSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; // string Str = JsonConvert.SerializeObject(model, JSetting); // //返回结果 // Result = await Task<string>.Run(() => ApiHelper.HttpRequest(username, password, Url, Str)); //} //else //{ // Result = "{\"DATA\":[{\"result\":\"验证码错误\"}]}"; //} #endregion #endregion //获取Redis中的验证码 string GetRedisAuthCode = ApiHelper.HttpRequest(ApiHelper.GetAuthCodeURL("smsCodeIp", "sms", "VerifyAuthCode"), model); JObject json = (JObject)JsonConvert.DeserializeObject(GetRedisAuthCode); JObject jobject = new JObject(); jobject.Add("RETURNCODE", "200"); jobject.Add("SOURCE", model.SOURCE); jobject.Add("CREDENTIALS", model.CREDENTIALS); jobject.Add("ADDRESS", model.ADDRESS); jobject.Add("TERMINAL", model.TERMINAL); jobject.Add("INDEX", model.INDEX); jobject.Add("METHOD", model.METHOD); #region 判断验证码 if (json["result"].ToString() == "2") { jobject.Add("result", "2"); Result = jobject.ToString(); } else if (json["result"].ToString() == "1") { //返回结果 Result = ApiHelper.HttpRequest(username, password, Url, model); } else { jobject.Add("result", "3"); Result = jobject.ToString(); } #endregion //} //else //{ // Result = "{\"RETURNCODE\":\"403\"}"; //} ///写日志 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 SubmitReportInfo(ProductInfoModel model) { string Result = string.Empty; //bool ReturnCode = AuthHelper.AuthUserStatus(model); try { //if (ReturnCode) //{ //请求中包含的固定参数 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 = ParametersFilter.StripSQLInjection(model.DATA); if (!string.IsNullOrEmpty(model.Screenshot)) { model.DATA = System.Web.HttpUtility.UrlDecode(model.DATA); string datatojson = ApiHelper.DATAToJson(model.DATA); string CommodityCode = JObject.Parse(datatojson)["CommodityCode"].ToString(); string ReportUser = JObject.Parse(datatojson)["ReportUser"].ToString(); //string UserAccount = ProductInfoModel InfoModel = new ProductInfoModel(); InfoModel.SOURCE = model.SOURCE; InfoModel.CREDENTIALS = model.CREDENTIALS; InfoModel.ADDRESS = model.ADDRESS; InfoModel.TERMINAL = model.TERMINAL; InfoModel.INDEX = model.INDEX; InfoModel.METHOD = "GetCommodityUserAccount"; InfoModel.CommodityCode = CommodityCode; string ReturnUserAccount = ApiHelper.HttpRequest(username, password, Url, InfoModel); //解析返回结果 JObject jsons = (JObject)JsonConvert.DeserializeObject(ReturnUserAccount); string UserAccount = jsons["UserAccount"].ToString(); #region 图片地址 //图片Model ImgModel imgModel = new ImgModel(); imgModel.ImgIp = ApiHelper.ImgURL(); imgModel.ImgDisk = SingleXmlInfo.GetInstance().GetWebApiConfig("imgDisk"); imgModel.ImgRoot = SingleXmlInfo.GetInstance().GetWebApiConfig("imgRoot"); imgModel.UserAccount = UserAccount; imgModel.ImgAttribute = "report"; imgModel.ImgName = ReportUser + ReDateTime.GetTimeStamp(); imgModel.ImgString = model.Screenshot; //保存图片 model.Screenshot = ApiHelper.HttpRequest(ApiHelper.GetImgUploadURL("imgUploadIp", "imgUpload"), imgModel); model.Screenshot = model.Screenshot.Replace("\"", ""); #endregion } model.DATA = System.Web.HttpUtility.UrlEncode(model.DATA); //返回结果 Result = ApiHelper.HttpRequest(username, password, Url, model); ///写日志 string RequestAction = "api/" + username + "/" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString() + ":"; LogHelper.LogResopnse(RequestAction + Result); //} //else //{ // Result = "{\"RETURNCODE\":\"403\"}"; //} } catch (Exception ex) { LogHelper.LogRequest(ex.ToString()); LogHelper.LogError(ex.ToString()); LogHelper.LogResopnse(ex.ToString()); } HttpResponseMessage Respend = new HttpResponseMessage { Content = new StringContent(Result, Encoding.GetEncoding("UTF-8"), "application/json") }; return(Respend); }