子账户显示昵称 客服加入批量登录 客服登录后页面不刷新问题修复
This commit is contained in:
1 parent
b502c6a2ed
commit
8e919b0bd7
22 files changed
+869
-217
No files matched your search
@@ -44,7 +44,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
|
||||
public ConcurrentList<AuthInfo> lstShopAuthInfo = new ConcurrentList<AuthInfo>();
|
||||
public ConcurrentList<WXShopTokenInfo> lstWXShopTokenInfo = new ConcurrentList<WXShopTokenInfo>();
|
||||
public Dictionary<string, bool> dicCheckedShopId = new Dictionary<string, bool>();
|
||||
//public Dictionary<string, bool> dicCheckedShopId = new Dictionary<string, bool>();
|
||||
public Dictionary<string, WxShopUploadInfo> dicShopUpload = new Dictionary<string, WxShopUploadInfo>();
|
||||
|
||||
WXAddFinderParam wxAddFinderParam = new WXAddFinderParam();
|
||||
@@ -78,9 +78,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
lstWXShopTokenInfo = new ConcurrentList<WXShopTokenInfo>();
|
||||
|
||||
// 选中信息
|
||||
dicCheckedShopId = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string, bool>>("wx_checked_shop_dic");
|
||||
if (dicCheckedShopId == null)
|
||||
dicCheckedShopId = new Dictionary<string, bool>();
|
||||
//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");
|
||||
@@ -298,11 +298,11 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var r in dgvShop.Rows.Cast<DataGridViewRow>())
|
||||
{
|
||||
dicCheckedShopId[r.Cells["colShopId"].Value.ParseToString()] = r.Cells["colSelect"].Value.ParseToBool();
|
||||
}
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_checked_shop_dic", dicCheckedShopId);
|
||||
//foreach (var r in dgvShop.Rows.Cast<DataGridViewRow>())
|
||||
//{
|
||||
// dicCheckedShopId[r.Cells["colShopId"].Value.ParseToString()] = r.Cells["colSelect"].Value.ParseToBool();
|
||||
//}
|
||||
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_checked_shop_dic", dicCheckedShopId);
|
||||
}
|
||||
|
||||
private void btnRefreshShop_Click(object sender, EventArgs e)
|
||||
@@ -344,6 +344,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
cmbFilterShopNotes.Items.Add(note);
|
||||
}
|
||||
pbLoadingShop.Visible = false;
|
||||
}
|
||||
|
||||
private void BindShop(ShopLoginInfo shopEntity, List<string> selectShopId = null, string msg = "")
|
||||
@@ -360,7 +361,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (row == null)
|
||||
{
|
||||
this.dgvShop.Rows.Add(
|
||||
dicCheckedShopId.Keys.Contains(shopEntity.ShopId) && dicCheckedShopId[shopEntity.ShopId] == true,
|
||||
dgvShop.Rows.Count == 0 ? true : (selectShopId.Contains(shopEntity.ShopId) && canUse),
|
||||
shopEntity.LoginName,
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
@@ -427,6 +428,14 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
string shopAccount = dgvShop.Rows[e.RowIndex].Cells["colShopName"].Value.ToString();
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId.ToString());
|
||||
var row = dgvShop.Rows[e.RowIndex];
|
||||
foreach(DataGridViewRow r in dgvShop.Rows)
|
||||
{
|
||||
if (r == row)
|
||||
continue;
|
||||
if (r.Cells["colSelect"].Value.ParseToBool() == true)
|
||||
r.Cells["colSelect"].Value = false;
|
||||
}
|
||||
row.Cells["colSelect"].Value = true;
|
||||
|
||||
if (currentShop != shop)
|
||||
{
|
||||
@@ -458,24 +467,24 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
switch (columnName)
|
||||
{
|
||||
case "colSelect":
|
||||
//if (row.Cells["colCanUse"].Value.ParseToBool())
|
||||
{
|
||||
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
|
||||
chkSelectAll.CheckedChanged -= chkSelectAll_CheckedChanged;
|
||||
if (dgvShop.Rows.Cast<DataGridViewRow>().All(r => r.Cells["colSelect"].Value.ParseToBool()))
|
||||
chkSelectAll.Checked = true;
|
||||
else
|
||||
chkSelectAll.Checked = false;
|
||||
chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
|
||||
}
|
||||
//else
|
||||
////if (row.Cells["colCanUse"].Value.ParseToBool())
|
||||
//{
|
||||
// //BaseMsgForm.ShowInfo("店铺未登录!");
|
||||
//}
|
||||
// row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
|
||||
dicCheckedShopId[row.Cells["colShopId"].Value.ParseToString()] = row.Cells["colSelect"].Value.ParseToBool();
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_checked_shop_dic", dicCheckedShopId);
|
||||
// chkSelectAll.CheckedChanged -= chkSelectAll_CheckedChanged;
|
||||
// if (dgvShop.Rows.Cast<DataGridViewRow>().All(r => r.Cells["colSelect"].Value.ParseToBool()))
|
||||
// chkSelectAll.Checked = true;
|
||||
// else
|
||||
// chkSelectAll.Checked = false;
|
||||
// chkSelectAll.CheckedChanged += chkSelectAll_CheckedChanged;
|
||||
//}
|
||||
////else
|
||||
////{
|
||||
//// //BaseMsgForm.ShowInfo("店铺未登录!");
|
||||
////}
|
||||
|
||||
//dicCheckedShopId[row.Cells["colShopId"].Value.ParseToString()] = row.Cells["colSelect"].Value.ParseToBool();
|
||||
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_checked_shop_dic", dicCheckedShopId);
|
||||
break;
|
||||
case "colLoginStatus":
|
||||
{
|
||||
@@ -574,15 +583,26 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
|
||||
private void btnSearchTalent_Click(object sender, EventArgs e)
|
||||
{
|
||||
var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
if (shopIdLst.Count <= 0)
|
||||
//var shopIdLst = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
// => row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
//if (shopIdLst.Count <= 0)
|
||||
//{
|
||||
// BaseMsgForm.ShowError("未勾选店铺!");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (currentShop == null)
|
||||
{
|
||||
BaseMsgForm.ShowError("未勾选店铺!");
|
||||
BaseMsgForm.ShowError("当前店铺为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
btnSearchTalent.Enabled = false;
|
||||
|
||||
|
||||
pbLoading.Visible = true;
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
dgvTalent.Rows.Clear();
|
||||
Task.Run(() =>
|
||||
@@ -653,7 +673,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
Invoke(new Action(() => { BindShop(shop, new List<string>() { shop.ShopId }, "店铺掉线"); }));
|
||||
var selectIds = 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, selectIds, "店铺掉线"); }));
|
||||
}
|
||||
|
||||
if (shopRow != null)
|
||||
@@ -669,13 +691,14 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
try
|
||||
{
|
||||
var talentObj = JsonHelper.JObjectParse(getFinderTalentRst)["list"];
|
||||
lstWXFinderTalentInfo = JsonHelper.DeserializeJsonToList<WXFinderTalentInfo>(JsonHelper.SerializeObject(talentObj));
|
||||
var wxFinderTalentInfo = JsonHelper.DeserializeJsonToList<WXFinderTalentInfo>(JsonHelper.SerializeObject(talentObj));
|
||||
if (page == 1 || 1 == 1)
|
||||
{
|
||||
var totalNum = BaseRegex.GetIntJson(ref getFinderTalentRst, "totalNum");
|
||||
totalPage = Math.Ceiling(1m * totalNum / pageSize).ParseToInt();
|
||||
}
|
||||
foreach (var finderTalent in lstWXFinderTalentInfo)
|
||||
lstWXFinderTalentInfo.AddRange(wxFinderTalentInfo);
|
||||
foreach (var finderTalent in wxFinderTalentInfo)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -918,9 +941,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
BaseMsgForm.ShowError("联系人不能为空");
|
||||
return;
|
||||
}
|
||||
if (wxAddFinderParam.WxNumber.IsNullOrEmpty() || !wxAddFinderParam.WxNumber.StartsWith("wx") || wxAddFinderParam.WxNumber.Length < 6)
|
||||
if (wxAddFinderParam.WxNumber.IsNullOrEmpty() || wxAddFinderParam.WxNumber.Length < 6)
|
||||
{
|
||||
BaseMsgForm.ShowError("请确定微信号不为空,且必须以wx开头,最少六个字符");
|
||||
BaseMsgForm.ShowError("请确定微信号不为空,最少六个字符");
|
||||
return;
|
||||
}
|
||||
if (wxAddFinderParam.Mobile.IsNullOrEmpty() || wxAddFinderParam.Mobile.ParseToLong().ToString().Length != 11)
|
||||
@@ -942,6 +965,15 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
pbLoading.Visible = true;
|
||||
string prodIds = txtProductIds.Text.Trim();
|
||||
|
||||
this.btnAddFinder.Enabled = false;
|
||||
Task.Run(() => {
|
||||
Thread.Sleep(5000);
|
||||
Invoke(new Action(() => { this.btnAddFinder.Enabled = true; }));
|
||||
});
|
||||
|
||||
if (cancellationTokenSource != null)
|
||||
cancellationTokenSource.Cancel();
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(prodIds))
|
||||
@@ -984,13 +1016,16 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "达人邀约 第 " + num + " 条,共 " + selectRows.Count + " 条";
|
||||
row.Cells["colOpResult"].Value = "";
|
||||
}));
|
||||
if (this.cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var shopId = selectRows.FirstOrDefault().Cells["colSupplierId"].Value.ParseToString();
|
||||
var shopId = row.Cells["colSupplierId"].Value.ParseToString();
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||||
if (chkReUse.Visible && chkReUse.Checked)
|
||||
shop = currentShop;
|
||||
var talentAppid = selectRows.FirstOrDefault().Cells["colTalentAppid"].Value.ParseToString();
|
||||
var talentAppid = row.Cells["colTalentAppid"].Value.ParseToString();
|
||||
var talent = this.lstWXFinderTalentInfo.FirstOrDefault(t => t.talentAppid == talentAppid);
|
||||
|
||||
if (shop!=null && talent != null)
|
||||
@@ -998,7 +1033,8 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
List<string> prodIdLst = prodIds.Split(new string[] { ",", ",", ";", ";", " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
var finderUsername = talent.accountList.FirstOrDefault(a => !a.finderUsername.IsNullOrEmpty())?.finderUsername;
|
||||
var promotionInvitationRst = WXFinderSquareBLL.createPromotionInvitation(shop, prodIdLst, finderUsername, talent.talentAppid,
|
||||
wxAddFinderParam.ContactPerson, wxAddFinderParam.WxNumber, wxAddFinderParam.Mobile, wxAddFinderParam.Explain);
|
||||
wxAddFinderParam.ContactPerson, wxAddFinderParam.WxNumber, wxAddFinderParam.Mobile,
|
||||
wxAddFinderParam.Explain.Replace("\r", "").Replace("\n", ""));
|
||||
Thread.Sleep(Randomx.GetId(3000, 5000));
|
||||
|
||||
if (!promotionInvitationRst.ParseToString().Contains("\"code\":0"))
|
||||
@@ -1009,7 +1045,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (promotionInvitationRst.ParseToString().Contains("biz magic invalid"))
|
||||
{
|
||||
shop.LoginStatus = "未登录";
|
||||
Invoke(new Action(() => { BindShop(shop, new List<string>() { shop.ShopId }, "店铺掉线"); }));
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(r
|
||||
=> r.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "店铺掉线"); }));
|
||||
error = "店铺掉线";
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
@@ -1035,7 +1073,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
this.statusBar.lblTaskStatus.Text += "达人邀约操作结束";
|
||||
BaseMsgForm.ShowInfo("达人邀约操作结束");
|
||||
}));
|
||||
});
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
|
||||
public string GetFinderProdList(ShopLoginInfo shop, WXFinderTalentInfo finderTalent)
|
||||
@@ -1067,7 +1105,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (getFinderProdRst.Contains("biz magic invalid"))
|
||||
{
|
||||
shop.LoginStatus = "未登录";
|
||||
Invoke(new Action(() => { BindShop(shop, new List<string>() { shop.ShopId }, "店铺掉线"); }));
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(r
|
||||
=> r.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "店铺掉线"); }));
|
||||
return "{\"success\":false,\"msg\":\"查询达人商品列表失败,店铺掉线\"}";
|
||||
}
|
||||
var error = BaseRegex.GetStringJson(ref getFinderProdRst, "msg");
|
||||
@@ -1118,7 +1158,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (getProdRst.Contains("biz magic invalid"))
|
||||
{
|
||||
shop.LoginStatus = "未登录";
|
||||
Invoke(new Action(() => { BindShop(shop, new List<string>() { shop.ShopId }, "店铺掉线"); }));
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(r
|
||||
=> r.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
Invoke(new Action(() => { BindShop(shop, selectIds, "店铺掉线"); }));
|
||||
return "{\"success\":false,\"msg\":\"查询达人商品列表2失败,店铺掉线\"}";
|
||||
}
|
||||
var error = BaseRegex.GetStringJson(ref getProdRst, "msg");
|
||||
|
||||
Reference in new issue
Block a user