店铺优化数据抓取 拼多多买手刷新订单逻辑优化

This commit is contained in:
wule_5900x committed 2026-04-26 01:30:31 +08:00
1 parent 0e6a927cf2
commit b5d8818485
14 files changed
+2492 -615

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@ namespace TemuKJD.WXForms.ShopForms
tv.SelectedNode = tv.Nodes[0].Nodes[0];
tv.ExpandGroup(tv.Nodes[0].Name);
List<string> hideName = new List<string>() { "店铺优化", "子账号管理", "高级运费模板", "运费模板", "素材库管理", "订单金额统计", "工作明细统计", "店铺经营统计1" };
List<string> hideName = new List<string>() { "店铺优化1", "子账号管理", "高级运费模板", "运费模板", "素材库管理", "订单金额统计", "工作明细统计", "店铺经营统计1" };
if (BaseClass.GroupId == 3)
{
File diff suppressed because it is too large. Load diff
+526 -19
View File
@@ -45,6 +45,8 @@ namespace TemuKJD.WXForms.ShopForms
ConcurrentList<WxOptimizeOrderAfterSaleInfo> lstWxOptimizeOrderAfterSaleInfo = new ConcurrentList<WxOptimizeOrderAfterSaleInfo>();
ConcurrentList<WxOptimizeProductEvaluationInfo> lstWxOptimizeProductEvaluationInfo = new ConcurrentList<WxOptimizeProductEvaluationInfo>();
ConcurrentList<WxOptimizeOrderWayBillInfo> lstWxOptimizeOrderWayBillInfo = new ConcurrentList<WxOptimizeOrderWayBillInfo>(); // 揽收
ConcurrentList<WxOptrimizeLinerCgiInfo> lstWxOptrimizeLinerCgiInfo = new ConcurrentList<WxOptrimizeLinerCgiInfo>(); // 物流
public WXShopOptimizeForm()
{
@@ -53,6 +55,8 @@ namespace TemuKJD.WXForms.ShopForms
private void UserSelectDbProductForm_Load(object sender, EventArgs e)
{
this.ucTabControl1.TabPages.RemoveAt(4);
dicCheckedShopId = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string, bool>>("wx_checked_shop_dic");
if (dicCheckedShopId == null)
dicCheckedShopId = new Dictionary<string, bool>();
@@ -63,6 +67,12 @@ namespace TemuKJD.WXForms.ShopForms
dgvData1.AddSelectorColumn("colDgv1Check");
dgvData1.AddImgColumn("colDgv1Img", "colDgv1ImgUrl");
dgvData2.AddSelectorColumn("colDgv2Check");
dgvData2.AddImgColumn("colDgv2Img", "colDgv2ImgUrl");
dgvData3.AddSelectorColumn("colCheck");
dgvData3.AddImgColumn("colImg", "colImgUrl");
dgvData4.AddSelectorColumn("colDgv4Check");
dgvData4.AddImgColumn("colDgv4Img", "colDgv4ImgUrl");
IsLoadComplate = true;
}
@@ -277,14 +287,12 @@ namespace TemuKJD.WXForms.ShopForms
}
}
private void dgvSelectProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
private void dgvData3_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvData3.Columns[e.ColumnIndex].HeaderText;
var dbId = dgvData3.Rows[e.RowIndex].Cells["colSelectId"].Value.ParseToString();
var shopId = dgvData3.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
var draftId = dgvData3.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString();
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
switch (headerText)
@@ -325,12 +333,6 @@ namespace TemuKJD.WXForms.ShopForms
imgFrom.ShowDialog();
break;
}
case "SKU替换图":
{
ShowImgForm imgFrom = new ShowImgForm(dgvData3.Rows[e.RowIndex].Cells["colSkuFakeImgUrl"].Value.ParseToString());
imgFrom.ShowDialog();
break;
}
case "":
dgvData3.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvData3.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
@@ -473,30 +475,80 @@ namespace TemuKJD.WXForms.ShopForms
}
btnSearch.Enabled = false;
pictureBox1.Visible = true;
cancellationTokenSource = new CancellationTokenSource();
dgvData1.Rows.Clear();
lstWxOptimizeOrderAfterSaleInfo.Clear();
if (ucCheckBox1.Checked)
{
pictureBox1.Visible = true;
dgvData1.Rows.Clear();
lstWxOptimizeOrderAfterSaleInfo.Clear();
}
if (ucCheckBox2.Checked)
{
pictureBox2.Visible = true;
dgvData2.Rows.Clear();
lstWxOptimizeProductEvaluationInfo.Clear();
}
if (ucCheckBox3.Checked)
{
pictureBox3.Visible = true;
dgvData3.Rows.Clear();
lstWxOptimizeOrderWayBillInfo.Clear();
}
if (ucCheckBox4.Checked)
{
pictureBox4.Visible = true;
dgvData4.Rows.Clear();
lstWxOptrimizeLinerCgiInfo.Clear();
}
Task.Run(() =>
{
List<ShopLoginInfo> shopLst = GlobalConfig.ShopLoginList.Where(s => lstShopId.Contains(s.ShopId)).ToList();
foreach (var shop in shopLst)
{
SearchData1(shop);
if (cancellationTokenSource.IsCancellationRequested)
break;
if (ucCheckBox1.Checked)
{
SearchData1(shop);
Thread.Sleep(Randomx.GetId(200, 500));
}
if (ucCheckBox2.Checked)
{
SearchData2(shop);
Thread.Sleep(Randomx.GetId(200, 500));
}
if (ucCheckBox3.Checked)
{
SearchData3WayBill(shop);
Thread.Sleep(Randomx.GetId(200, 500));
}
if (ucCheckBox4.Checked)
{
SearchData4(shop);
Thread.Sleep(Randomx.GetId(200, 500));
}
}
Invoke(new Action(() =>
{
if (cancellationTokenSource.IsCancellationRequested)
{
this.statusBar.lblTaskStatus.Text = "品质退款查询完毕 " + this.statusBar.lblTaskStatus.Text;
BaseMsgForm.ShowInfo("品质退款查询完毕");
//this.statusBar.lblTaskStatus.Text = "品质退款查询完毕 " + this.statusBar.lblTaskStatus.Text;
//BaseMsgForm.ShowInfo("品质退款查询完毕");
this.statusBar.lblTaskStatus.Text = "优化数据查询中断 " + this.statusBar.lblTaskStatus.Text;
BaseMsgForm.ShowInfo("优化数据查询中断");
}
else
{
this.statusBar.lblTaskStatus.Text = "品质退款查询完毕";
BaseMsgForm.ShowInfo("品质退款查询完毕");
//this.statusBar.lblTaskStatus.Text = "品质退款查询完毕";
//BaseMsgForm.ShowInfo("品质退款查询完毕");
this.statusBar.lblTaskStatus.Text = "优化数据查询完毕";
BaseMsgForm.ShowInfo("优化数据查询完毕");
}
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
btnSearch.Enabled = true;
}));
}, cancellationTokenSource.Token).ContinueWith(delegate
@@ -514,7 +566,7 @@ namespace TemuKJD.WXForms.ShopForms
int page = 0;
int totalPage = 1;
int pageSize = 50;
int pageSize = 20;
int startTime = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date.AddDays(-30));
int endTime = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date) - 1;
while (page < totalPage)
@@ -561,7 +613,7 @@ namespace TemuKJD.WXForms.ShopForms
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.pictureBox1.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在查询品质退款,店铺:" + shop.ShopAccount + " " + page + "/" + totalPage;
}));
foreach (JObject refundOrderObj in prodObjs["data"])
@@ -608,10 +660,414 @@ namespace TemuKJD.WXForms.ShopForms
}
}
public void SearchData2(ShopLoginInfo shop)
{
if (shop.LoginStatus != "登录成功")
{
return;
}
int page = 0;
int totalPage = 1;
int pageSize = 50;
int startTime = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date.AddDays(-30));
int endTime = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date) - 1;
while (page < totalPage)
{
page++;
if (cancellationTokenSource.IsCancellationRequested)
break;
var getData2 = ShopOptimize.GetProductEvaluation(shop, page, startTime, endTime);
Thread.Sleep(Randomx.GetId(300, 600));
if (!getData2.Contains("\"code\":0"))
{
var error = BaseRegex.GetStringJson(ref getData2, "msg");
if (string.IsNullOrEmpty(error))
error = getData2;
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus != "登录成功")
{
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
Invoke(new Action(() => { BindShop(shop, shopIdLst, "店铺掉线"); }));
}
else
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = error;
}));
}
break;
}
try
{
var prodObjs = JsonHelper.JObjectParse(getData2);
if (page == 1)
{
var totalNum = prodObjs["totalCnt"].ParseToInt();
totalPage = Math.Ceiling(1m * totalNum / pageSize).ParseToInt();
}
Invoke(new Action(() =>
{
this.pictureBox2.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在查询商品差评,店铺:" + shop.ShopAccount + " " + page + "/" + totalPage;
}));
if (totalPage == 0)
break;
foreach (JObject refundOrderObj in prodObjs["finderProductEvaluationInfoList"])
{
var oStr = JsonHelper.SerializeObject(refundOrderObj);
var prodEvaluationInfo = JsonHelper.DeserializeJsonToObject<WxOptimizeProductEvaluationInfo>(oStr);
if (lstWxOptimizeProductEvaluationInfo.Any(o => o.productEvaluationId == prodEvaluationInfo.productEvaluationId))
continue;
prodEvaluationInfo.shopId = shop.ShopId;
prodEvaluationInfo.shopName = shop.ShopAccount;
lstWxOptimizeProductEvaluationInfo.Add(prodEvaluationInfo);
var lblLst = prodEvaluationInfo.evaluationInfo?.firstEvaluationInfo?.buyerEvaluationInfo?.labelList;
var content = prodEvaluationInfo.evaluationInfo.firstEvaluationInfo.buyerEvaluationInfo.content + " " +
prodEvaluationInfo.evaluationInfo.firstEvaluationInfo.buyerEvaluationInfo.defaultContent;
Invoke(new Action(() =>
{
var rowIndex = this.dgvData2.Rows.Add(
false,
shop.ShopId,
shop.ShopAccount,
"登录",
"进店",
prodEvaluationInfo.productInfo.imgUrl,
DataGridViewExtension.defaultBitmap,
prodEvaluationInfo.productInfo.productId,
prodEvaluationInfo.productInfo.spuName,
prodEvaluationInfo.productInfo.skuName,
"", //spuCode 此处获取不到填空
prodEvaluationInfo.productEvaluationId,
prodEvaluationInfo.evaluationInfo.buyer.identity.nickname,
BaseClass.StampToDateTime(prodEvaluationInfo.evaluationInfo.firstEvaluationInfo.buyerEvaluationInfo.createTime.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"),
(content + " " + (lblLst == null ? "" : string.Join(" ", lblLst.Select(e => e.labelName)))).Trim()
);
dgvData2.Rows[rowIndex].Height = 60;
}));
}
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = ex.Message;
}));
}
}
}
public void SearchData3WayBill(ShopLoginInfo shop)
{
if (shop.LoginStatus != "登录成功")
{
return;
}
bool is24 = false;
var is24Rst = ShopOptimize.Get24H48HFlag(shop); // if_24hOr_48hFlag
if (!is24Rst.Contains("\"code\":0") || BaseRegex.GetStringJson(ref is24Rst, "if_24hOr_48hFlag").IsNullOrEmpty())
{
var error = BaseRegex.GetStringJson(ref is24Rst, "msg");
if (string.IsNullOrEmpty(error))
error = is24Rst;
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus != "登录成功")
{
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
Invoke(new Action(() => { BindShop(shop, shopIdLst, "店铺掉线"); }));
}
else
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = "获取物流时效失败" + error;
}));
}
return;
}
is24 = BaseRegex.GetStringJson(ref is24Rst, "if_24hOr_48hFlag") == "1";
int page = 0;
int totalPage = 1;
int pageSize = 20;
int startTime = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date.AddDays(-30));
int endTime = BaseClass.DateTimeToTimestampSeconds(DateTime.Now.Date) - 1;
while (page < totalPage)
{
page++;
if (cancellationTokenSource.IsCancellationRequested)
break;
var getData3WayBill = ShopOptimize.GetProductOrderWayBill(shop, page, startTime, endTime, is24);
Thread.Sleep(Randomx.GetId(300, 600));
if (!getData3WayBill.Contains("\"code\":0"))
{
var error = BaseRegex.GetStringJson(ref getData3WayBill, "msg");
if (string.IsNullOrEmpty(error))
error = getData3WayBill;
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus != "登录成功")
{
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
Invoke(new Action(() => { BindShop(shop, shopIdLst, "店铺掉线"); }));
}
else
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = error;
}));
}
break;
}
try
{
var wayBillObjs = JsonHelper.JObjectParse(getData3WayBill);
if (page == 1)
{
var totalNum = wayBillObjs["total"].ParseToInt();
totalPage = Math.Ceiling(1m * totalNum / pageSize).ParseToInt();
}
Invoke(new Action(() =>
{
this.pictureBox3.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在查询揽收不达标,店铺:" + shop.ShopAccount + " " + page + "/" + totalPage;
}));
foreach (JObject refundOrderObj in wayBillObjs["data"])
{
var oStr = JsonHelper.SerializeObject(refundOrderObj);
var orderWayBill = JsonHelper.DeserializeJsonToObject<WxOptimizeOrderWayBillInfo>(oStr);
if (lstWxOptimizeOrderWayBillInfo.Any(o => o.orderInfo.orderId == orderWayBill.orderInfo.orderId))
continue;
orderWayBill.shopId = shop.ShopId;
orderWayBill.shopName = shop.ShopAccount;
// 24小时揽收率截至第二天
if (is24 && BaseClass.StampToDateTime(orderWayBill.realPickupTime.ParseToInt()).Date <= BaseClass.StampToDateTime(orderWayBill.payTime.ParseToInt()).Date.AddDays(1))
continue;
// 48小时揽收率按48小时算
if (!is24 && BaseClass.StampToDateTime(orderWayBill.realPickupTime.ParseToInt()) <= BaseClass.StampToDateTime(orderWayBill.payTime.ParseToInt()).AddDays(2))
continue;
lstWxOptimizeOrderWayBillInfo.Add(orderWayBill);
Invoke(new Action(() =>
{
var rowIndex = this.dgvData3.Rows.Add(
false,
shop.ShopId,
shop.ShopAccount,
"登录",
"进店",
orderWayBill.orderInfo.imgUrl,
DataGridViewExtension.defaultBitmap,
orderWayBill.orderInfo.spuId,
orderWayBill.orderInfo.name,
orderWayBill.orderInfo.skuName + " x" + orderWayBill.orderInfo.productCnt,
orderWayBill.orderInfo.skuCode,
orderWayBill.orderInfo.orderId + "\r\n" + orderWayBill.waybillId,
orderWayBill.delivery.deliveryName,
BaseClass.StampToDateTime(orderWayBill.payTime.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"),
BaseClass.StampToDateTime(orderWayBill.realPickupTime.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"),
(BaseClass.StampToDateTime(orderWayBill.realPickupTime.ParseToInt()) -
BaseClass.StampToDateTime(orderWayBill.payTime.ParseToInt())).TotalHours.ToString("f2") + "小时" + "\r\n[" + (is24 ? "次日" : "48小时") + "]"
);
dgvData3.Rows[rowIndex].Height = 60;
}));
}
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = ex.Message;
}));
}
}
}
public void SearchData4(ShopLoginInfo shop)
{
if (shop.LoginStatus != "登录成功")
{
return;
}
bool is24 = false;
var is24Rst = ShopOptimize.Get24H48HFlag(shop); // if_24hOr_48hFlag
if (!is24Rst.Contains("\"code\":0") || BaseRegex.GetStringJson(ref is24Rst, "if_24hOr_48hFlag").IsNullOrEmpty())
{
var error = BaseRegex.GetStringJson(ref is24Rst, "msg");
if (string.IsNullOrEmpty(error))
error = is24Rst;
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus != "登录成功")
{
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
Invoke(new Action(() => { BindShop(shop, shopIdLst, "店铺掉线"); }));
}
else
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = "获取物流时效失败" + error;
}));
}
return;
}
is24 = BaseRegex.GetStringJson(ref is24Rst, "if_24hOr_48hFlag") == "1";
int page = 0;
int totalPage = 1;
int pageSize = 20;
long startTime = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddDays(-30));
long endTime = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now);
while (page < totalPage)
{
page++;
if (cancellationTokenSource.IsCancellationRequested)
break;
var getData4 = ShopOptimize.GetOrderLinerCgi(shop, page, startTime, endTime, is24);
Thread.Sleep(Randomx.GetId(300, 600));
if (!getData4.Contains("\"code\":0"))
{
var error = BaseRegex.GetStringJson(ref getData4, "msg");
if (string.IsNullOrEmpty(error))
error = getData4;
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
if (shop.LoginStatus != "登录成功")
{
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
Invoke(new Action(() => { BindShop(shop, shopIdLst, "店铺掉线"); }));
}
else
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = error;
}));
}
break;
}
try
{
var wayBillObjs = JsonHelper.JObjectParse(getData4);
if (page == 1)
{
var totalNum = wayBillObjs["total"].ParseToInt();
totalPage = Math.Ceiling(1m * totalNum / pageSize).ParseToInt();
}
Invoke(new Action(() =>
{
this.pictureBox4.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在查询揽收不达标,店铺:" + shop.ShopAccount + " " + page + "/" + totalPage;
}));
foreach (JObject refundOrderObj in wayBillObjs["list"])
{
var oStr = JsonHelper.SerializeObject(refundOrderObj);
var orderLinerCgiInfo = JsonHelper.DeserializeJsonToObject<WxOptrimizeLinerCgiInfo>(oStr);
if (lstWxOptrimizeLinerCgiInfo.Any(o => o.order_id == orderLinerCgiInfo.order_id))
continue;
orderLinerCgiInfo.shopId = shop.ShopId;
orderLinerCgiInfo.shopName = shop.ShopAccount;
//// 24小时揽收率截至第二天
//if (is24 && BaseClass.StampToDateTime(orderLinerCgiInfo.realPickupTime.ParseToInt()).Date <= BaseClass.StampToDateTime(orderLinerCgiInfo.payTime.ParseToInt()).Date.AddDays(1))
// continue;
//// 48小时揽收率按48小时算
//if (!is24 && BaseClass.StampToDateTime(orderLinerCgiInfo.realPickupTime.ParseToInt()) <= BaseClass.StampToDateTime(orderLinerCgiInfo.payTime.ParseToInt()).AddDays(2))
// continue;
lstWxOptrimizeLinerCgiInfo.Add(orderLinerCgiInfo);
Invoke(new Action(() =>
{
var rowIndex = this.dgvData4.Rows.Add(
false,
shop.ShopId,
shop.ShopAccount,
"登录",
"进店",
orderLinerCgiInfo.product_list.FirstOrDefault().head_img_url,
DataGridViewExtension.defaultBitmap,
string.Join("\r\n", orderLinerCgiInfo.product_list.Select(p => p.product_id)),
string.Join("\r\n", orderLinerCgiInfo.product_list.Select(p => p.title)),
string.Join("\r\n", orderLinerCgiInfo.product_list.Select(p => "x" + p.product_count)),
"", //skuCode不展示
orderLinerCgiInfo.order_id + "\r\n" + orderLinerCgiInfo.waybill_id,
orderLinerCgiInfo.delivery_name,
BaseClass.StampToDateTime(orderLinerCgiInfo.collect_time.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss") + "\r\n" + BaseClass.StampToDateTime(orderLinerCgiInfo.receipt_time.ParseToInt()).ToString("yyyy-MM-dd HH:mm:ss"),
"发货地:" + orderLinerCgiInfo.ship_city + "\r\n" + "收货地:" + orderLinerCgiInfo.ship_province + orderLinerCgiInfo.receipt_city,
(orderLinerCgiInfo.transport_duration.ParseToInt() / 3600) + "小时" + (orderLinerCgiInfo.transport_duration.ParseToInt() % 3600) / 60 + "分" +
"\r\n标准时长" + (orderLinerCgiInfo.transport_std_duration.ParseToInt() / 3600) + "小时" /*+ (orderLinerCgiInfo.transport_std_duration.ParseToInt() % 3600)*/
);
dgvData4.Rows[rowIndex].Height = 60;
}));
}
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
var shopRow = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow != null)
shopRow.Cells["colMessage"].Value = ex.Message;
}));
}
}
}
private void dgvData1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void btnCancel_Click(object sender, EventArgs e)
{
if (this.cancellationTokenSource != null)
cancellationTokenSource.Cancel();
}
}
public static class ShopOptimize
@@ -624,5 +1080,56 @@ namespace TemuKJD.WXForms.ShopForms
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
/// <summary>
/// 商品评价
/// </summary>
/// <param name="shop"></param>
/// <param name="pageId"></param>
/// <param name="beginTick"></param>
/// <param name="endTick"></param>
/// <returns></returns>
public static string GetProductEvaluation(ShopLoginInfo shop, int pageId, int beginTick, int endTick)
{
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeevaluation/cgi/search?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/evaluate/home";
string body = @"{""orderId"":"""",""productId"":"""",""productEvaluationId"":"""",""buyerEvaluationTimeStart"":" + beginTick + @",""buyerEvaluationTimeEnd"":" + endTick +
@",""status"":2,""page"":" + pageId + @",""visibleType"":0}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string Get24H48HFlag(ShopLoginInfo shop)
{
string url = "https://store.weixin.qq.com/shop-faas/statistic/cgi/search?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/setting/rate2";
string body = "{\"days\":14,\"scoreTypeList\":[63,1000]}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string GetProductOrderWayBill(ShopLoginInfo shop, int pageId, int beginTick, int endTick, bool is24 = false)
{
string url = "https://store.weixin.qq.com/shop-faas/statistic/dsr/logistics/pickup/insale?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/setting/ratedetail?type=logistics&key=collectIn_48hOrdRatio_30d&valid=collectIn_48hOrdRatio_30d|waybillArriveOntimeRatio_30d|waybillNegtiveOrdRatio_30d&detail=insale";
if (is24)
referer = "https://store.weixin.qq.com/shop/setting/ratedetail?type=logistics&key=collectIn_24hOrdRatio_30d&valid=collectIn_24hOrdRatio_30d|waybillArriveOntimeRatio_30d|waybillNegtiveOrdRatio_30d&detail=insale";
string body = @"{""page"":" + pageId + @",""pageSize"":20,""beginTs"":" + beginTick + @",""endTs"":" + endTick + @"}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
public static string GetOrderLinerCgi(ShopLoginInfo shop, int pageId, long beginTick, long endTick, bool is24 = false)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodelinercgi/cgi/liner/query?token=&lang=zh_CN";
string referer = "https://store.weixin.qq.com/shop/setting/ratedetail?type=logistics&key=waybillArriveOntimeRatio_30d&valid=collectIn_48hOrdRatio_30d|waybillArriveOntimeRatio_30d|waybillNegtiveOrdRatio_30d";
if (is24)
referer = "https://store.weixin.qq.com/shop/setting/ratedetail?type=logistics&key=waybillArriveOntimeRatio_30d&valid=collectIn_24hOrdRatio_30d|waybillArriveOntimeRatio_30d|waybillNegtiveOrdRatio_30d";
string body = @"{""time_query"":{""dateFormat"":2,""dateType"":0,""dateRange"":30,""startMs"":" + endTick + @",""endMs"":" + endTick +
@"},""limit"":10,""offset"":" + (Math.Max(0, pageId - 1) * 10) + @",""id"":""ratedetail-wuliu-route-order-table"",""biz"":""store"",""is_std"":""0"",""sort"":[""std_route_rate"",""desc""]}";
var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer);
return result;
}
}
}
+100 -28
View File
@@ -195,6 +195,51 @@
<metadata name="colDgv1AfterSaleReason.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2Check.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2ShopId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2ShopName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2Login.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2InShop.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2ImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2Img.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2SpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2ProductName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2Spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2SkuCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2EvaluationId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2UserNick.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2CommentTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv2CommentContent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -210,58 +255,85 @@
<metadata name="colInShop.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDraftId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductSkcPic.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSkuFakeImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSkuFakeImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductCat.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colSpec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colExtCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSoldNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMsg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colUserNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colDeliveryName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColDelete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colPayTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colAddTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colTakeTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCouponNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colDuration.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOpResult.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colDgv4Check.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewLinkColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewLinkColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv4ImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv4Img.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn9.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn10.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDgv4Address.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn12.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>