其他平台买手拍单发送功能 店铺筛选功能逻辑优化
This commit is contained in:
1 parent
2dece676c1
commit
aa45b35145
46 files changed
+4038
-2223
No files matched your search
@@ -37,7 +37,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
int PageBegin = 1;
|
||||
int PageEnd = 1000;
|
||||
string PreType = "";
|
||||
string OnSaleStatus = "在售";
|
||||
|
||||
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
||||
@@ -45,13 +44,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
|
||||
bool isInit = false;
|
||||
CheckBox chkSelectAll = null;
|
||||
ConcurrentList<AuthInfo> lstShopAuthInfo = new ConcurrentList<AuthInfo>();
|
||||
ConcurrentList<WXShopTokenInfo> lstWXShopTokenInfo = new ConcurrentList<WXShopTokenInfo>();
|
||||
public NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstTemuDBProductSelect = new NaiBa.Util.ConcurrentList<TemuDBProductSelect>();
|
||||
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 Dictionary<string, bool> dicCheckedShopId = new Dictionary<string, bool>();
|
||||
public Dictionary<string, WxShopUploadInfo> dicShopUpload = new Dictionary<string, WxShopUploadInfo>();
|
||||
public WXProdClearNoVisitForm()
|
||||
@@ -63,49 +56,17 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
this.splitContainer1.Dock = DockStyle.Fill;
|
||||
|
||||
lstShopAuthInfo = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<AuthInfo>>("wx_shop_auth_list");
|
||||
if (lstShopAuthInfo == null)
|
||||
lstShopAuthInfo = new ConcurrentList<AuthInfo>();
|
||||
|
||||
lstWXShopTokenInfo = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<WXShopTokenInfo>>("wx_shop_token_list");
|
||||
if (lstWXShopTokenInfo == null)
|
||||
lstWXShopTokenInfo = new ConcurrentList<WXShopTokenInfo>();
|
||||
|
||||
lstTemuDBProductSelect = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<TemuDBProductSelect>>("wx_db_prod_upload_list");
|
||||
if (lstTemuDBProductSelect == null)
|
||||
lstTemuDBProductSelect = new NaiBa.Util.ConcurrentList<TemuDBProductSelect>();
|
||||
|
||||
lstAddPriceRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<NaiBa.Util.ConcurrentList<AddPriceRule>>("wx_add_price_rules");
|
||||
if (lstAddPriceRule == null)
|
||||
{
|
||||
lstAddPriceRule = new NaiBa.Util.ConcurrentList<AddPriceRule>();
|
||||
lstAddPriceRule.Add(new AddPriceRule() { MoreThanPrice = 0, LessThanPrice = 10, AddPriceTimes = 2, AddMorePrice = 10, SinglePriceAdd = 1 });
|
||||
lstAddPriceRule.Add(new AddPriceRule() { MoreThanPrice = 10, LessThanPrice = 20, AddPriceTimes = 2, AddMorePrice = 10, SinglePriceAdd = 1 });
|
||||
lstAddPriceRule.Add(new AddPriceRule() { MoreThanPrice = 20, LessThanPrice = 999, AddPriceTimes = 2, AddMorePrice = 10, SinglePriceAdd = 1 });
|
||||
}
|
||||
|
||||
dicCheckedShopId = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string, bool>>("wx_checked_shop_dic");
|
||||
if (dicCheckedShopId == null)
|
||||
dicCheckedShopId = new Dictionary<string, bool>();
|
||||
dicShopUpload = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string, WxShopUploadInfo>>("wx_shop_upload_info");
|
||||
if (dicShopUpload == null)
|
||||
dicShopUpload = new Dictionary<string, WxShopUploadInfo>();
|
||||
|
||||
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 };
|
||||
}
|
||||
|
||||
wxUploadRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<WXUploadRule>("wx_upload_rule");
|
||||
if (wxUploadRule == null)
|
||||
wxUploadRule = new WXUploadRule();
|
||||
|
||||
chkSelectAll = dgvShop.Columns["colSelect"].AddHeaderCheckBox(HorizontalAlignment.Center, 0, 0, null, null, false);
|
||||
dgvShop.Columns["colSelect"].HeaderText = "";
|
||||
//chkSelectAll.Width = chkSelectAll.Height = 13;
|
||||
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
|
||||
//chkSelectAll.Checked = true;
|
||||
|
||||
this.dgvSelectProduct.AddSelectorColumn("colCheck");
|
||||
|
||||
@@ -114,139 +75,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
|
||||
dgvSelectProduct.Columns["colSkuFakeImg"].Visible = false;
|
||||
|
||||
//foreach (var selectProd in upload_draft_product_lst)
|
||||
//{
|
||||
// int rowIndex = 0;
|
||||
// this.dgvSelectProduct.Rows.Insert(rowIndex,
|
||||
// true,
|
||||
// selectProd.id,
|
||||
// selectProd.shop_id,
|
||||
// selectProd.shop_account,
|
||||
// "登录",
|
||||
// "进店",
|
||||
// BaseClass.SaLevel > 0 ? selectProd.spu_id : selectProd.spu_id.ParseToString().GetHashCode().ParseToString().Trim('-'),
|
||||
// selectProd.skc_id,
|
||||
// selectProd.main_img,
|
||||
// DataGridViewExtension.defaultBitmap,
|
||||
// "",
|
||||
// null,
|
||||
// selectProd.product_name, // 用户端显示商品原名
|
||||
// selectProd.cat_name,
|
||||
// BaseClass.SaLevel > 0 ? selectProd.ext_code : selectProd.ext_code.ParseToString().GetHashCode().ParseToString().Trim('-'),
|
||||
// selectProd.status,
|
||||
// selectProd.draft_id,
|
||||
// selectProd.notes,
|
||||
// (selectProd.user_notes + " 编辑").Trim(),
|
||||
// "删除",
|
||||
// selectProd.add_time.ToString("yy-MM-dd HH:mm:ss"),
|
||||
// "");
|
||||
|
||||
// dgvSelectProduct.Rows[rowIndex].Height = 60;
|
||||
|
||||
// int maxRowCount = 10000;
|
||||
// while (dgvSelectProduct.Rows.Count > maxRowCount)
|
||||
// {
|
||||
// dgvSelectProduct.Rows.RemoveAt(maxRowCount);
|
||||
// }
|
||||
//}
|
||||
|
||||
//#if DEBUG
|
||||
if (BaseClass.SaLevel == 1)
|
||||
{
|
||||
//txtIdFilter.Visible = true;
|
||||
//txtExtCodeFilter.Visible = true;
|
||||
//lblIdFilter.Visible = true;
|
||||
//lblExtCodeFilter.Visible = true;
|
||||
}
|
||||
//#endif
|
||||
IsLoadComplate = true;
|
||||
}
|
||||
|
||||
private void btnRefreshAuthor_Click(object sender, EventArgs e)
|
||||
{
|
||||
updateAuthor(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 升级授权
|
||||
/// </summary>
|
||||
/// <param name="idRefreshTodayHasGet">今日取过的也取</param>
|
||||
private void updateAuthor(bool idRefreshTodayHasGet = false)
|
||||
{
|
||||
this.pbLoadingShop.Visible = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
// 店铺Id
|
||||
var updateIds = dgvShop.Rows.Cast<DataGridViewRow>().Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
if (idRefreshTodayHasGet == true)
|
||||
updateIds = selectIds;
|
||||
|
||||
List<Task> tList = new List<Task>();
|
||||
if (idRefreshTodayHasGet)
|
||||
lstShopAuthInfo.RemoveAll(s => updateIds.Contains(s.ShopId));
|
||||
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => updateIds.Contains(s.ShopId)))
|
||||
{
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, ""); }));
|
||||
var t = Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "店铺掉线"); }));
|
||||
return;
|
||||
}
|
||||
|
||||
var authInfo = lstShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shop.ShopId);
|
||||
if (idRefreshTodayHasGet || authInfo == null || authInfo?.UpdateTime.Date != DateTime.Now.Date)
|
||||
{
|
||||
lstShopAuthInfo.RemoveAll(sa => sa.ShopId == shop.ShopId);
|
||||
var rst = WXUpload.GetApiServiceList(shop);
|
||||
if (!rst.Contains("\"code\":0"))
|
||||
{
|
||||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "店铺掉线"); }));
|
||||
return;
|
||||
}
|
||||
|
||||
lstShopAuthInfo.Add(new AuthInfo() { ShopId = shop.ShopId, UpdateTime = DateTime.Now, ExpiresTime = DateTime.Now });
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "授权查询失败"); }));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var itemObj in JsonHelper.JObjectParse(rst)["itemList"])
|
||||
{
|
||||
// 找到了指定服务
|
||||
if (itemObj["serviceName"].ParseToString() == "店统领供应链-商品管理")
|
||||
{
|
||||
var expiresTick = itemObj["expireTime"].ParseToLong();
|
||||
lstShopAuthInfo.Add(new AuthInfo() { ShopId = shop.ShopId, UpdateTime = DateTime.Now, ExpiresTime = BaseClass.StampToDateTime(expiresTick.ParseToInt()) });
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "已查询"); }));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 没找到指定服务
|
||||
lstShopAuthInfo.Add(new AuthInfo() { ShopId = shop.ShopId, UpdateTime = DateTime.Now, ExpiresTime = DateTime.Now });
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "已查询"); }));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
});
|
||||
tList.Add(t);
|
||||
while (tList.Where(ta => !ta.IsFaulted && !ta.IsCompleted).Count() >= 20) { Thread.Sleep(100); }
|
||||
}
|
||||
while (tList.Where(ta => !ta.IsFaulted && !ta.IsCompleted).Count() >= 1) { Thread.Sleep(100); }
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_shop_auth_list", lstShopAuthInfo);
|
||||
Invoke(new Action(() => { pbLoadingShop.Visible = false; }));
|
||||
});
|
||||
}
|
||||
|
||||
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!chkSelectAll.Checked)
|
||||
@@ -278,6 +109,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
pbLoadingShop.Visible = true;
|
||||
RefreshShopLogin();
|
||||
pbLoadingShop.Visible = false;
|
||||
}
|
||||
|
||||
private void UserSelectDbProductForm_VisibleChanged(object sender, EventArgs e)
|
||||
@@ -285,7 +117,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (Visible == true)
|
||||
{
|
||||
RefreshShopLogin();
|
||||
updateAuthor();
|
||||
//updateAuthor();
|
||||
|
||||
if (!isInit)
|
||||
{
|
||||
@@ -330,11 +162,15 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
BindShop(shopEntity, selectIds);
|
||||
}
|
||||
cmbFilterShopNotes.Items.Clear();
|
||||
//cmbFilterShopNotes.Items.Add("");
|
||||
foreach (var note in GlobalConfig.ShopLoginList.Select(s => s.Notes).Where(s => !s.IsNullOrEmpty()).Distinct())
|
||||
{
|
||||
cmbFilterShopNotes.Items.Add(note);
|
||||
}
|
||||
cmbFilterShopGroup.Items.Clear();
|
||||
foreach (var note in GlobalConfig.ShopLoginList.Select(s => s.GroupName).Where(s => !s.IsNullOrEmpty()).Distinct())
|
||||
{
|
||||
cmbFilterShopGroup.Items.Add(note);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindShop(ShopLoginInfo shopEntity, List<string> selectShopId = null, string msg = "")
|
||||
@@ -359,9 +195,10 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.Notes,
|
||||
shopEntity.GroupName,
|
||||
"选择商品",
|
||||
canUse ? "在线" : "掉线",
|
||||
lstShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期",
|
||||
GlobalConfig.lstWxShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期",
|
||||
canUse,
|
||||
dicShopUpload.ContainsKey(shopEntity.ShopId) && dicShopUpload[shopEntity.ShopId].DicDayUploadCount.ContainsKey(day) ?
|
||||
dicShopUpload[shopEntity.ShopId].DicDayUploadCount[day] : 0,
|
||||
@@ -379,10 +216,11 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
|
||||
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colShopNotes"].Value = shopEntity.Notes;
|
||||
row.Cells["colGroup"].Value = shopEntity.GroupName;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
row.Cells["colLoginStatus"].Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colApi"].Value = lstShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期";
|
||||
row.Cells["colApi"].Value = GlobalConfig.lstWxShopAuthInfo.FirstOrDefault(sa => sa.ShopId == shopEntity.ShopId)?.ExpiresTime > DateTime.Now.AddMinutes(5) ? "可用" : "过期";
|
||||
row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining;
|
||||
row.Cells["colUploadCount"].Value = dicShopUpload.ContainsKey(shopEntity.ShopId) && dicShopUpload[shopEntity.ShopId].DicDayUploadCount.ContainsKey(day) ?
|
||||
dicShopUpload[shopEntity.ShopId].DicDayUploadCount[day] : 0;
|
||||
@@ -495,7 +333,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
return;
|
||||
string headerText = dgvSelectProduct.Columns[e.ColumnIndex].HeaderText;
|
||||
var dbId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSelectId"].Value.ParseToString();
|
||||
var dbProduct = lstTemuDBProductSelect.FirstOrDefault(p => p.id.ToString() == dbId);
|
||||
var shopId = dgvSelectProduct.Rows[e.RowIndex].Cells["colSupplierId"].Value.ParseToString();
|
||||
var draftId = dgvSelectProduct.Rows[e.RowIndex].Cells["colDraftId"].Value.ParseToString();
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||||
@@ -532,17 +369,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "上传商品Id":
|
||||
//if (!string.IsNullOrEmpty(draftId) && shop != null)
|
||||
//{
|
||||
// ShopLoginForm shopLoginForm = new ShopLoginForm(shop);
|
||||
// shopLoginForm.InitUrl = "https://seller.kuajingmaihuo.com/goods/product-create/product-edit?productDraftId=" +
|
||||
// draftId + "&from=productDraftList";
|
||||
// shopLoginForm.openType = EnumOpenType.manage;
|
||||
// shopLoginForm.WindowState = FormWindowState.Maximized;
|
||||
// shopLoginForm.ShowDialog();
|
||||
//}
|
||||
break;
|
||||
case "图片":
|
||||
{
|
||||
ShowImgForm imgFrom = new ShowImgForm(dgvSelectProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString());
|
||||
@@ -575,7 +401,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
if (shopIdLst.Count <= 0)
|
||||
{
|
||||
BaseMsgForm.ShowError("未勾选上传店铺!");
|
||||
BaseMsgForm.ShowError("未勾选查询店铺!");
|
||||
return;
|
||||
}
|
||||
btnSearchProd.Enabled = false;
|
||||
@@ -627,15 +453,17 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (rb7.Checked)
|
||||
{
|
||||
endMs = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date) - 1;
|
||||
startMs = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddDays(-30));
|
||||
startMs = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddDays(-7));
|
||||
dateRange = 7;
|
||||
}
|
||||
var result = WxPlatformRecommendProdManage.getPlatformRecommend(shop, startMs, endMs, page, dateRange);
|
||||
pageSize = 10;
|
||||
var result = WxPlatformRecommendProdManage.getPlatformRecommend(shop, startMs, endMs, page, pageSize, dateRange);
|
||||
if (!result.Contains("\"code\":0"))
|
||||
{
|
||||
ShowShopError(shop, result);
|
||||
break;
|
||||
}
|
||||
totalPage = Math.Ceiling(BaseRegex.GetIntJson(ref result, "list_total") * 1m / pageSize).ParseToInt();
|
||||
List<WXPlatformRecommendProdInfo> recommendProds = new List<WXPlatformRecommendProdInfo>();
|
||||
try
|
||||
{
|
||||
@@ -663,7 +491,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
else if (OnSaleStatus == "回收站")
|
||||
onSaleStatusCode = 6;
|
||||
|
||||
getProdOnSaleRst = WXClearNoVisit.searchProduct(shop, page, pageSize, "", onSaleStatusCode);
|
||||
pageSize = 20;
|
||||
string spuIds = string.Join(",", recommendProds.Select(s => s.product_id).ToList());
|
||||
getProdOnSaleRst = WXClearNoVisit.searchProduct(shop, 1, pageSize, spuIds, onSaleStatusCode);
|
||||
Thread.Sleep(Randomx.GetId(50, 100));
|
||||
if (!getProdOnSaleRst.Contains("\"success\":true"))
|
||||
{
|
||||
@@ -674,18 +504,17 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
try
|
||||
{
|
||||
var prodObjs = JsonHelper.JObjectParse(getProdOnSaleRst);
|
||||
if (page == 1 || 1 == 1)
|
||||
{
|
||||
var totalNum = prodObjs["totalNum"].ParseToInt();
|
||||
totalPage = Math.Ceiling(1m * totalNum / pageSize).ParseToInt();
|
||||
}
|
||||
nextKey = prodObjs["nextKey"].ParseToString();
|
||||
// 按商品id查询不需要
|
||||
//if (page == 1 || 1 == 1)
|
||||
//{
|
||||
// var totalNum = prodObjs["totalNum"].ParseToInt();
|
||||
// totalPage = Math.Ceiling(1m * totalNum / pageSize).ParseToInt();
|
||||
//}
|
||||
//nextKey = prodObjs["nextKey"].ParseToString();
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.pbLoading.Visible = true;
|
||||
this.statusBar.lblTaskStatus.Text = "正在查询店铺:" + shop.ShopAccount + " " + page + "/" + Math.Min(PageEnd, totalPage);
|
||||
//this.statusBar.pgbTaskProgress.Maximum = lstTemuDBProductSelect.Count;
|
||||
//this.statusBar.UpdateProgressBar(0);
|
||||
}));
|
||||
foreach (JObject prod in prodObjs["productList"])
|
||||
{
|
||||
@@ -717,6 +546,11 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
var Limit2 = BaseRegex.GetStringJson(ref pStr, "secondLevelLabelName").ParseToString().Length > 0 ? "\r\n低风险规则上架" : "";
|
||||
StatusStr += Limit1 + Limit2;
|
||||
|
||||
var spuId = prod["productId"].ParseToString();
|
||||
var recommendProd = recommendProds.FirstOrDefault(r => r.product_id == prod["productId"].ParseToString());
|
||||
if (recommendProd == null)
|
||||
recommendProd = new WXPlatformRecommendProdInfo();
|
||||
|
||||
var rowIndex = this.dgvSelectProduct.Rows.Add(
|
||||
false,
|
||||
"",
|
||||
@@ -735,13 +569,14 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
(prod["recommendCategory"].IsJTokenNullOrEmpty() || prod["recommendCategory"]["categoryNames"].IsJTokenNullOrEmpty()) ?
|
||||
"" : string.Join(" >> ", prod["recommendCategory"]["categoryNames"].Select(s => s.ParseToString())), // 类目名称
|
||||
prod["spuCode"].ParseToString(),
|
||||
//price,
|
||||
prod["price"].ParseToDecimal() * 0.01m,
|
||||
prod["soldNum"].ParseToInt(),
|
||||
prod["price"].ParseToDecimal() * 0.01m, // 价格
|
||||
prod["soldNum"].ParseToInt(), // 销量
|
||||
recommendProd.product_view_uv,
|
||||
recommendProd.pay_order_cnt,
|
||||
StatusStr,
|
||||
prod["presaleTag"].ParseToInt() == 1 ? "[预售]" : "",
|
||||
prod["presaleTag"].ParseToInt() == 1 ? "[预售]" : "", // 预售
|
||||
"", // 备注
|
||||
"",
|
||||
"", // 操作结果
|
||||
"删除",
|
||||
BaseClass.StampToDateTime(prod["lastEditDraftTime"].ParseToInt()).ToString("yy-MM-dd HH:mm"),
|
||||
"");
|
||||
@@ -793,13 +628,18 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
|
||||
private void btnFilterShop_Click(object sender, EventArgs e)
|
||||
{
|
||||
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
|
||||
if (notes == "全部")
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
|
||||
if (group == "全部")
|
||||
group = "";
|
||||
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
string notes = cmbFilterShopNotes.Text.Trim().Trim(';');
|
||||
if (notes == "全部")
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
|
||||
{
|
||||
row.Visible = false;
|
||||
@@ -812,6 +652,12 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
row.Cells["colSelect"].Value = false;
|
||||
continue;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
|
||||
{
|
||||
row.Visible = false;
|
||||
row.Cells["colSelect"].Value = false;
|
||||
continue;
|
||||
}
|
||||
row.Visible = true;
|
||||
}
|
||||
}
|
||||
@@ -820,6 +666,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
txtFilterShopName.Text = "";
|
||||
cmbFilterShopNotes.Text = "全部";
|
||||
cmbFilterShopGroup.Text = "全部";
|
||||
btnFilterShop_Click(null, null);
|
||||
}
|
||||
|
||||
@@ -839,16 +686,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
|
||||
if (group == "全部")
|
||||
group = "";
|
||||
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (row.Visible == true)
|
||||
{
|
||||
if (row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()) &&
|
||||
(string.IsNullOrWhiteSpace(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString())))
|
||||
{
|
||||
row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
}
|
||||
if (row.Visible == false)
|
||||
continue;
|
||||
|
||||
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(notes) && !notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
|
||||
continue;
|
||||
|
||||
row.Cells["colSelect"].Value = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -859,16 +714,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
notes = "";
|
||||
List<string> notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
string group = cmbFilterShopGroup.Text.Trim().Trim(';');
|
||||
if (group == "全部")
|
||||
group = "";
|
||||
List<string> groupLst = group.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
foreach (DataGridViewRow row in dgvShop.Rows)
|
||||
{
|
||||
if (row.Visible == true)
|
||||
{
|
||||
if (row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()) &&
|
||||
(string.IsNullOrWhiteSpace(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString())))
|
||||
{
|
||||
row.Cells["colSelect"].Value = false;
|
||||
}
|
||||
}
|
||||
if (row.Visible == false)
|
||||
continue;
|
||||
|
||||
if (!row.Cells["colShopName"].Value.ParseToString().Contains(txtFilterShopName.Text.Trim()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(notes) && !notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(group) && !groupLst.Contains(row.Cells["colGroup"].Value.ParseToString()))
|
||||
continue;
|
||||
|
||||
row.Cells["colSelect"].Value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,10 +939,16 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
foreach (DataGridViewRow row in dgvSelectProduct.Rows)
|
||||
{
|
||||
if (row.Cells["colSoldNum"].Value.ParseToInt() >= txtFiltSaleNum.Text.Trim().ParseToInt())
|
||||
row.Cells["colCheck"].Value = true;
|
||||
|
||||
if (row.Cells["colViewUv"].Value.ParseToInt() >= txtViewUv.Text.Trim().ParseToInt())
|
||||
row.Cells["colCheck"].Value = false;
|
||||
|
||||
if (row.Cells["colPayOrderCnt"].Value.ParseToInt() >= txtFiltSaleNum.Text.Trim().ParseToInt())
|
||||
row.Cells["colCheck"].Value = false;
|
||||
|
||||
if (row.Cells["colAddTime"].Value.ParseToString().ParseToDateTime() >= DateTime.Now.AddDays(-txtAddDays.Text.Trim().ParseToInt()))
|
||||
row.Cells["colCheck"].Value = false;
|
||||
else
|
||||
row.Cells["colCheck"].Value = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1465,7 +1334,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
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 (prodIds != null)
|
||||
url += "&presaleType[]=" + prodIds;
|
||||
url += "&spuId=" + prodIds;
|
||||
if (sortType != null)
|
||||
url += "&sortType=" + sortType;
|
||||
|
||||
|
||||
Reference in new issue
Block a user