pxx上货功能 temu备货管理可以查询商品售后率并根据售后率处理备货
This commit is contained in:
1 parent
f4fedf1e2f
commit
0e6a034d5f
34 files changed
+3568
-893
No files matched your search
@@ -32,7 +32,8 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
BaseMsgForm.ShowError("商品Id不存在!");
|
||||
return "failed";
|
||||
}
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
|
||||
//var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
|
||||
var shop = PDDAdminShopListForm.lstAdminShopInfo.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
|
||||
if (string.IsNullOrEmpty(supplierId) || shop == null)
|
||||
{
|
||||
BaseMsgForm.ShowError("店铺不存在!");
|
||||
@@ -77,7 +78,48 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnInfoReceived("商品获取失败!商品数据格式获取失败!" + ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
var size_json = "{}";
|
||||
if (product.size_spec_id.ParseToLong() != 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
var prod_size_rst = GetPddProdSizeSpec(sourceShop, sourceProdId.ToString(), commitId, product.size_spec_id.ParseToString());
|
||||
prod_size_rst = GetHtml.Unicode2String(prod_size_rst);
|
||||
JObject prod_size_obj = JObject.Parse(prod_size_rst);
|
||||
size_json = JsonHelper.SerializeObject(prod_size_obj["result"]);
|
||||
var size = JsonHelper.DeserializeJsonToObject<PDDSizeSpecInfo>(size_json);
|
||||
if (size == null)
|
||||
{
|
||||
OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!" + ex.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//temu尺码表暂时注释
|
||||
//if (product.sizeTemplateId > 0)
|
||||
//{
|
||||
// html = SizeSpecQuery(shop1, prodId1.ToString(), product.sizeTemplateId.ToString());
|
||||
// if(!html.Contains("\"success\":true"))
|
||||
// {
|
||||
// success_err_msg += " 尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// obj = JObject.Parse(html);
|
||||
// sizeRst = JsonHelper.SerializeObject(obj["result"]);
|
||||
// }
|
||||
//}
|
||||
|
||||
var property_json = "{}";
|
||||
PDDProductPropertyInfo property = null;
|
||||
@@ -142,22 +184,6 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
// return;
|
||||
//}
|
||||
|
||||
var sizeRst = "";
|
||||
//尺码表暂时注释
|
||||
//if (product.sizeTemplateId > 0)
|
||||
//{
|
||||
// html = SizeSpecQuery(shop1, prodId1.ToString(), product.sizeTemplateId.ToString());
|
||||
// if(!html.Contains("\"success\":true"))
|
||||
// {
|
||||
// success_err_msg += " 尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// obj = JObject.Parse(html);
|
||||
// sizeRst = JsonHelper.SerializeObject(obj["result"]);
|
||||
// }
|
||||
//}
|
||||
|
||||
bool isExist = false;
|
||||
var existUrl = BaseClass.BuildObjString("product/get_product_list");
|
||||
string existData = UserLogin.GetSignaturex() + "&search_spu=" + product.goods_id;
|
||||
@@ -172,7 +198,8 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
isExist = true;
|
||||
}
|
||||
|
||||
string product_json = "{\"detail\":" + detail_json + ",\"decoration\":" + decoration_json + ",\"property\":" + property_json + "}";
|
||||
|
||||
string product_json = "{\"detail\":" + detail_json + ",\"size\":" + size_json + ",\"decoration\":" + decoration_json + ",\"property\":" + property_json + "}";
|
||||
string main_img = product.image_url;
|
||||
if (string.IsNullOrEmpty(main_img))
|
||||
main_img = product.hd_thumb_url;
|
||||
@@ -200,12 +227,15 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
"&from_shop_id=" + shop.ShopId +
|
||||
"&spu_id=" + product.goods_id.ParseToString() +
|
||||
"&skc_id=" + product.goods_id.ParseToString() +
|
||||
"&price_text=" + product.sku.Min(s => s.multi_price).ParseToInt() * 0.01m + "-" + product.sku.Max(s => s.multi_price).ParseToInt() * 0.01m +
|
||||
"&main_cat_id=" + (product.cat_ids?.FirstOrDefault(c => c != null)).ParseToString() +
|
||||
"&main_cat_name=" + HttpUtility.UrlEncode((product.cats?.FirstOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) +
|
||||
"&cat_id=" + (product.cat_id).ParseToString() +
|
||||
"&cat_name=" + HttpUtility.UrlEncode((product.cats?.LastOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) +
|
||||
"&ext_code=" + HttpUtility.UrlEncode(product.out_goods_sn, Encoding.UTF8) +
|
||||
"&product_name=" + HttpUtility.UrlEncode(product.goods_name, Encoding.UTF8) +
|
||||
"&product_json=" + HttpUtility.UrlEncode(product_json, Encoding.UTF8) +
|
||||
"&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8) +
|
||||
"&size_json=" + HttpUtility.UrlEncode(size_json, Encoding.UTF8) +
|
||||
"&main_img=" + HttpUtility.UrlEncode(main_img, Encoding.UTF8);
|
||||
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
@@ -496,6 +526,29 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private string GetPddProdSizeSpec(ShopLoginInfo shop, string prodId, string commitId, string sizeSpecId)
|
||||
{
|
||||
var anti = shop.AntiContents.LastOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
string url = "https://mms.pinduoduo.com/cabernet/mms/sizespec/query/draft";
|
||||
//string body = @"{""goods_id"":" + prodId + "}";
|
||||
string body = @"{""id"":" + sizeSpecId + @"}";
|
||||
string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
|
||||
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
|
||||
{
|
||||
shop.AntiContents.Remove(anti);
|
||||
anti = shop.AntiContents.FirstOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(300, 500));
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private string GetPddProdProperty(ShopLoginInfo shop, string prodId, string commitId)
|
||||
{
|
||||
var anti = shop.AntiContents.LastOrDefault().ParseToString();
|
||||
|
||||
Reference in new issue
Block a user