上海退货仓地址调整

This commit is contained in:
wule_5900x committed 2026-08-09 18:47:30 +08:00
1 parent b8d1626acf
commit 728cbc5aa7
10 files changed
+447 -567

No files matched your search

@@ -532,10 +532,10 @@ namespace TemuKJD.WXForms.ProductForms
try
{
string addressId = "";
string setAddressRst = SetShanghaiReturnOrderAddress(shop);
string setAddressRst = WXProdNoCheckEditHelper.SetShanghaiReturnOrderAddress(shop);
if (setAddressRst.Contains("\"success\":true"))
{
addressId = dicShopAddressId[shop.ShopId];
addressId = WXProdNoCheckEditHelper.dicShopAddressId[shop.ShopId];
}
else
{
@@ -609,7 +609,7 @@ namespace TemuKJD.WXForms.ProductForms
}
else
{
var downProd = WXNoCheckEdit.DownProd(shop, prodId);
var downProd = WXProdNoCheckEditHelper.DownProd(shop, prodId);
System.Threading.Thread.Sleep(Randomx.GetId(50, 100));
if (downProd.Contains("\"code\":0"))
{
@@ -635,66 +635,6 @@ namespace TemuKJD.WXForms.ProductForms
}
}
public static List<string> LastName { get; set; } = new List<string>()
{
"赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "沈", "杨", "朱", "许", "何", "张",
};
public static Dictionary<string, string> dicShopAddressId { get; set; } = new Dictionary<string, string>();
/// <summary>
/// 上海仓退货订单地址
/// </summary>
/// <param name="shop"></param>
/// <param name="afterSaleDetail"></param>
/// <returns></returns>
public string SetShanghaiReturnOrderAddress(ShopLoginInfo shop, string afterSaleDetail= "真如镇街道真北路2653弄Z区zt")
{
if (dicShopAddressId.ContainsKey(shop.ShopId))
{
return "{\"success\":true}";
}
//收件人:百家姓随机
//手机号:13024622251(马老师手机号)
//上海市普陀区真如镇街道真北路2653弄Z区zt
var addressRst = WXUpload.getAddress(shop, afterSaleDetail);
if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref addressRst, "msg");
if (string.IsNullOrEmpty(error))
error = addressRst;
return "{\"success\":false,\"errMsg\":\"售后地址获取失败 " + error + "\"}";
}
if (addressRst.Contains("\"totalNum\":0") && !string.IsNullOrEmpty(afterSaleDetail))
{
string provinceName = "上海市";
string cityName = "上海市";
string countyName = "普陀区";
string detailInfo = afterSaleDetail;
string userName = LastName[Randomx.GetId(LastName.Count)] + (Randomx.GetId(2) == 0 ? "先生" : "女士");
string telNumber = "13024622251";
var addAddRst = WXUpload.addAddress(shop, provinceName, cityName, countyName, detailInfo, userName, telNumber);
Thread.Sleep(Randomx.GetId(500, 1000));
addressRst = WXUpload.getAddress(shop, afterSaleDetail);
if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref addressRst, "msg");
if (string.IsNullOrEmpty(error))
error = addressRst;
return "{\"success\":false,\"errMsg\":\"售后地址添加失败 " + error + "\"}";
}
}
var addressId = BaseRegex.GetStringJson(ref addressRst, "addressId");
if (!addressId.IsNullOrEmpty())
{
dicShopAddressId[shop.ShopId] = addressId;
return "{\"success\":true}";
}
return "{\"success\":false,\"地址解析失败\"}";
}
private void btnStop_Click(object sender, EventArgs e)
{
@@ -766,9 +706,9 @@ namespace TemuKJD.WXForms.ProductForms
onSaleStatusCode = 6;
if (string.IsNullOrEmpty(PreType))
getProdOnSaleRst = WXNoCheckEdit.scanProductPreview(shop, page, nextKey, pageSize, onSaleStatusCode);
getProdOnSaleRst = WXProdNoCheckEditHelper.scanProductPreview(shop, page, nextKey, pageSize, onSaleStatusCode);
else
getProdOnSaleRst = WXNoCheckEdit.searchProduct(shop, page, PreType == "预售" ? 1 : 0, pageSize, onSaleStatusCode);
getProdOnSaleRst = WXProdNoCheckEditHelper.searchProduct(shop, page, PreType == "预售" ? 1 : 0, pageSize, onSaleStatusCode);
Thread.Sleep(Randomx.GetId(50, 100));
if (!getProdOnSaleRst.Contains("\"success\":true"))
{
@@ -892,52 +832,6 @@ namespace TemuKJD.WXForms.ProductForms
dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Style.ForeColor = color;
dgvSelectProduct.Rows[rowIndex].Cells["colPreSale"].Style.ForeColor = dgvSelectProduct.Rows[rowIndex].Cells["colPreSale"].Value.ParseToString().Contains("预售") ? Color.Green : Color.Blue;
}));
// 获取商品链接
if (StatusStr.ParseToString().StartsWith("在售") && chkSearchPromotionLink.Checked == true)
{
var t = Task.Run(() =>
{
var PromotionRst = WXNoCheckEdit.GetPromotionLink(shop, prod["productId"].ParseToString(), page);
Thread.Sleep(Randomx.GetId(50, 150));
if (PromotionRst.ParseToString().Contains("\"code\":0"))
{
var shareUrl = BaseRegex.GetStringJson(ref PromotionRst, "shareUrl");
var shortLink = BaseRegex.GetStringJson(ref PromotionRst, "shortLink");
if (!string.IsNullOrEmpty(shareUrl))
{
Invoke(new Action(() =>
{
if (comboBox1.Text == "短链")
dgvSelectProduct.Rows[rowIndex].Cells["colPromotionLink"].Value = shortLink;
else
dgvSelectProduct.Rows[rowIndex].Cells["colPromotionLink"].Value = shareUrl;
}));
}
else
{
Invoke(new Action(() =>
{
dgvSelectProduct.Rows[rowIndex].Cells["colPromotionLink"].Value = "链接获取失败";
}));
}
}
else
{
var errMsg = BaseRegex.GetStringJsonByRegs(ref PromotionRst, PromotionRst, "errMsg", "errorMsg", "err_msg", "error_msg", "errormsg");
Invoke(new Action(() =>
{
dgvSelectProduct.Rows[rowIndex].Cells["colPromotionLink"].Value = errMsg;
}));
}
});
tList.Add(t);
while (tList.Count >= 5)
{
Thread.Sleep(200);
tList.RemoveAll(ta => ta.IsFaulted || ta.IsCanceled || ta.IsCompleted);
}
}
}
while (tList.Count > 0)
{
@@ -1143,11 +1037,6 @@ namespace TemuKJD.WXForms.ProductForms
{
OnSaleStatus = cmbOnSaleStatus.Text;
}
private void chkSearchPromotionLink_CheckedChanged(object sender, EventArgs e)
{
this.dgvSelectProduct.Columns["colPromotionLink"].Visible = chkSearchPromotionLink.Checked;
}
private void chkProdTime_CheckedChanged(object sender, EventArgs e)
{
@@ -1181,120 +1070,4 @@ namespace TemuKJD.WXForms.ProductForms
txtFilterProductName.Text = txtFilterProductId.Text = "";
}
}
public class WXNoCheckEdit
{
/// <summary>
/// -1 全部 5 在售 11 下架
/// </summary>
/// <param name="status">-1 全部 5 在售 11 下架</param>
/// <returns></returns>
public static string searchProduct(ShopLoginInfo shop, int pageNum, int? presaleType = null, int pageSize = 50, int? sortType = null, int status = 5)
{
//https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?token=&lang=zh_CN&pageSize=20&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=44&status[]=5&presaleType[]=1
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?token=&lang=zh_CN&" +
"pageSize=" + pageSize + "&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=" + pageNum + "&status[]=" + status;
if (presaleType != null)
url += "&presaleType[]=" + presaleType;
if (sortType != null)
url += "&sortType=" + sortType;
string refere = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON";
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, refere);
return result;
}
/// <summary>
/// -1全部 5在售 11下架 1草稿箱 3审核待处理 6回收站
/// </summary>
/// <param name="saleStatus">-1 全部 5在售 11下架 1草稿箱 3审核待处理 6回收站</param>
/// <returns></returns>
public static string scanProductPreview(ShopLoginInfo shop, int page, string nextKey = "", int pageSize = 50, int saleStatus = 5)
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/scanProductPreview?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON";
if (page > 1)
referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON&currentPage=" + page;
//string body = @"{""pageSize"":20,""productStatus"":[-1],""productSource"":""[1,16,32]"",""searchSource"":1,""useNew"":true,""pageNum"":1,""status"":[5]}";
//string body = @"{""pageSize"":20,""productStatus"":[-1],""productSource"":""[1,16,32]"",""searchSource"":1,""useNew"":true,""pageNum"":2,""status"":[5],""nextKey"":""ChwItc+24YajAhCD14bMBhjqLiDoDCgAMITXhswGEhwIy8im34ajAhCa74XMBhiaXyDeBygAMJrvhcwGGAEgeiiIEw==""}";
//string body = @"{""pageSize"":" + pageSize + @",""productStatus"":[-1],""productSource"":""[1,16,32]"",""searchSource"":1,""useNew"":true,""pageNum"":" + page + @",""status"":[" + saleStatus + @"],""nextKey"":""" + nextKey + @"""}";
JObject bodyObj = new JObject();
bodyObj["pageSize"] = pageSize;
bodyObj["productStatus"] = new JArray() { -1 };
bodyObj["productSource"] = "[1,16,32]";
bodyObj["searchSource"] = 1;
bodyObj["useNew"] = true;
bodyObj["pageNum"] = page;
bodyObj["status"] = new JArray() { saleStatus };
if(!string.IsNullOrEmpty(nextKey))
{
bodyObj["nextKey"] = nextKey;
}
string body = JsonHelper.SerializeObject(bodyObj);
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
/// <summary>
/// 下架商品
/// </summary>
/// <param name="shop"></param>
/// <param name="prodId"></param>
/// <returns></returns>
public static string DownProd(ShopLoginInfo shop, string prodIds)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/BatchUnListing?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/list";
string body = @"{""ids"":[" + prodIds + @"],""uploadSource"":6}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
/// <summary>
/// 删除商品
/// </summary>
/// <param name="shop"></param>
/// <param name="prodId"></param>
/// <returns></returns>
public static string DelProd(ShopLoginInfo shop, string prodIds)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/batchDel?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/list";
string body = @"{""ids"":[" + prodIds + @"],""uploadSource"":6}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
/// <summary>
/// 彻底删除商品
/// </summary>
/// <param name="shop"></param>
/// <param name="prodId"></param>
/// <returns></returns>
public static string RealDelProd(ShopLoginInfo shop, string prodIds)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/batchRealDel?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_RECYCLE_BIN";
string body = @"{""ids"":[" + prodIds + @"],""uploadSource"":6}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
/// <summary>
/// 获取推广信息
/// </summary>
/// <param name="shop"></param>
/// <param name="prodId"></param>
/// <returns></returns>
public static string GetPromotionLink(ShopLoginInfo shop, string prodId, int pageId)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodematerial/product?token=&lang=zh_CN&productId=" + prodId;
string referer = "https://store.weixin.qq.com/shop/goods/list?currentPage=" + pageId;
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
return result;
}
}
}