diff --git a/AllBase/JsonHelper.cs b/AllBase/JsonHelper.cs index bb387a5..da843e4 100644 --- a/AllBase/JsonHelper.cs +++ b/AllBase/JsonHelper.cs @@ -62,6 +62,9 @@ namespace AllBase /// 对象实体集合 public static List DeserializeJsonToList(string json) where T : class { + if (string.IsNullOrEmpty(json)) + return new List(); + JsonSerializer serializer = new JsonSerializer(); StringReader sr = new StringReader(json); object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List)); diff --git a/AllBase/Model/Result/PDDFrontProductInfo3.cs b/AllBase/Model/Result/PDDFrontProductInfo3.cs new file mode 100644 index 0000000..aaf152a --- /dev/null +++ b/AllBase/Model/Result/PDDFrontProductInfo3.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AllBase.Model.Result +{ + public class PDDFrontProductInfo3 + { + public storeInfo store { get; set; } + } + + public class storeInfo + { + public initDataObjInfo initDataObj { get; set; } + } + + public class initDataObjInfo + { + public frontGoods3 goods { get; set; } + public frontMall3 mall { get; set; } + } + + public class frontMall3 + { + public string mallId { get; set; } // "525159017", + public string mallName { get; set; } // "丰润粮行", + public string mallNameBeforeTrans { get; set; } //"丰润粮行", + public string commonMallSn { get; set; } // "CgI2WRIIS0xJNU5SeWUaEIyvRPN5kXSIHgLRzO8cKQQiEG3MCMAvMxkfdCTD6cGcpysoAjAC", + public int? mallShowType { get; set; } // 0, + public int? mallTransferType { get; set; } // 0, + public string salesTip { get; set; } // "本店已拼2.9万件", + public string salesTipV2 { get; set; } //"本店已拼2.9万件", + public int? mallSales { get; set; } // 29000, + public string mallLogo { get; set; } //"http://t16img.yangkeduo.com/pdd_ims/b8a22d4f0a836f1092a5ca4616ae504a.jpg", + public int? goodsNum { get; set; } // 32, + public string goodsNumDesc { get; set; } //"商品数量: 32", + public string pddRoute { get; set; } // "mall_page.html?mall_sn=CgI2WRIIS0xJNU5SeWUaEMo5%2BOQRk5ds3pAKdvP7h%2B0iENx7YPKmJOuOHBOXqFh6WWYoAjAC&decrypt_mall_sn=1&msn=2msllrrezqz342rqxtnapi5pya_axbuy&_sop_rcto=YWInBFuzqa5GZuTI3XrNpg03TuXTx_3fIjo&mall_info=%7B%22mall_name%22%3A%22%E4%B8%B0%E6%B6%A6%E7%B2%AE%E8%A1%8C%22%7D", + public string pddRouteName { get; set; } // "进店逛逛", + public string mallServiceTag { get; set; } // "客服", + public bool? isFlagShip { get; set; } // false, + } + + public class frontGoods3 + { + public string sold_count = null; + public string sold_count_str = null; + + public long? serverTime { get; set; } // 1782836359, + public long? serverTimeTen { get; set; } // 17828363609, + public long? weakenGoodsName { get; set; } // 0, + public long? catID { get; set; } // 7575, + public long? goodsID { get; set; } // 1661424397, + public string brandId { get; set; } // "", + public string goodsName { get; set; } // "红薏仁5斤装 红薏仁米小薏米仁农家自产新红薏米1斤2斤苡仁糙薏米", + public string shareDesc { get; set; } // "红薏仁5斤装 红薏仁米小薏米仁农家自产新红薏米1斤2斤苡仁糙薏米", + public string goodsType { get; set; } // 1, + public List topGallery { get; set; } + public List viewImageData { get; set; } // [ "https://t00img.yangkeduo.com/goods/images/2019-12-14/3d66ace6-62cd-4d82-bfff-65c84b268361.jpg", ... ], + public List detailGallery { get; set; } + + public List videoGallery { get; set; } + public long? mallID { get; set; } // 525159017 + + public List skus { get; set; } + + public string thumbUrl { get; set; } // "https://img.pddpic.com/gaudit-image/2022-01-25/b5b0aa45a8ce7a59ef8eb0798fb537a4.jpeg", + public string hdThumbUrl { get; set; } // "https://img.pddpic.com/gaudit-image/2022-01-25/76e52ff7ff407a6d5c1753e40294bcb7.jpeg", + public int? eventType { get; set; } // 0, + public int? isApp { get; set; } // 0, + public int? isFreshmanApp { get; set; } // 0, + public string sideSalesTip { get; set; } // "热销4652斤", + public int? catID1 { get; set; } // 6630, + public int? catID2 { get; set; } // 6654, + public int? catID3 { get; set; } // 6655, + public int? catID4 { get; set; } // 7575, + public int? spuID { get; set; } // 0, + public bool? eventComing { get; set; } // false, + public bool? isSpike { get; set; } // false, + public bool? isTodaySpike { get; set; } // false, + public bool? isTomorrowSpike { get; set; } // false, + public bool? isSpikeComing { get; set; } // false, + public int? overseaType { get; set; } // 0, + public object gpv { get; set; } // null, + public bool? quickRefund { get; set; } // false, + public bool? rv { get; set; } // true, + public string maxNormalPrice { get; set; } // "42.5", + public string minNormalPrice { get; set; } // "14.5", + public string maxGroupPrice { get; set; } // "38.8", + public string minGroupPrice { get; set; } // "13.5", + public string maxOnSaleGroupPrice { get; set; } // "38.8", + public string minOnSaleGroupPrice { get; set; } // "13.5", + public int? maxOnSaleGroupPriceInCent { get; set; } // 3880, + public int? minOnSaleGroupPriceInCent { get; set; } // 1350, + public string maxOnSaleNormalPrice { get; set; } // "42.5", + public string minOnSaleNormalPrice { get; set; } // "14.5", + public string unselectNormalSavePrice { get; set; } // "1", + public int? oldMinOnSaleGroupPriceInCent { get; set; } // 1350, + public List skipGoodsIDs { get; set; } // ["0"] + public object tag { get; set; } // null, + public object icon { get; set; } // null, + public List tagIcon { get; set; } // [ ], + public int? isSecondHand { get; set; } // 0, + public int? appClientOnly { get; set; } // 0, + public int? isColdGoods { get; set; } // 1, + public List goodsProperty { get; set; } + public List skuProperty { get; set; } + + + public int? propertyShowNum { get; set; } // 5, + public string linePrice { get; set; } // "68", + public int? priceStyle { get; set; } // 2, + public string priceSuffix { get; set; } // "起", + public string shareTitle { get; set; } // "13.5元 红薏仁5斤装 红薏仁米小薏米仁农家自产新红薏米1斤2斤苡仁糙薏米 拼多多", + public newShareTitleInfo newShareTitl { get; set; } + public object bottomBanner { get; set; } // null, + public bool? isAppFlow { get; set; } // true, + public int? isPersonalFav { get; set; } // 0, + public bool? groupNumFull { get; set; } // false, + public int? showHistoryGroup { get; set; } // 1, + public string shareLink { get; set; } // "goods1.html?goods_id=1661424397&page_from=23&pxq_secret_key=QWQMWFJMVA74GIIMHFUXALB5ZCBNJCYV5ANINMD7UOMJYEXK4KNA&_oak_share_snapshot_num=1350&_oak_share_time=1782836359&share_oak_rcto=YWL2oNqXCEvRIUlyReRrcF7njWrmpZN8wWj_KHekAqSbEFuQ1MTDsd0RrYEQyfFHBnA", + public string promptExplain { get; set; } // "", + public bool? isAbnormalStatus { get; set; } // false, + public string statusExplain { get; set; } // "", + public int? checkQuantity { get; set; } // 1, + public string destinationUrl { get; set; } // "order_checkout.html", + public bool? hideMall { get; set; } // false, + public bool? isMallRec { get; set; } // false, + public int? status { get; set; } // 1, + public bool? isGoodsOnSale { get; set; } // true, + public bool? isSkuOnSale { get; set; } // true, + public bool? isOnSale { get; set; } // true, + public int? quantity { get; set; } // 1000, + public int? propertyCardClick { get; set; } // 0, + public int? showRecTitle { get; set; } // 1, + public int? showRec { get; set; } // 1, + + } + + public class pddFrontGoods3List + { + public long? goodsId { get; set; } // 1661424397, + public string goodsName { get; set; } // "红薏仁5斤装 红薏仁米小薏米仁农家自产新红薏米1斤2斤苡仁糙薏米", + public long? mallId { get; set; } // 525159017 + public string mallName { get; set; } + public List skus { get; set; } + } + + public class newShareTitleInfo + { + public string price { get; set; } // "13.5元 ", + public string suf { get; set; } // "红薏仁5斤装 红薏仁米小薏米仁农家自产新红薏米1斤2斤苡仁糙薏米 拼多多", + public string not_null { get; set; } // true + + } + + public class frontGoodsPropertyInfo3 + { + public string key { get; set; } // "包装方式", + public List values { get; set; } // [ "食用农产品" ], + public long? ref_pid { get; set; } // 677, + public long? reference_id { get; set; } // 0 + + } + + public class frontSkuInfo3 + { + public long? skuId { get; set; } // 28790184768, + public long? goodsId { get; set; } // 1661424397, + public string thumbUrl { get; set; } // "https://t00img.yangkeduo.com/t10img/images/2018-06-09/5c7746a3608e75a2b65926f4ed0f34cb.jpeg", + public int? initQuantity { get; set; } // 0, + public int? quantity { get; set; } // 1000, + public int? limitQuantity { get; set; } // 999999, + public int? soldQuantity { get; set; } // 0, + public int? hotSale { get; set; } // 1, + public int? defaultQuantity { get; set; } // 100, + public int? isOnsale { get; set; } // 1, + public string spec { get; set; } // "677094835", + public List specs { get; set; } + public int? price { get; set; } // 0, + public string normalPrice { get; set; } // "14.5", + public string groupPrice { get; set; } // "13.5", + public int? oldGroupPrice { get; set; } // 1350, + public int? marketPrice { get; set; } // 0, + public int? weight { get; set; } // 2500, + public List yellowLabelList { get; set; } + public int? previewPriority { get; set; } // 0, + public int? startTime { get; set; } // 0, + public int? endTime { get; set; } // 0, + public int? staticLimitQuantity { get; set; } // 999999, + public string attribute { get; set; } // "{\"skuPreSaleTime\":0}", + public string normalSavePrice { get; set; } // "1", + public long? skuID { get; set; } // 28790184768, + public string skuExpansionPrice { get; set; } // "0" + } + + public class yellowLabelListInfo + { + public string labelText { get; set; } // "2件9.9折", + public string labelType { get; set; } // "single_goods_percentage_event" + } + + public class frontSpecInfo3 + { + public string spec_key { get; set; } // "重量", + public string spec_value { get; set; } // "红薏仁米1斤装", + public long? spec_key_id { get; set; } // 1253, + public long? spec_value_id { get; set; } // 677094835, + public bool? custom { get; set; } // false + } + + + public class detailGalleryInfo + { + public string url { get; set; } // "https://img.pddpic.com/goods/images/2019-12-14/3d66ace6-62cd-4d82-bfff-65c84b268361.jpg", + public int? width { get; set; } // 800, + public int? height { get; set; } // 800 + + } + public class videoGalleryInfo + { + public string url { get; set; } // "https://img.pddpic.com/goods/images/2019-12-14/3d66ace6-62cd-4d82-bfff-65c84b268361.jpg", + public int? width { get; set; } // 800, + public int? height { get; set; } // 800 + + } + public class topGalleryInfo + { + public string url { get; set; } // "https://img.pddpic.com/goods/images/2019-12-14/3d66ace6-62cd-4d82-bfff-65c84b268361.jpg", + public long? id { get; set; } // 20969775049, + public int? aspectRatio { get; set; } // 1 + + } +} diff --git a/Work/_29Tools/Forms/PddMobileBuyOrderForm.cs b/Work/_29Tools/Forms/PddMobileBuyOrderForm.cs index 8e356d0..2a22773 100644 --- a/Work/_29Tools/Forms/PddMobileBuyOrderForm.cs +++ b/Work/_29Tools/Forms/PddMobileBuyOrderForm.cs @@ -39,11 +39,11 @@ using Work.BaseForms; using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; namespace TemuKJD.ToolForms -{ - +{ public partial class PddMobileBuyOrderForm : BaseGeneralForm { public oms_wei_external_procurement_log_info AbnormalTransitWarehouseOrderInfo { get; set; } = null; + public pddFrontGoods3List pddFrontGoodsLite = new pddFrontGoods3List(); public bool IsAutoBuy { get; set; } = true; public bool IsFormLoad { get; set; } = false; @@ -402,7 +402,10 @@ namespace TemuKJD.ToolForms { MatchTransitWarehouse(sendProvince); } - }); + + MatchProdAllSkus(data); + + }); } // 订单详情页面 获取关联信息和拍单信息(已拍过单但是因某种原因未成功绑定仓库) @@ -828,8 +831,50 @@ namespace TemuKJD.ToolForms })); } } - - private void ShopLoginForm_FormClosed(object sender, FormClosedEventArgs e) + + + void MatchProdAllSkus(string data) + { + var skusStrLst = BaseRegex.GetJsonArrStrJson(ref data, "skus"); + skusStrLst = skusStrLst.OrderByDescending(s => s.Length).ToList(); + pddFrontGoodsLite.skus = JsonHelper.DeserializeJsonToList(skusStrLst?.FirstOrDefault()); + pddFrontGoodsLite.goodsName = BaseRegex.GetStringJson(ref data, "goodsName"); + pddFrontGoodsLite.goodsId = BaseRegex.GetLongJson(ref data, "goodsId"); + pddFrontGoodsLite.mallName = BaseRegex.GetStringJson(ref data, "mallName"); + pddFrontGoodsLite.mallId = BaseRegex.GetLongJson(ref data, "mallId"); + + + //bool isAutoGetWarehouse = false; + //foreach (var item in this.cmbTransitWarehouse.Items) + //{ + // TransitWarehouseParam warehouseParam = TransitWarehouseData.TransitWarehouseList.FirstOrDefault(t => t.TransName + " " + t.TransDetailAddress == item.ParseToString()); + // if (warehouseParam == null) + // { + // continue; + // } + // if (warehouseParam.TransDetailAddress.Contains(data)) + // { + // Invoke(new Action(() => + // { + // cmbTransitWarehouse.Text = warehouseParam.TransName + " " + warehouseParam.TransDetailAddress; + // })); + // transitWarehouse = warehouseParam; + // isAutoGetWarehouse = true; + // break; + // } + //} + //if (!isAutoGetWarehouse) + //{ + // //黄导家庭父母5天训练营-《父母5天成为孩子成长的引路人》+《不内卷养育》2本书 + // Invoke(new Action(() => + // { + // cmbTransitWarehouse.Text = ""; + // BaseMsgForm.ShowError("匹配仓库失败,请手动选择"); + // })); + //} + } + + private void ShopLoginForm_FormClosed(object sender, FormClosedEventArgs e) { //OnSaveComplete(shop); Task.Run(() => { @@ -871,8 +916,8 @@ namespace TemuKJD.ToolForms } - - var url = BaseClass.Build29WxObjString("order/wx_add_mdy_buy_prod_map"); + string url; + // 保存sku及商品关联信息 var data = UserLogin.GetSignaturex() + "&spu_code=" + GetHtml.UrlEncodeUtf8(txtUpSpuCode.Text.Trim()) + "&sku_code=" + GetHtml.UrlEncodeUtf8(txtUpSkuCode.Text.Trim()) @@ -883,7 +928,24 @@ namespace TemuKJD.ToolForms + "&map_sku_id=" + txtMapSkuId.Text.Trim() + "&map_send_address=" + txtSendProvince.Text.Trim() + "&transit_warehouse_id=" + transitWarehouse?.TransId; - var result = GetHtml.PostUtf8(url, data); + if (this.pddFrontGoodsLite != null && this.pddFrontGoodsLite.goodsId.ParseToString() == txtMapGoodsId.Text.Trim()) + { + //// 保存商品关联信息 + //data += "&map_skus=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(pddFrontGoodsLite)); + //url = BaseClass.Build29WxObjString("order/wx_add_mdy_buy_prod_map_skus"); + //var skusRst = GetHtml.PostUtf8(url, data); + //if (!skusRst.Contains("\"code\":200")) + // skusRst = GetHtml.PostUtf8(url, data); + + //// 存完立即测试读取 + ////wx_get_buy_pord_map_skus + //var dataTest = UserLogin.GetSignaturex() + "&spu_codes=" + GetHtml.UrlEncodeUtf8(txtUpSpuCode.Text.Trim()); + //dataTest += "&main_user_name=" + BaseClass.MainUserName; + //url = BaseClass.Build29WxObjString("order/wx_get_buy_pord_map_skus"); + //var dataTestRst = GetHtml.PostUtf8(url, dataTest); + } + url = BaseClass.Build29WxObjString("order/wx_add_mdy_buy_prod_map"); + var result = GetHtml.PostUtf8(url, data); if (!result.Contains("\"code\":200")) result = GetHtml.PostUtf8(url, data); if (!result.Contains("\"code\":200")) @@ -938,8 +1000,6 @@ namespace TemuKJD.ToolForms BaseMsgForm.ShowInfo("保存成功!"); this.Close(); } - - } private async void btnManualUpdateBuyOrder_Click(object sender, EventArgs e) @@ -1065,6 +1125,7 @@ namespace TemuKJD.ToolForms out_amount = (txtBuyPrice.Text.ParseToDecimal() * 100).ParseToInt(), out_order_no = txtBuyOrderId.Text.Trim(), purchaser_note = body["purchaserNote"].ParseToString(), + created_time = DateTime.Now, }); orderItem.SetOrderItemTextProperty(); // 利润计算重置为最小值,控件Resource更新时将计算利润