diff --git a/KJD_WebService/BLL/WXXD/WXOrderManage.cs b/KJD_WebService/BLL/WXXD/WXOrderManage.cs index c0eaa74..1327f44 100644 --- a/KJD_WebService/BLL/WXXD/WXOrderManage.cs +++ b/KJD_WebService/BLL/WXXD/WXOrderManage.cs @@ -476,6 +476,7 @@ namespace KJD_Web.BLL.WXXD string map_sku_id = RegexUtils.GetStringQuery(ref inputData, "map_sku_id")?.Replace("'", "\\'"); string map_send_address = RegexUtils.GetStringQuery(ref inputData, "map_send_address")?.Replace("'", "\\'"); string transit_warehouse_id = RegexUtils.GetStringQuery(ref inputData, "transit_warehouse_id")?.Replace("'", "\\'"); + string map_skus = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "map_skus"))?.Replace("'", "\\'"); if (string.IsNullOrEmpty(spu_code) || string.IsNullOrEmpty(sku_code)) return "{\"code\":500,\"msg\":\"缺少系统商品或SKU编号\"}"; diff --git a/KJD_WebService/BLL/WXXD/WXShopManage.cs b/KJD_WebService/BLL/WXXD/WXShopManage.cs index d0db0cd..cd7b987 100644 --- a/KJD_WebService/BLL/WXXD/WXShopManage.cs +++ b/KJD_WebService/BLL/WXXD/WXShopManage.cs @@ -648,6 +648,67 @@ namespace KJD_Web.BLL.WXXD return "{\"code\":19999,\"msg\":\"未知错误\"}"; } + public string GetOneShopCookieByAppId(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + var shop_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "shop_id"))?.Replace("'", "\\'"); + var sign = RegexUtils.GetStringQuery(ref inputData, "sign"); + if (shop_id.IsNullOrEmpty()) + return "{\"code\":500,\"msg\":\"未指定店铺\"}"; + bool isSign = false; + for (int i = 0; i <= 5; i++) + { + if (EncrypUtil.GetMd5(DateTime.Now.AddMinutes(i).ToString("yyyyMMddHHmm") + "wxxd").ToLower() == sign.ToLower()) + { + isSign = true; + break; + } + else if (i > 0 && EncrypUtil.GetMd5(DateTime.Now.AddMinutes(-i).ToString("yyyyMMddHHmm") + "wxxd").ToLower() == sign.ToLower()) + { + isSign = true; + break; + } + } + if (!isSign) + return "{\"code\":500,\"msg\":\"校验失败\"}"; + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + string sql = "select shop_id,cookie from wxxd.shop where shop_id in ('" + shop_id.Replace(",", "','") + "');"; + + var dt = mySql.ExecuteDataTable(sql); + mySql.Close(); + if (dt != null) + { + //List shopList = new List(); + //foreach (DataRow row in dt.Rows) + //{ + // ShopParam shop = new ShopParam + // { + // shop_id = row["shop_id"].ToString(), + // cookie = row["cookie"].ToString(), + // }; + // shopList.Add(shop); + //} + //var data = JsonUtils.SerializeObjectToString(shopList); + JArray jArr = new JArray(); + foreach (DataRow row in dt.Rows) + { + if (!jArr.Any(o => o["shop_id"].ParseToString() == row["shop_id"].ToString())) + { + JObject jObj = new JObject(); + jObj["shop_id"] = row["shop_id"].ToString(); + jObj["cookies"] = row["cookie"].ToString(); + jArr.Add(jObj); + } + } + return "{\"code\":200,\"msg\":\"success\",\"data\":" + JsonUtils.SerializeObject(jArr) + "}"; + } + } + return "{\"code\":19999,\"msg\":\"未知错误\"}"; + } + public string AddShop(string inputData, bool isAdmin=false) { if (!string.IsNullOrEmpty(inputData)) diff --git a/KJD_WebService/WXShopService.asmx.cs b/KJD_WebService/WXShopService.asmx.cs index 8d707d7..9415361 100644 --- a/KJD_WebService/WXShopService.asmx.cs +++ b/KJD_WebService/WXShopService.asmx.cs @@ -88,6 +88,18 @@ namespace KJD_Web Context.Response.End(); } + [WebMethod] + public void get_one_shop_cookie_by_app_id() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new WXShopManage().GetOneShopCookieByAppId(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + [WebMethod] public void add_shop() {