优化web查询 新增学员数据 尝试64位软件
This commit is contained in:
1 parent
30beb00fc4
commit
caba307ed1
44 files changed
+738
-1769
No files matched your search
@@ -565,171 +565,6 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 第三方获取商品并直接提交到第三方待上传列表
|
||||
/// </summary>
|
||||
/// <param name="sProdId"></param>
|
||||
/// <param name="supplierId"></param>
|
||||
/// <returns></returns>
|
||||
public string getThirdProduct(string sProdId, string supplierId)
|
||||
{
|
||||
var prodId = sProdId.ParseToLong();
|
||||
if (prodId <= 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("商品Id不存在!");
|
||||
return "failed";
|
||||
}
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
|
||||
if (string.IsNullOrEmpty(supplierId) || shop == null)
|
||||
{
|
||||
BaseMsgForm.ShowError("店铺不存在!");
|
||||
return "failed";
|
||||
}
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var sourceShop = shop;
|
||||
var sourceProdId = prodId;
|
||||
string success_err_msg = "";
|
||||
string errorMsg = "";
|
||||
var html = GetPddProdCommitId(sourceShop, sourceProdId.ToString());
|
||||
if (!html.Contains("\"success\":true") || !html.Contains("\"result\""))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "error_msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
OnInfoReceived("商品获取失败!" + errMsg);
|
||||
return;
|
||||
}
|
||||
var commitId = BaseRegex.GetStringJson(ref html, "goods_commit_id");
|
||||
if (string.IsNullOrEmpty(commitId))
|
||||
{
|
||||
OnInfoReceived("商品获取失败!商品提交编号获取失败!");
|
||||
return;
|
||||
}
|
||||
html = GetPddProdDetail(sourceShop, sourceProdId.ToString(), commitId);
|
||||
|
||||
JObject obj = JObject.Parse(html);
|
||||
var result = JsonHelper.SerializeObject(obj["result"]);
|
||||
var sizeRst = "";
|
||||
PDDProductDetailInfo product = JsonHelper.DeserializeJsonToObject<PDDProductDetailInfo>(result);
|
||||
if (product == null)
|
||||
{
|
||||
OnInfoReceived("商品获取失败!商品数据格式获取失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
//拼多多暂时注释尺码
|
||||
//if (product.sizeTemplateId > 0)
|
||||
//{
|
||||
// html = SizeSpecQuery(sourceShop, sourceProdId.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"]);
|
||||
// }
|
||||
//}
|
||||
|
||||
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
|
||||
PDDShopListForm.Instance.Invoke(new Action(() =>
|
||||
{
|
||||
PDDThirdProdSelectAddShopForm shopForm = new PDDThirdProdSelectAddShopForm();
|
||||
shopForm.ShowDialog();
|
||||
shopLst.AddRange(shopForm.lstSelectShop);
|
||||
}));
|
||||
if (shopLst.Count == 0)
|
||||
{
|
||||
OnInfoReceived("库存上传操作取消或未选择上传店铺!");
|
||||
return;
|
||||
}
|
||||
|
||||
string main_img = "";
|
||||
//if (string.IsNullOrEmpty(main_img))
|
||||
// main_img = product.image_url;
|
||||
//if (string.IsNullOrEmpty(main_img))
|
||||
// main_img = product.hd_thumb_url;
|
||||
//if (string.IsNullOrEmpty(main_img))
|
||||
// main_img = product.thumb_url;
|
||||
if (string.IsNullOrEmpty(main_img))
|
||||
main_img = (product.galleries?.FirstOrDefault(img => img.type == 1)?.url).ParseToString();
|
||||
if (string.IsNullOrEmpty(main_img))
|
||||
main_img = (product.galleries?.FirstOrDefault()?.url).ParseToString();
|
||||
var url = BaseClass.BuildObjString("product_third/add_product");
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&from_shop_id=" + shop.ShopId +
|
||||
"&spu_id=" + product.goods_id.ParseToString() +
|
||||
"&skc_id=" + product.goods_id.ParseToString() +
|
||||
"&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(result, Encoding.UTF8) +
|
||||
"&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8) +
|
||||
"&main_img=" + HttpUtility.UrlEncode(main_img, Encoding.UTF8);
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
//if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
// html = GetHtml.PostUtf8(url, data);
|
||||
//if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
// html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
errorMsg = "库存商品保存失败!请检查网络连接:" +
|
||||
BaseRegex.GetStringJson(ref html, "msg").ParseToString().Replace("'", "\\'").Replace("\"", "\\\"");
|
||||
}
|
||||
var id = BaseRegex.GetLongJson(ref html, "id");
|
||||
if (id == 0)
|
||||
goto end;
|
||||
|
||||
foreach (var addProdShop in shopLst)
|
||||
{
|
||||
url = BaseClass.BuildObjString("product_third/add_user_select_product");
|
||||
data = UserLogin.GetSignaturex() +
|
||||
"&out_product_id=" + id +
|
||||
"&shop_id=" + addProdShop.ShopId +
|
||||
"&shop_account=" + addProdShop.ShopAccount +
|
||||
"&main_user_name=" + addProdShop.UserName +
|
||||
"&sub_user_name=" + addProdShop.SubUserName +
|
||||
"&add_product_remaining=" + addProdShop.AddProductRemaining +
|
||||
"&status=待上传";
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
errorMsg += product?.goods_id + " " + BaseRegex.GetStringJson(ref html, "msg") + "; ";
|
||||
}
|
||||
else
|
||||
{
|
||||
addProdShop.AddProductRemaining = addProdShop.AddProductRemaining - 1;
|
||||
}
|
||||
}
|
||||
end:;
|
||||
if (!string.IsNullOrEmpty(errorMsg))
|
||||
{
|
||||
OnInfoReceived(errorMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnInfoReceived("库存上传保存成功!" + success_err_msg);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnInfoReceived("发生错误:" + ex.Message);
|
||||
}
|
||||
});
|
||||
|
||||
return "success";
|
||||
}
|
||||
|
||||
TemuCat GetCat(TemuDetailProductInfo product)
|
||||
{
|
||||
if (product == null)
|
||||
|
||||
Reference in new issue
Block a user