研究微信免审上架,其他一些功能优化

This commit is contained in:
wule committed 2026-01-21 19:13:58 +08:00
1 parent 42be98616b
commit 6d7b9d7b56
13 files changed
+812 -209

No files matched your search

@@ -37,7 +37,6 @@ namespace TemuKJD.WXForms.ProductForms
public bool IsLoadComplate { get; set; } = false;
bool isInit = false;
bool isStepAddPrice = false;
CheckBox chkSelectAll = null;
Dictionary<ShopLoginInfo, int> dicShopGetCount = new Dictionary<ShopLoginInfo, int>();
Dictionary<ShopLoginInfo, List<string>> dicNotSupportCate = new Dictionary<ShopLoginInfo, List<string>>();
@@ -45,6 +44,7 @@ namespace TemuKJD.WXForms.ProductForms
NaiBa.Util.ConcurrentList<AddPriceRule> lstAddPriceRule = new NaiBa.Util.ConcurrentList<AddPriceRule>();
AddPriceRule defaultAddPriceRule = null;
WXUploadRule wxUploadRule = null;
public Dictionary<string, List<string>> dicCheckedShopIdList = new Dictionary<string, List<string>>();
public WXDBProdUploadForm()
{
InitializeComponent();
@@ -84,6 +84,8 @@ namespace TemuKJD.WXForms.ProductForms
PriceAddMore = priceItem.AddMorePrice,
SinglePriceAdd = priceItem.SinglePriceAdd,
};
ucPrice.lblSinglePriceAdd.Visible = false;
ucPrice.txtSinglePriceAdd.Visible = false;
if (IsSetFontScaleNone)
{
Font of = ucPrice.Font;
@@ -95,21 +97,70 @@ namespace TemuKJD.WXForms.ProductForms
ucPrice.PriceChange += ucAddPrice_PriceChange;
}
dicCheckedShopIdList = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string, List<string>>>("wx_checked_shop_dic_list");
if (dicCheckedShopIdList == null)
dicCheckedShopIdList = new Dictionary<string, List<string>>();
if (!dicCheckedShopIdList.Keys.Contains(BaseClass.UserName))
dicCheckedShopIdList[BaseClass.UserName] = new List<string>();
defaultAddPriceRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<AddPriceRule>("wx_default_add_price_rule");
if (defaultAddPriceRule == null)
{
defaultAddPriceRule = new AddPriceRule() { AddPriceTimes = 1.3m, AddMorePrice = 1, SinglePriceAdd = 1 };
}
txtAddTimes.TextChanged -= txtAddPrice_TextChanged;
txtAddMorePrice.TextChanged -= txtAddPrice_TextChanged;
txtSinglePriceAdd.TextChanged -= txtAddPrice_TextChanged;
txtStockNum.TextChanged -= txtAddPrice_TextChanged;
chkAddMorePriceFirst.CheckedChanged -= chkAddMorePriceFirst_CheckedChanged;
chkStepAddPrice.CheckedChanged -= chkStepAddPrice_CheckedChanged;
this.txtAddTimes.Text = defaultAddPriceRule.AddPriceTimes.ToString();
this.txtAddMorePrice.Text = defaultAddPriceRule.AddMorePrice.ToString();
this.txtSinglePriceAdd.Text = defaultAddPriceRule.SinglePriceAdd.ToString();
this.txtStockNum.Text = defaultAddPriceRule.StockNum.ToString();
this.chkAddMorePriceFirst.Checked = defaultAddPriceRule.AddMorePriceFirst;
this.chkStepAddPrice.Checked = defaultAddPriceRule.IsStepAddPrice;
txtAddTimes.TextChanged += txtAddPrice_TextChanged;
txtAddMorePrice.TextChanged += txtAddPrice_TextChanged;
txtSinglePriceAdd.TextChanged += txtAddPrice_TextChanged;
txtStockNum.TextChanged += txtAddPrice_TextChanged;
chkAddMorePriceFirst.CheckedChanged += chkAddMorePriceFirst_CheckedChanged;
chkStepAddPrice.CheckedChanged += chkStepAddPrice_CheckedChanged;
wxUploadRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<WXUploadRule>("wx_upload_rule");
if (wxUploadRule == null)
wxUploadRule = new WXUploadRule();
this.txtPreDays.TextChanged -= txtPreDays_TextChanged;
this.txtReplaceText.TextChanged -= txtReplaceText_TextChanged;
this.txtMinPrice.TextChanged -= txtMinPrice_TextChanged;
this.txtWaitSeconds.TextChanged -= txtWaitSeconds_TextChanged;
this.chkHighestPriceSku.CheckedChanged -= chkHighestPriceSku_CheckedChanged;
this.chkSameSpecPrice.CheckedChanged -= chkSameSpecPrice_CheckedChanged;
this.chkSkipUploaded.CheckedChanged -= chkSkipUploaded_CheckedChanged;
this.chkUpDraft.CheckedChanged -= chkUpDraft_CheckedChanged;
this.chkPreSale.CheckedChanged -= chkPreSale_CheckedChanged;
this.txtPreDays.Text = wxUploadRule.PreSaleDays.ParseToString();
this.txtReplaceText.Text = wxUploadRule.FilterWords.ParseToString();
this.txtMinPrice.Text = wxUploadRule.SkuMinPrice.ParseToString();
this.txtWaitSeconds.Text = wxUploadRule.WaitSeconds.ParseToString();
this.chkHighestPriceSku.Checked = wxUploadRule.OnlyHighestPriceSku.ParseToBool();
this.chkSameSpecPrice.Checked = wxUploadRule.SameSpecSamePrice.ParseToBool();
this.chkSkipUploaded.Checked = wxUploadRule.SkipUploaded.ParseToBool();
this.chkUpDraft.Checked = wxUploadRule.UpDraft.ParseToBool();
this.chkPreSale.Checked = wxUploadRule.IsPreSale.ParseToBool();
this.txtPreDays.TextChanged += txtPreDays_TextChanged;
this.txtReplaceText.TextChanged += txtReplaceText_TextChanged;
this.txtMinPrice.TextChanged += txtMinPrice_TextChanged;
this.txtWaitSeconds.TextChanged += txtWaitSeconds_TextChanged;
this.chkHighestPriceSku.CheckedChanged += chkHighestPriceSku_CheckedChanged;
this.chkSameSpecPrice.CheckedChanged += chkSameSpecPrice_CheckedChanged;
this.chkSkipUploaded.CheckedChanged += chkSkipUploaded_CheckedChanged;
this.chkUpDraft.CheckedChanged += chkUpDraft_CheckedChanged;
this.chkPreSale.CheckedChanged += chkPreSale_CheckedChanged;
this.lblWaitToUp.Text = "待上传 " + lstTemuDBProductSelect.Count + " 件";
@@ -122,7 +173,7 @@ namespace TemuKJD.WXForms.ProductForms
dgvShop.Columns["colSelect"].HeaderText = "";
//chkSelectAll.Width = chkSelectAll.Height = 13;
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
chkSelectAll.Checked = true;
//chkSelectAll.Checked = true;
this.dgvSelectProduct.AddSelectorColumn("colCheck");
@@ -199,6 +250,10 @@ namespace TemuKJD.WXForms.ProductForms
row.Cells["colSelect"].Value = true;
}
}
dicCheckedShopIdList[BaseClass.UserName] = dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true)
.Select(r => r.Cells["colShopId"].Value.ParseToString()).ToList();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_checked_shop_dic_list", dicCheckedShopIdList);
}
private void btnRefreshShop_Click(object sender, EventArgs e)
@@ -291,7 +346,8 @@ namespace TemuKJD.WXForms.ProductForms
if (row == null)
{
this.dgvShop.Rows.Add(
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
//!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
dicCheckedShopIdList[BaseClass.UserName].Contains(shopEntity.ShopId),
shopEntity.LoginName,
shopEntity.ShopId,
shopEntity.ShopAccount,
@@ -345,6 +401,9 @@ namespace TemuKJD.WXForms.ProductForms
{
//BaseMsgForm.ShowInfo("店铺未登录!");
}
dicCheckedShopIdList[BaseClass.UserName] = dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true)
.Select(r => r.Cells["colShopId"].Value.ParseToString()).ToList();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_checked_shop_dic_list", dicCheckedShopIdList);
break;
case "colLoginStatus":
if (WXShopListForm.Instance == null)
@@ -1707,7 +1766,7 @@ namespace TemuKJD.WXForms.ProductForms
if (defaultAddPriceRule.AddMorePriceFirst)
skuParam.productSkuInfo.salePrice = ((skuInfo.multi_price + defaultAddPriceRule.AddMorePrice * 100) * defaultAddPriceRule.AddPriceTimes).ParseToInt();
// 阶梯式加价,如果命中则按阶梯式加价进行
if (isStepAddPrice)
if (defaultAddPriceRule.IsStepAddPrice)
{
foreach (var addPrice in lstAddPriceRule)
{
@@ -1764,6 +1823,21 @@ namespace TemuKJD.WXForms.ProductForms
}
#endregion
#region 预售信息
if (chkPreSale.Checked)
{
upProdParam.product.deliverInfo = new productDeliverInfoParam();
upProdParam.product.deliverInfo.deliverType = 1;
int preSaleDays = Math.Max(3, wxUploadRule.PreSaleDays);
preSaleDays = Math.Min(45, preSaleDays);
upProdParam.product.deliverInfo.skuDeliverInfo = new skuDeliverInfoParam()
{
stockType = 1,
fullPaymentPresaleDeliveryTime = preSaleDays.ParseToString()
};
}
#endregion
#region 书籍类生成书籍图片
//qualificationList
if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸")
@@ -1876,16 +1950,122 @@ namespace TemuKJD.WXForms.ProductForms
}
// 提交商品上架
var uploadProdRst = WXUpload.upProductV2(shop, upProdParam);
if (!uploadProdRst.Contains("\"code\":0") && !uploadProdRst.Contains("\"success\":true"))
if (!chkTestNoAuditUpload.Checked)
{
var error = BaseRegex.GetStringJson(ref uploadProdRst, "msg");
if (string.IsNullOrEmpty(error))
error = BaseRegex.GetStringJson(ref uploadProdRst, "errmsg");
if (string.IsNullOrEmpty(error))
error = uploadProdRst;
return "{\"success\":false,\"draftId\":" + upProdParam.product.productKey.productId + ",\"status\":\"草稿箱\",\"errMsg\":\"上架失败 " + error + "\"}";
var uploadProdRst = WXUpload.upProductV2(shop, upProdParam);
if (!uploadProdRst.Contains("\"code\":0") && !uploadProdRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref uploadProdRst, "msg");
if (string.IsNullOrEmpty(error))
error = BaseRegex.GetStringJson(ref uploadProdRst, "errmsg");
if (string.IsNullOrEmpty(error))
error = uploadProdRst;
return "{\"success\":false,\"draftId\":" + upProdParam.product.productKey.productId + ",\"status\":\"草稿箱\",\"errMsg\":\"上架失败 " + error + "\"}";
}
if (upProdParam.product.productKey.productId.IsNullOrEmpty())
upProdParam.product.productKey.productId = BaseRegex.GetLongJson(ref uploadProdRst, "productId").ParseToString();
}
else
{
#region 尝试免审接口提交 未成功
var getEditProd = WXUpload.getEditProductV2(shop, upProdParam.product.productKey.productId);
//getEditProd = getEditProd.Replace("8388275713", "33333333");
//getEditProd = getEditProd.Replace("33333333", "8387633147");
string productJson = "";
try
{
// 获取免审编辑回传数据
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var prodStr = JsonConvert.SerializeObject(upProdParam, jsonSetting);
JObject jObj = JsonHelper.JObjectParse(prodStr);
JObject jObjTmp = JsonHelper.JObjectParse(getEditProd);
jObj["product"] = jObjTmp["product"];
//productJson = productJson.Replace("999", "1005");
jObj["product"]["status"] = 1; //默认为5
foreach(var sku in jObj["product"]["productSkus"])
{
sku["productSkuInfo"]["stockInfo"]["stockNum"] = "1000";
sku["productSkuInfo"]["stockInfo"]["totalNum"] = "1000";
//sku["productSkuInfo"]["realStockInfo"]["stockNum"] = "1000";
//sku["productSkuInfo"]["realStockInfo"]["totalNum"] = "1000";
var realStockInfo = new realStockInfoParam() { stockNum = 999, totalNum = 999 };
sku["productSkuInfo"]["realStockInfo"] = JsonHelper.JObjectParse(JsonHelper.SerializeObject(realStockInfo));
}
productJson = JsonHelper.SerializeObject(jObj);
// 提交上架
//var uploadProdRst = WXUpload.upProductJObjectV2(shop, productJson);
}
catch (Exception ex)
{
}
string submitJson = "{\"name\":\"goods/" + upProdParam.product.productKey.productId + "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/" +
BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now) + "/submit.json\"}";
var initFileName = BaseRegex.GetStringJson(ref submitJson, "name");
DateTime tickTime = DateTime.Now.AddSeconds(0 - Randomx.GetId(10, 30));
int time1 = BaseClass.DateTimeToTimestampSeconds(tickTime) - Randomx.GetId(80, 150);
int time2 = BaseClass.DateTimeToTimestampSeconds(tickTime);
var uploadPartRst = WXUpload.initUploadPart(shop, submitJson, upProdParam.product.productKey.productId, time1, time2);
string uploadPartId = BaseRegex.GetStringJson(ref uploadPartRst, "uploadId");
//upProdParam.product.status = 5;
//upProdParam.product.editStatus = 0;
//upProdParam.product.auditReason = "";
//upProdParam.product.info.skuIdList = new skuIdListParam();
//upProdParam.product.info.skuList = new skuListParam();
//upProdParam.product.info.skuList.skuInfo = new List<skuInfoParam>();
//var listingAuditFreeRst = WXUpload.listingAuditFree(shop, upProdParam, upProdParam.product.productKey.productId, time1, time2);
// 提交免审修改(实际生效接口)
var listingAuditFreeRst = WXUpload.listingAuditFree(shop, productJson, upProdParam.product.productKey.productId, time1, time2);
string tempBlobPath = Path.GetTempPath();
for (int i = 0; i < 8; i++)
{
tempBlobPath += folderLetters[Randomx.GetId(folderLetters.Length)];
}
if (!Directory.Exists(tempBlobPath))
Directory.CreateDirectory(tempBlobPath);
string blobFullPath = tempBlobPath + "\\blob"; // C:\Users\Administrator\AppData\Local\Temp\3mer3k21\blob
using (StreamWriter sw = new StreamWriter(blobFullPath))
{
//skuParam.productSkuInfo.realStockInfo = new realStockInfoParam() { stockNum = 1005, totalNum = 1005 };
var jObj = JsonHelper.JObjectParse(productJson);
foreach(JObject skuObj in jObj["product"]["productSkus"])
{
skuObj["productSkuInfo"]["stockInfo"]["stockNum"] = 1005;
var realStockInfo = new realStockInfoParam() { stockNum = 999, totalNum = 999 };
skuObj["productSkuInfo"]["realStockInfo"] = JsonHelper.JObjectParse(JsonHelper.SerializeObject(realStockInfo));
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
foreach (var sku in upProdParam.product.productSkus)
{
sku.productSkuInfo.stockInfo.stockNum = 1005;
}
var prodStr = JsonConvert.SerializeObject(upProdParam, jsonSetting);
prodStr = JsonHelper.SerializeObject(jObj["product"]);
sw.Write(prodStr);
}
uploadPartRst = WXUpload.uploadPartBinary(shop, initFileName, blobFullPath, uploadPartId, upProdParam.product.productKey.productId, time1, time2);
//{"code":0,"etag":"18e3f73046378472219641ef181d3232"}
//C:\Users\Administrator\AppData\Local\Temp\9uaeiplr\blob
var eTag = BaseRegex.GetStringJson(ref uploadPartRst, "etag");
string rstParmStr = @"{""name"":""" + initFileName + @""",""uploadId"":""" + uploadPartId + @""",""etagList"":[""" + eTag + @"""],""partSeqList"":[1]}";
var complateRst = WXUpload.completeUploadPart(shop, rstParmStr, upProdParam.product.productKey.productId, time1, time2);
#endregion
}
if (cell != null)
{
Invoke(new Action(() =>
@@ -2204,7 +2384,8 @@ namespace TemuKJD.WXForms.ProductForms
private void chkStepAddPrice_CheckedChanged(object sender, EventArgs e)
{
isStepAddPrice = this.chkStepAddPrice.Checked;
defaultAddPriceRule.IsStepAddPrice = this.chkStepAddPrice.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig<AddPriceRule>("wx_default_add_price_rule", defaultAddPriceRule);
}
private void btnClearDgv_Click(object sender, EventArgs e)
@@ -2347,6 +2528,60 @@ namespace TemuKJD.WXForms.ProductForms
}
}
}
private void txtPreDays_TextChanged(object sender, EventArgs e)
{
wxUploadRule.PreSaleDays = txtPreDays.Text.Trim().ParseToInt();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void txtReplaceText_TextChanged(object sender, EventArgs e)
{
wxUploadRule.FilterWords = txtReplaceText.Text.Trim();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void txtMinPrice_TextChanged(object sender, EventArgs e)
{
wxUploadRule.SkuMinPrice = txtMinPrice.Text.Trim().ParseToInt();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void txtWaitSeconds_TextChanged(object sender, EventArgs e)
{
wxUploadRule.WaitSeconds = txtWaitSeconds.Text.Trim().ParseToInt();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkHighestPriceSku_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.OnlyHighestPriceSku = chkHighestPriceSku.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkSameSpecPrice_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.SameSpecSamePrice = chkSameSpecPrice.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkSkipUploaded_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.SkipUploaded = chkSkipUploaded.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkUpDraft_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.UpDraft = chkUpDraft.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
private void chkPreSale_CheckedChanged(object sender, EventArgs e)
{
wxUploadRule.IsPreSale = chkPreSale.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_upload_rule", wxUploadRule);
}
}
public class WXUpload
@@ -2497,6 +2732,132 @@ Content-Type: image/jpeg
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string upProductJObjectV2(ShopLoginInfo shop, string prodStr)
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/upProductV2?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry";
//JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
//var prodStr = JsonConvert.SerializeObject(prodParam, jsonSetting);
JObject jObj = new JObject();
jObj.Add("data", prodStr);
string body = JsonHelper.SerializeObject(jObj);
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
/// <summary>
/// 取售后地址
/// </summary>
/// <param name="shop"></param>
/// <returns></returns>
public static string getEditProductV2(ShopLoginInfo shop, string productId)
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/getEditProductV2?token=&lang=zh_CN&productKey=%7B%22productId%22:" +
productId + "%7D&needRealStock=true&preview=false&release=false";
//url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/getEditProductV2?token=&lang=zh_CN&productKey=%7B%22productId%22:" +
// productId + "%7D&needRealStock=true&preview=false&release=true";
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + productId + "&isUpdateAuditFree=0&source=list_edit&continueEditInfo={%22isEditingContinued%22:false,%22lastEditDraftTime%22:0,%22listingTime%22:0}";
//referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + productId + "&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo={%22isEditingContinued%22:true,%22lastEditDraftTime%22:0,%22listingTime%22:0}";
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
return result;
}
public static string initUploadPart(ShopLoginInfo shop, string submitJson, string prodId, int time1, int time2)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodefiletransfer/filecos/initUploadPart?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + prodId +
"&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo=" +
"{%22isEditingContinued%22:true,%22lastEditDraftTime%22:" + time1 + "," +
"%22listingTime%22:" + time2 + "}";
string body = submitJson; //@"{""name"":""goods/10000456038253/2026-01-20/1768887306422/submit.json""}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string listingAuditFree(ShopLoginInfo shop, WXUploadProductParam prodParam, string prodId, int time1, int time2)
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/listingAuditFree?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + prodId +
"&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo=" +
"{%22isEditingContinued%22:true,%22lastEditDraftTime%22:" + time1 + "," +
"%22listingTime%22:" + time2 + "}";
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var prodStr = JsonConvert.SerializeObject(prodParam, jsonSetting);
JObject jObj = new JObject();
jObj.Add("data", prodStr);
string body = JsonHelper.SerializeObject(jObj);
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string listingAuditFree(ShopLoginInfo shop, string prodStr, string prodId, int time1, int time2)
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/listingAuditFree?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + prodId +
"&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo=" +
"{%22isEditingContinued%22:true,%22lastEditDraftTime%22:" + time1 + "," +
"%22listingTime%22:" + time2 + "}";
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
JObject jObj = new JObject();
jObj.Add("data", prodStr);
string body = JsonHelper.SerializeObject(jObj);
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string uploadPartBinary(ShopLoginInfo shop, string initFileName, string blobPath, string uploadId, string prodId, int time1, int time2)
{
string boundaryLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
string boundaryStr = "----WebKitFormBoundary";
for (int i = 0; i < 16; i++)
{
boundaryStr += boundaryLetters[Randomx.GetId(boundaryLetters.Length)];
}
string url = "https://store.weixin.qq.com/shop-faas/mmecnodefiletransfer/filecos/uploadPartBinary?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + prodId +
"&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo=" +
"{%22isEditingContinued%22:true,%22lastEditDraftTime%22:" + time1 + "," +
"%22listingTime%22:" + time2 + "}";
string body = @"--" + boundaryStr + @"
Content-Disposition: form-data; name=""name""
" + initFileName + @"
--" + boundaryStr + @"
Content-Disposition: form-data; name=""uploadId""
" + uploadId + @"
--" + boundaryStr + @"
Content-Disposition: form-data; name=""partSeq""
1
--" + boundaryStr + @"
Content-Disposition: form-data; name=""file""; filename=""blob""
Content-Type: application/octet-stream
<!>" + blobPath + @"<!>
--" + boundaryStr + @"--
";
var result = WXHttpResponseBLL.WeiXinUploadResponse(shop, url, body, boundaryStr, referer);
return result;
}
public static string completeUploadPart(ShopLoginInfo shop, string completeJson, string prodId, int time1, int time2)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodefiletransfer/filecos/completeUploadPart?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + prodId +
"&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo=" +
"{%22isEditingContinued%22:true,%22lastEditDraftTime%22:" + time1 + "," +
"%22listingTime%22:" + time2 + "}";
string body = completeJson; //{"name":"goods/10000466857488/2026-01-20/1768907711117/submit.json","uploadId":"176890774759894589c6096cab2210e0793688fb68b482b766a0387c8667d3280a36385109","etagList":["ade9671ce546efb4cb209f5aa7e5d597"],"partSeqList":[1]}
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
}
public class AddPriceRule
@@ -2529,39 +2890,23 @@ Content-Type: image/jpeg
/// 上货库存量设置
/// </summary>
public int StockNum { get; set; } = 0;
public bool IsStepAddPrice { get; set; } = false;
}
public class WXUploadRule
{
public bool IsUseUpperSizeSpec { get; set; } = true;
public bool IsKeepChanceGoodImg { get; set; } = true;
/// <summary>
/// 是否报名活动(提交一个虚拟高倍率加价再通过活动价格实现商品原价)
/// </summary>
public bool IsSignActivity { get; set; } = true;
/// <summary>
/// 准备报名活动的商品原价加价倍率
/// </summary>
public decimal ActivityAddPriceTimes { get; set; } = 3m;
public bool IsLowPriceSku { get; set; } = true;
public string LowPriceSkuName { get; set; } = "福利款";
public decimal LowPriceSkuLowestPrice { get; set; } = 5m;
public int PreSaleDays { get; set; } = 5;
/// <summary>
/// 升级版
/// </summary>
public bool IsUpgradeVersion { get; set; } = false;
public string UpgradeVersionName { get; set; } = "升级版";
/// <summary>
/// 升级版额外加价
/// </summary>
public decimal UpgradeVersionAddPrice { get; set; } = 1m;
public string FilterWords { get; set; } = "真丝,蚕丝,香云纱,羊绒,羊毛,羊羔绒,羊羔毛,羽绒,皮草";
public bool IsUseExtCodePrice { get; set; }
public int SkuMinPrice { get; set; } = 10;
public bool sign20981 { get; set; }
public bool sign22347 { get; set; }
public bool sign15996 { get; set; }
public bool sign21365 { get; set; }
public int WaitSeconds { get; set; } = 10;
public bool OnlyHighestPriceSku { get; set; } = true;
public bool SameSpecSamePrice { get; set; } = true;
public bool SkipUploaded { get; set; } = true;
public bool UpDraft { get; set; } = false;
public bool IsPreSale { get; set; } = false;
}
}