子账户显示昵称 客服加入批量登录 客服登录后页面不刷新问题修复

This commit is contained in:
wule committed 2026-03-21 13:49:01 +08:00
1 parent b502c6a2ed
commit 8e919b0bd7
22 files changed
+869 -217

No files matched your search

+1 -1
View File
@@ -56,6 +56,7 @@
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(95, 20);
this.tableLayoutPanel1.TabIndex = 0;
//
@@ -110,7 +111,6 @@
//
// UcSubAccount
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
@@ -45,6 +45,7 @@ namespace TemuKJD.WXForms.ShopForms
private void UcSubAccount_Load(object sender, EventArgs e)
{
this.lblSubAccountName.Text = subAccount.user_name;
this.lblSubAccountName.Text = subAccount.nick_name;
this.lblSubAccountGroupName.Text = subAccount.group_name;
this.lblSubAccountName.Resize += Lbl_Resize;
this.lblSubAccountGroupName.Resize += Lbl_Resize;
+41 -5
View File
@@ -46,12 +46,16 @@
this.txtLoginName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.txtChatNick = new DevComponents.DotNetBar.Controls.TextBoxX();
this.label7 = new System.Windows.Forms.Label();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Controls.Add(this.txtChatNick);
this.panel2.Controls.Add(this.label7);
this.panel2.Controls.Add(this.btnOk);
this.panel2.Controls.Add(this.label8);
this.panel2.Controls.Add(this.txtNotes);
@@ -94,7 +98,7 @@
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(29, 122);
this.label8.Location = new System.Drawing.Point(29, 131);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(56, 17);
this.label8.TabIndex = 386;
@@ -115,7 +119,7 @@
this.txtNotes.Border.PaddingLeft = 2;
this.txtNotes.Border.PaddingRight = 2;
this.txtNotes.Border.PaddingTop = 2;
this.txtNotes.Location = new System.Drawing.Point(91, 119);
this.txtNotes.Location = new System.Drawing.Point(91, 128);
this.txtNotes.Name = "txtNotes";
this.txtNotes.Size = new System.Drawing.Size(172, 23);
this.txtNotes.TabIndex = 385;
@@ -140,7 +144,7 @@
"上货",
"数据",
"登录"});
this.cmbGroup.Location = new System.Drawing.Point(91, 164);
this.cmbGroup.Location = new System.Drawing.Point(91, 161);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(172, 25);
this.cmbGroup.TabIndex = 383;
@@ -190,7 +194,7 @@
this.txtChatAccount.Border.PaddingLeft = 2;
this.txtChatAccount.Border.PaddingRight = 2;
this.txtChatAccount.Border.PaddingTop = 2;
this.txtChatAccount.Location = new System.Drawing.Point(91, 74);
this.txtChatAccount.Location = new System.Drawing.Point(91, 62);
this.txtChatAccount.Name = "txtChatAccount";
this.txtChatAccount.Size = new System.Drawing.Size(172, 23);
this.txtChatAccount.TabIndex = 380;
@@ -201,7 +205,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(29, 77);
this.label4.Location = new System.Drawing.Point(29, 65);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 17);
this.label4.TabIndex = 379;
@@ -280,6 +284,36 @@
this.label5.TabIndex = 377;
this.label5.Text = "店铺分组";
//
// txtChatNick
//
//
//
//
this.txtChatNick.Border.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatNick.Border.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatNick.Border.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatNick.Border.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.txtChatNick.Border.Class = "CrumbBarBackgroundKey";
this.txtChatNick.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.txtChatNick.Border.PaddingBottom = 2;
this.txtChatNick.Border.PaddingLeft = 2;
this.txtChatNick.Border.PaddingRight = 2;
this.txtChatNick.Border.PaddingTop = 2;
this.txtChatNick.Location = new System.Drawing.Point(91, 95);
this.txtChatNick.Name = "txtChatNick";
this.txtChatNick.ReadOnly = true;
this.txtChatNick.Size = new System.Drawing.Size(172, 23);
this.txtChatNick.TabIndex = 388;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(17, 98);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(68, 17);
this.label7.TabIndex = 387;
this.label7.Text = "子账户昵称";
//
// WXShopAddEditForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -317,5 +351,7 @@
private System.Windows.Forms.Label lblAttention;
private System.Windows.Forms.Label label8;
private DevComponents.DotNetBar.Controls.TextBoxX txtNotes;
private DevComponents.DotNetBar.Controls.TextBoxX txtChatNick;
private System.Windows.Forms.Label label7;
}
}
+20 -1
View File
@@ -91,8 +91,14 @@ namespace TemuKJD.WXForms.ShopForms
this.TitleText = "编辑店铺 - " + shop.ShopAccount;
this.txtBuyAccount.Text = shop.BuyAccount;
this.txtChatAccount.Text = shop.ChatAccount;
this.txtUploadAccount.Text = shop.UploadAccount;
this.txtChatAccount.Text = shop.SubUserName;
if (!string.IsNullOrEmpty( shop.SubUserName))
{
var subUserNames = shop.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su));
var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name));
this.txtChatNick.Text = string.Join(",", subUsers.Select(s => s.nick_name));
}
this.txtUploadAccount.Text = shop.UploadAccount;
this.txtLoginName.Enabled = false;
//this.lblAttention.Visible = true;
}
@@ -103,6 +109,11 @@ namespace TemuKJD.WXForms.ShopForms
this.txtUploadAccount.Enabled = false;
this.txtBuyAccount.Text = this.txtChatAccount.Text = this.txtUploadAccount.Text = "请在编辑账户时修改子账户";
}
if (AllBase.BaseClass.GroupId != 3)
{
this.txtChatAccount.Enabled = false;
//this.cmbGroup.Enabled = false;
}
}
private void txtUploadAccount_TextChanged(object sender, EventArgs e)
@@ -135,6 +146,14 @@ namespace TemuKJD.WXForms.ShopForms
this.txtBuyAccount.Text = shop.BuyAccount;
this.txtChatAccount.Text = shop.ChatAccount;
this.txtUploadAccount.Text = shop.UploadAccount;
this.txtChatAccount.Text = shop.SubUserName;
if (!string.IsNullOrEmpty(shop.SubUserName))
{
var subUserNames = shop.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su));
var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name));
this.txtChatNick.Text = string.Join(",", subUsers.Select(s => s.nick_name));
}
}
}
}
+16 -5
View File
@@ -68,6 +68,7 @@
this.colGroupName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colCookie = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSubUser = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSubUserAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colUploadAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colBuyAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colChatAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -287,7 +288,7 @@
this.cmbGroup.DropDownWidth = 1;
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.IntegralHeight = false;
this.cmbGroup.Location = new System.Drawing.Point(307, 8);
this.cmbGroup.Location = new System.Drawing.Point(307, 5);
this.cmbGroup.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(48, 25);
@@ -313,7 +314,7 @@
this.cmbNotes.DropDownWidth = 1;
this.cmbNotes.FormattingEnabled = true;
this.cmbNotes.IntegralHeight = false;
this.cmbNotes.Location = new System.Drawing.Point(224, 8);
this.cmbNotes.Location = new System.Drawing.Point(224, 5);
this.cmbNotes.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbNotes.Name = "cmbNotes";
this.cmbNotes.Size = new System.Drawing.Size(48, 25);
@@ -446,7 +447,7 @@
this.cmbSubAccount.DropDownWidth = 1;
this.cmbSubAccount.FormattingEnabled = true;
this.cmbSubAccount.IntegralHeight = false;
this.cmbSubAccount.Location = new System.Drawing.Point(402, 8);
this.cmbSubAccount.Location = new System.Drawing.Point(402, 5);
this.cmbSubAccount.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbSubAccount.Name = "cmbSubAccount";
this.cmbSubAccount.Size = new System.Drawing.Size(48, 25);
@@ -607,6 +608,7 @@
this.colGroupName,
this.colCookie,
this.colSubUser,
this.colSubUserAccount,
this.colUploadAccount,
this.colBuyAccount,
this.colChatAccount,
@@ -626,6 +628,7 @@
this.colDelete});
this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvShop.Location = new System.Drawing.Point(4, 0);
this.dgvShop.MultiSelectCheckBox = true;
this.dgvShop.Name = "dgvShop";
this.dgvShop.ReadOnly = true;
this.dgvShop.RowTemplate.Height = 23;
@@ -699,6 +702,13 @@
this.colSubUser.Name = "colSubUser";
this.colSubUser.ReadOnly = true;
//
// colSubUserAccount
//
this.colSubUserAccount.FillWeight = 75F;
this.colSubUserAccount.HeaderText = "子账户账号";
this.colSubUserAccount.Name = "colSubUserAccount";
this.colSubUserAccount.ReadOnly = true;
//
// colUploadAccount
//
this.colUploadAccount.FillWeight = 70F;
@@ -939,6 +949,8 @@
private DevComponents.DotNetBar.PanelEx btnRefreshShop;
private UserComponent.UcComboBoxMutiSelect cmbGroup;
private System.Windows.Forms.Label label6;
private DevComponents.DotNetBar.PanelEx btnCheck;
private DevComponents.DotNetBar.PanelEx btnEdit;
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn colLoginName;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
@@ -948,6 +960,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn colGroupName;
private System.Windows.Forms.DataGridViewTextBoxColumn colCookie;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubUser;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubUserAccount;
private System.Windows.Forms.DataGridViewTextBoxColumn colUploadAccount;
private System.Windows.Forms.DataGridViewTextBoxColumn colBuyAccount;
private System.Windows.Forms.DataGridViewTextBoxColumn colChatAccount;
@@ -965,7 +978,5 @@
private System.Windows.Forms.DataGridViewLinkColumn colCopyCookies;
private System.Windows.Forms.DataGridViewLinkColumn colEdit;
private System.Windows.Forms.DataGridViewLinkColumn colDelete;
private DevComponents.DotNetBar.PanelEx btnCheck;
private DevComponents.DotNetBar.PanelEx btnEdit;
}
}
+24 -3
View File
@@ -536,6 +536,8 @@ namespace TemuKJD.WXForms.ShopForms
}
else
{
var subUserNames = param.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su));
var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name));
int rowIndex = this.dgvShop.Rows.Add(
isRowCheck,
param.LoginName,
@@ -545,6 +547,7 @@ namespace TemuKJD.WXForms.ShopForms
param.Notes,
param.GroupName,
param.Cookies,
string.Join(",", subUsers.Select(s => s.nick_name)),
param.SubUserName,
param.UploadAccount,
param.BuyAccount,
@@ -576,6 +579,9 @@ namespace TemuKJD.WXForms.ShopForms
{
if (dgvr == null || param == null)
return;
var subUserNames = param.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su));
var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name));
dgvr.Cells["colCookie"].Value = param.Cookies;
dgvr.Cells["colApiAuth"].Value = param.ApiAuthStatus;
dgvr.Cells["colBuyApiAuth"].Value = param.BuyApiAuth.ApiAuthStatus;
@@ -583,7 +589,8 @@ namespace TemuKJD.WXForms.ShopForms
dgvr.Cells["colShopAccount"].Value = param.ShopAccount;
dgvr.Cells["colNotes"].Value = param.Notes;
dgvr.Cells["colCookie"].Value = param.Cookies;
dgvr.Cells["colSubUser"].Value = param.SubUserName;
dgvr.Cells["colSubUser"].Value = string.Join(",", subUsers.Select(s => s.nick_name));
dgvr.Cells["colSubUserAccount"].Value = param.SubUserName;
dgvr.Cells["colGroupName"].Value = param.GroupName;
dgvr.Cells["colUploadAccount"].Value = param.UploadAccount;
dgvr.Cells["colBuyAccount"].Value = param.BuyAccount;
@@ -716,11 +723,13 @@ namespace TemuKJD.WXForms.ShopForms
{
if (BaseClass.GroupId != 3)
{
this.dgvShop.Columns["ColEdit"].Visible = false;
//this.dgvShop.Columns["ColEdit"].Visible = false;
this.dgvShop.Columns["colDelete"].Visible = false;
this.dgvShop.Columns["colSubUser"].Visible = false;
this.dgvShop.Columns["colSubUserAccount"].Visible = false;
this.btnImport.Visible = false;
this.btnAddShop.Visible = false;
//this.btnEdit.Visible = false;
}
this.dgvShop.AddSelectorColumn("colSelect");
@@ -740,6 +749,17 @@ namespace TemuKJD.WXForms.ShopForms
shop.ShopSubAccountList.Add(subAccount);
}
}
pbLoading.Visible = true;
Task.Run(() =>
{
WXSubAccountShopEditForm.GetServerSubUser();
Invoke(new Action(() =>
{
RefreshDataGridView(false);
pbLoading.Visible = false;
}));
});
}
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
@@ -944,6 +964,7 @@ namespace TemuKJD.WXForms.ShopForms
try
{
UpdateShop();
WXSubAccountShopEditForm.GetServerSubUser();
RefreshDataGridView(false);
}
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
@@ -1014,7 +1035,7 @@ namespace TemuKJD.WXForms.ShopForms
break;
var shopInfo = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName);
if (shopInfo != null && !string.IsNullOrEmpty(shopInfo.LoginName) && !string.IsNullOrEmpty(shopInfo.Password))
if (shopInfo != null && !string.IsNullOrEmpty(shopInfo.LoginName))
{
WXShopLoginForm shopLoginForm = new WXShopLoginForm(shopInfo);
shopLoginForm.openType = EnumOpenType.login;
@@ -144,6 +144,9 @@
<metadata name="colSubUser.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSubUserAccount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colUploadAccount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -43,6 +43,7 @@ namespace TemuKJD.WXForms.ShopForms
public ShopLoginInfo mainShop = null;
public ConcurrentList<ShopLoginInfo> lstSwitchShop = new ConcurrentList<ShopLoginInfo>();
public ConcurrentList<ShopSwitchInfo> lstSwitchInfo = new ConcurrentList<ShopSwitchInfo>();
public ConcurrentList<ShopLoginInfo> lstNeedUpdateShop = new ConcurrentList<ShopLoginInfo>();
const string DefaultUrl = "https://store.weixin.qq.com/shop/home";
const string shopLoginUrl = "https://store.weixin.qq.com/shop?redirect_url=%2Fhome";
@@ -295,14 +296,18 @@ namespace TemuKJD.WXForms.ShopForms
private void ShopLoginForm_FormClosed(object sender, FormClosedEventArgs e)
{
//OnSaveComplete(shop);
Task.Run(() => {
Thread.Sleep(500);
if (!this.Disposing && !this.IsDisposed)
{
MainForm.instance.Invoke(new Action(() => { this.Dispose(); }));
}
});
////OnSaveComplete(shop);
//Task.Run(() =>
//{
// Thread.Sleep(500);
// MainForm.instance.Invoke(new Action(() =>
// {
// if (!this.Disposing && !this.IsDisposed)
// {
// this.Dispose();
// }
// }));
//});
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
@@ -330,6 +335,8 @@ namespace TemuKJD.WXForms.ShopForms
{
pbLoading.Visible = true;
btnRefreshNum.Enabled = false;
lstNeedUpdateShop = new ConcurrentList<ShopLoginInfo>();
Task.Run(() =>
{
foreach (var shop in lstSwitchShop)
@@ -352,6 +359,8 @@ namespace TemuKJD.WXForms.ShopForms
continue;
}
lstNeedUpdateShop.Add(shop);
string jsStr1 = @"document.getElementsByClassName('shop-info-popover')[0].style ='';
var divLst = document.getElementsByClassName('shop-info-popover')[0].getElementsByTagName('div');
for (i=0; i<divLst.length; i++){
@@ -40,6 +40,7 @@
this.btnOk = new TemuKJD.UserControls.ButtonEx();
this.panel1 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.btnRefresh = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -63,8 +64,8 @@
//
// splitContainer1
//
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(12, 41);
this.splitContainer1.Name = "splitContainer1";
@@ -194,6 +195,7 @@
// panel1
//
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Controls.Add(this.btnRefresh);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.splitContainer1);
this.panel1.Controls.Add(this.btnOk);
@@ -213,16 +215,39 @@
this.label2.TabIndex = 374;
this.label2.Text = "label2";
//
// SubAccountShopEditForm
// btnRefresh
//
this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRefresh.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnRefresh.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRefresh.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRefresh.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRefresh.Location = new System.Drawing.Point(12, 377);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(85, 26);
this.btnRefresh.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnRefresh.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRefresh.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRefresh.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnRefresh.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnRefresh.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnRefresh.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnRefresh.Style.GradientAngle = 90;
this.btnRefresh.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnRefresh.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRefresh.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRefresh.TabIndex = 676;
this.btnRefresh.Text = "刷新子账号";
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
//
// WXSubAccountShopEditForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.ShowMinimizedBox = true;
this.Name = "SubAccountShopEditForm";
this.Name = "WXSubAccountShopEditForm";
this.Text = "SubAccountShopEditForm";
this.TitleText = "SubAccountShopEditForm";
this.Load += new System.EventHandler(this.SubAccountShopEditForm_Load);
@@ -255,5 +280,6 @@
private System.Windows.Forms.FlowLayoutPanel flpNotSubAccount;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label2;
private DevComponents.DotNetBar.PanelEx btnRefresh;
}
}
@@ -16,10 +16,13 @@ namespace TemuKJD.WXForms.ShopForms
{
public partial class WXSubAccountShopEditForm : BaseGeneralForm
{
ShopLoginInfo shop = null;
public List<ShopSubAccountInfo> AllSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
public static List<ShopSubAccountInfo> lstAllSubAccount { get; set; } = new List<ShopSubAccountInfo>();
public List<ShopSubAccountInfo> ShopSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
public List<ShopSubAccountInfo> NotShopSubAccountList { get; set; } = new List<ShopSubAccountInfo>();
ShopLoginInfo shop = null;
public WXSubAccountShopEditForm(ShopLoginInfo _shop)
{
InitializeComponent();
@@ -35,18 +38,51 @@ namespace TemuKJD.WXForms.ShopForms
GetUser();
}
private void GetUser()
public void GetUser(bool isReGetSubUser = false)
{
flpNotSubAccount.Controls.Clear();
flpShopSubAccount.Controls.Clear();
AllSubAccountList.Clear();
if (lstAllSubAccount.Count == 0 || isReGetSubUser)
{
GetServerSubUser();
}
if (shop != null)
{
ShopSubAccountList.Clear();
ShopSubAccountList.AddRange(lstAllSubAccount.Where(u => shop.SubUserName.Contains(u.sub_user_name)));
shop.ShopSubAccountList.Clear();
shop.ShopSubAccountList.AddRange(ShopSubAccountList);
NotShopSubAccountList.Clear();
NotShopSubAccountList.AddRange(lstAllSubAccount.Where(u => !ShopSubAccountList.Any(bu => bu.id == u.id)));
foreach (var item in ShopSubAccountList)
{
UcSubAccount s = new UcSubAccount(item, false);
s.AddSubAcountEvent += S_AddSubAcountEvent;
s.RemoveSubAcountEvent += S_RemoveSubAcountEvent;
flpShopSubAccount.Controls.Add(s);
}
foreach (var item in NotShopSubAccountList)
{
UcSubAccount s = new UcSubAccount(item);
s.AddSubAcountEvent += S_AddSubAcountEvent;
s.RemoveSubAcountEvent += S_RemoveSubAcountEvent;
flpNotSubAccount.Controls.Add(s);
}
}
}
public static void GetServerSubUser()
{
string url = BaseClass.BuildObjString("user/get_sub_user");
string data = UserLogin.GetSignaturex();
string html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html))
return;
if (html.Contains("\"data\""))
if (!html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (html.Contains("\"code\":200"))
{
lstAllSubAccount.Clear();
var userObj = Newtonsoft.Json.Linq.JObject.Parse(html);
foreach (Newtonsoft.Json.Linq.JObject obj in userObj["data"])
{
@@ -59,30 +95,7 @@ namespace TemuKJD.WXForms.ShopForms
user.group_id = BaseRegex.GetStringJson(ref oStr, "group_id");
user.shop_count = BaseRegex.GetIntJson(ref oStr, "shop_count");
AllSubAccountList.Add(user);
}
if (shop != null)
{
ShopSubAccountList.Clear();
ShopSubAccountList.AddRange(AllSubAccountList.Where(u=>shop.SubUserName.Contains(u.sub_user_name)));
shop.ShopSubAccountList.Clear();
shop.ShopSubAccountList.AddRange(ShopSubAccountList);
NotShopSubAccountList.AddRange(AllSubAccountList.Where(u => !ShopSubAccountList.Any(bu => bu.id == u.id)));
foreach (var item in ShopSubAccountList)
{
UcSubAccount s = new UcSubAccount(item, false);
s.AddSubAcountEvent += S_AddSubAcountEvent;
s.RemoveSubAcountEvent += S_RemoveSubAcountEvent;
flpShopSubAccount.Controls.Add(s);
}
foreach (var item in NotShopSubAccountList)
{
UcSubAccount s = new UcSubAccount(item);
s.AddSubAcountEvent += S_AddSubAcountEvent;
s.RemoveSubAcountEvent += S_RemoveSubAcountEvent;
flpNotSubAccount.Controls.Add(s);
}
lstAllSubAccount.Add(user);
}
}
}
@@ -190,5 +203,10 @@ namespace TemuKJD.WXForms.ShopForms
OnSaveComplete(shop);
this.Close();
}
private void btnRefresh_Click(object sender, EventArgs e)
{
GetUser(true);
}
}
}