给gpt一个接口可以通过店铺appid获取到cookie
This commit is contained in:
1 parent
be8c629c25
commit
faf8f9a68a
3 files changed
+74
No files matched your search
@@ -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编号\"}";
|
||||
|
||||
@@ -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<ShopParam> shopList = new List<ShopParam>();
|
||||
//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))
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user