子账号管理相关内容

This commit is contained in:
wule committed 2025-07-05 16:55:35 +08:00
1 parent 9fe9fa2610
commit b48f320099
101 files changed
+3171 -572

No files matched your search

+5 -1
View File
@@ -95,6 +95,7 @@
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(172, 25);
this.cmbGroup.TabIndex = 383;
this.cmbGroup.Visible = false;
//
// txtBuyAccount
//
@@ -111,6 +112,7 @@
this.txtBuyAccount.Name = "txtBuyAccount";
this.txtBuyAccount.Size = new System.Drawing.Size(172, 23);
this.txtBuyAccount.TabIndex = 382;
this.txtBuyAccount.Visible = false;
this.txtBuyAccount.WatermarkText = "点击添加店铺子账户";
this.txtBuyAccount.Click += new System.EventHandler(this.txt_Click);
this.txtBuyAccount.TextChanged += new System.EventHandler(this.txtBuyAccount_TextChanged);
@@ -123,6 +125,7 @@
this.label6.Size = new System.Drawing.Size(56, 17);
this.label6.TabIndex = 381;
this.label6.Text = "采购账户";
this.label6.Visible = false;
//
// txtChatAccount
//
@@ -154,7 +157,7 @@
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 17);
this.label4.TabIndex = 379;
this.label4.Text = "客服账户";
this.label4.Text = " 子账户";
//
// txtUploadAccount
//
@@ -226,6 +229,7 @@
this.label5.Size = new System.Drawing.Size(56, 17);
this.label5.TabIndex = 377;
this.label5.Text = "店铺分组";
this.label5.Visible = false;
//
// btnOk
//
+7 -1
View File
@@ -1,4 +1,5 @@
using System;
using AllBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -30,6 +31,11 @@ namespace TemuKJD.KJDForms.ShopForms
List<string> hideName = new List<string>() { "高级运费模板", "运费模板", "素材库管理" };
if (BaseClass.GroupId != 3)
{
hideName.Add("用户管理");
}
foreach (var item in hideName)
{
var n = tv.Nodes[0].Nodes.Find(item, true);
+11
View File
@@ -51,6 +51,7 @@
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colCookie = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSubUser = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colGroup = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colUploadAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colBuyAccount = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -284,6 +285,7 @@
this.colShopId,
this.colShopAccount,
this.colCookie,
this.colSubUser,
this.colGroup,
this.colUploadAccount,
this.colBuyAccount,
@@ -370,12 +372,20 @@
this.colCookie.ReadOnly = true;
this.colCookie.Visible = false;
//
// colSubUser
//
this.colSubUser.FillWeight = 67F;
this.colSubUser.HeaderText = "子账户";
this.colSubUser.Name = "colSubUser";
this.colSubUser.ReadOnly = true;
//
// colGroup
//
this.colGroup.FillWeight = 69.42601F;
this.colGroup.HeaderText = "店铺分组";
this.colGroup.Name = "colGroup";
this.colGroup.ReadOnly = true;
this.colGroup.Visible = false;
//
// colUploadAccount
//
@@ -546,6 +556,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn colShopId;
private System.Windows.Forms.DataGridViewTextBoxColumn colShopAccount;
private System.Windows.Forms.DataGridViewTextBoxColumn colCookie;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubUser;
private System.Windows.Forms.DataGridViewTextBoxColumn colGroup;
private System.Windows.Forms.DataGridViewTextBoxColumn colUploadAccount;
private System.Windows.Forms.DataGridViewTextBoxColumn colBuyAccount;
+27 -4
View File
@@ -38,7 +38,8 @@ namespace TemuKJD.KJDForms.ShopForms
+ "&shop_id=" + _shop.ShopId
+ "&shop_account=" + _shop.ShopAccount
+ "&cookie=" + _shop.Cookies
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.Group);
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.Group)
+ "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName);
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
@@ -61,7 +62,8 @@ namespace TemuKJD.KJDForms.ShopForms
var data = UserLogin.GetSignaturex()
+ "&login_name=" + _shop.LoginName
+ "&login_pass=" + GetHtml.UrlEncodeUtf8(_shop.Password)
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.Group);
+ "&shop_group=" + GetHtml.UrlEncodeUtf8(_shop.Group)
+ "&sub_user_name=" + GetHtml.UrlEncodeUtf8(_shop.SubUserName);
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200") && !result.Contains("已达上限") && !result.Contains("已存在"))
@@ -115,8 +117,10 @@ namespace TemuKJD.KJDForms.ShopForms
shop.Password = BaseRegex.GetStringJson(ref shopStr, "login_pass");
shop.ShopId = BaseRegex.GetStringJson(ref shopStr, "shop_id");
shop.ShopAccount = BaseRegex.GetStringJson(ref shopStr, "shop_account");
shop.SubUserName = BaseRegex.GetStringJson(ref shopStr, "sub_user_name");
shop.Group = BaseRegex.GetStringJson(ref shopStr, "shop_group");
shop.Cookies = BaseRegex.GetStringJson(ref shopStr, "cookie");
shop.Cookies = shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+");
//shop.PayStatus = BaseRegex.GetIntJson(ref shopStr, "shop_pay_status");
//if (list.Any(l => l.ShopId == shop.ShopId) || list.Any(l => l.ShopName == shop.ShopName))
// continue;
@@ -249,6 +253,7 @@ namespace TemuKJD.KJDForms.ShopForms
var url = BaseClass.BuildObjString("shop/mdy_shop");
var data = UserLogin.GetSignaturex()
+ "&login_name=" + shop.LoginName
+ "&sub_user_name=" + shop.SubUserName
+ "&cookie=" + shopCookies.Replace("&", "&").Replace("%", "%").Replace("+", "+")
+ fTool;
var result = GetHtml.PostUtf8(url, data);
@@ -319,7 +324,7 @@ namespace TemuKJD.KJDForms.ShopForms
else
{
StartUp.SaveLocalShopLoginInfo();
ShopListForm.AddServerDouShop(shopInfo);
ShopListForm.MdyServerDouShop(shopInfo);
RefreshDataGridView(false);
}
}
@@ -486,6 +491,7 @@ namespace TemuKJD.KJDForms.ShopForms
param.ShopId,
param.ShopAccount,
param.Cookies,
param.SubUserName,
param.Group,
param.UploadAccount,
param.BuyAccount,
@@ -689,7 +695,9 @@ namespace TemuKJD.KJDForms.ShopForms
{
this.dgvShop.Columns["ColEdit"].Visible = false;
this.dgvShop.Columns["colDelete"].Visible = false;
this.dgvShop.Columns["colSubUser"].Visible = false;
this.btnImport.Visible = false;
this.btnAddShop.Visible = false;
}
this.dgvShop.AddSelectorColumn("colSelect");
@@ -710,6 +718,19 @@ namespace TemuKJD.KJDForms.ShopForms
// shop.ShopSubAccountList.AddRange(shopSubAccountList.Where(s => s.shop_login_name == shop.LoginName));
// }
//}
foreach (var shop in GlobalConfig.ShopLoginList)
{
shop.ShopSubAccountList.Clear();
if (!string.IsNullOrWhiteSpace(shop.SubUserName))
{
DouShopSubAccountInfo subAccount = new DouShopSubAccountInfo();
subAccount.sub_user_name = shop.SubUserName;
subAccount.user_name = shop.SubUserName;
subAccount.shop_login_name = shop.LoginName;
subAccount.group_id = "4";
shop.ShopSubAccountList.Add(subAccount);
}
}
}
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
@@ -730,7 +751,9 @@ namespace TemuKJD.KJDForms.ShopForms
{
ShopLoginForm shopLoginForm = new ShopLoginForm(shop);
shopLoginForm.openType = EnumOpenType.manage;
shopLoginForm.ShowDialog();
//shopLoginForm.Parent = this;
shopLoginForm.WindowState = FormWindowState.Maximized;
shopLoginForm.Show();
IsOperate = false;
}
break;
@@ -132,6 +132,9 @@
<metadata name="colCookie.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSubUser.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colGroup.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
+21 -1
View File
@@ -30,6 +30,7 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShopLoginForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnLoginAgain = new TemuKJD.UserControls.ButtonEx();
this.pnlMultiLogin = new System.Windows.Forms.Panel();
this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx();
this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx();
@@ -68,6 +69,7 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White;
this.splitContainer1.Panel2.Controls.Add(this.btnLoginAgain);
this.splitContainer1.Panel2.Controls.Add(this.pnlMultiLogin);
this.splitContainer1.Panel2.Controls.Add(this.label2);
this.splitContainer1.Panel2.Controls.Add(this.label1);
@@ -83,6 +85,23 @@
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
// btnLoginAgain
//
this.btnLoginAgain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLoginAgain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnLoginAgain.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnLoginAgain.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLoginAgain.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLoginAgain.ForeColor = System.Drawing.Color.White;
this.btnLoginAgain.Location = new System.Drawing.Point(1137, 31);
this.btnLoginAgain.Margin = new System.Windows.Forms.Padding(2);
this.btnLoginAgain.Name = "btnLoginAgain";
this.btnLoginAgain.Size = new System.Drawing.Size(91, 25);
this.btnLoginAgain.TabIndex = 462;
this.btnLoginAgain.Text = "重新登录";
this.btnLoginAgain.UseVisualStyleBackColor = false;
this.btnLoginAgain.Click += new System.EventHandler(this.btnLoginAgain_Click);
//
// pnlMultiLogin
//
this.pnlMultiLogin.Controls.Add(this.cmbMultiCookieName);
@@ -271,7 +290,7 @@
this.chkCloseAfterLogin.Checked = true;
this.chkCloseAfterLogin.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkCloseAfterLogin.CheckValue = "Y";
this.chkCloseAfterLogin.Location = new System.Drawing.Point(1096, 32);
this.chkCloseAfterLogin.Location = new System.Drawing.Point(997, 32);
this.chkCloseAfterLogin.Name = "chkCloseAfterLogin";
this.chkCloseAfterLogin.Size = new System.Drawing.Size(135, 23);
this.chkCloseAfterLogin.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
@@ -355,5 +374,6 @@
private DevComponents.DotNetBar.PanelEx btnDel;
private DevComponents.DotNetBar.PanelEx btnMultiLogin;
private System.Windows.Forms.Panel pnlMultiLogin;
private UserControls.ButtonEx btnLoginAgain;
}
}
+56 -11
View File
@@ -120,8 +120,9 @@ namespace TemuKJD.KJDForms.ShopForms
{
foreach (var cookie in cookieList)
{
//SUB_PASS_ID要用domain是seller.kuajingmaihuo.com才是能登录店铺后台的
if (cookie.Name == "SUB_PASS_ID" && cookie.Domain != "seller.kuajingmaihuo.com")
//SUB_PASS_ID同时出现两个,domain是seller.kuajingmaihuo.com才是能登录店铺后台的
if (cookie.Name == "SUB_PASS_ID" && cookie.Domain != "seller.kuajingmaihuo.com"
&& cookieList.Any(c=>c.Name== "SUB_PASS_ID" && cookie.Domain == "seller.kuajingmaihuo.com"))
continue;
cookies += cookie.Name + "=" + cookie.Value + "; ";
@@ -145,6 +146,7 @@ namespace TemuKJD.KJDForms.ShopForms
Group = shop.Group,
ShopAccount = sc.AccountName,
ShopId = sc.AccountId,
SubUserName = shop.SubUserName,
};
var oldShop = GlobalConfig.ShopLoginList.FirstOrDefault(l =>
@@ -165,6 +167,7 @@ namespace TemuKJD.KJDForms.ShopForms
oldShop.Group = newShop.Group;
oldShop.ShopAccount = newShop.ShopAccount;
oldShop.ShopId = newShop.ShopId;
oldShop.SubUserName = newShop.SubUserName;
}
}
var lstShop = GlobalConfig.ShopLoginList.Where(l => l.LoginName == shop.LoginName).ToList();
@@ -258,7 +261,8 @@ namespace TemuKJD.KJDForms.ShopForms
if (cefWebBrowser == null)
{
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
//cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, false);
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
@@ -277,23 +281,34 @@ namespace TemuKJD.KJDForms.ShopForms
if (isMultiLogin)
cookie = shop.DictMultiCookies.Keys.Contains(MultiLoginCookieName) ? shop.DictMultiCookies[MultiLoginCookieName] : "";
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.RequestContext.GetCookieManager(null));
splitContainer1.Panel1.Controls.Add(cefWebBrowser);
Task.Run(() =>
{
Thread.Sleep(25);
cefWebBrowser.Load(shopMainUrl);
var t = CEFBrowser.SetCookieAsync(shopCookieHead, cookie, cefWebBrowser.RequestContext.GetCookieManager(null));
t.Wait(5000);
Invoke(new Action(() =>
{
splitContainer1.Panel1.Controls.Add(cefWebBrowser);
//cefWebBrowser.Load(shopMainUrl);
}));
if (openType != EnumOpenType.login)
{
Invoke(new Action(() =>
{
chkCloseAfterLogin.Visible = false;
btnLoginAgain.Visible = false;
}));
return;
}
for (int i = 0; i < 50; i++)
{
if (cefWebBrowser.IsLoading)
Thread.Sleep(100);
}
Thread.Sleep(Randomx.GetId(1000,1500));
Thread.Sleep(Randomx.GetId(1500,2000));
//设置 local storage
//if (GlobalConfig.dicLocalStorage != null)
@@ -424,12 +439,27 @@ namespace TemuKJD.KJDForms.ShopForms
/// <param name="_password"></param>
private void InputUserNameAndPassword(ChromiumWebBrowser webBrowser, string _account, string _password)
{
string jsStr1 = "function getInputItem () {var usernameId = document.getElementById('usernameId'); if (usernameId) return 'true';} getInputItem();";
Task<JavascriptResponse> response1 = null;
while (response1?.Result?.Result == null || !response1.Result.Result.ParseToString().Contains("true"))
{
Thread.Sleep(250);
if (!this.Created)
return;
response1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
response1.Wait(5000);
if (!this.Created)
return;
}
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sInputValueChange2);
webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sGetElementWithText);
string jsStr1 = "var usernameId = document.getElementById('usernameId'); " +
jsStr1 = "var usernameId = document.getElementById('usernameId'); " +
"changeReactInputValue(usernameId,'" + _account + "');";
var response1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
response1 = webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1);
response1.Wait(1000);
Thread.Sleep(Randomx.GetId(500, 1000));
@@ -712,7 +742,10 @@ function fireKeyEvent(el, evtType, keyCode) {
{
if (cefWebBrowser != null)
{
cefWebBrowser.Load(txtAddress.Text);
if (txtAddress.Text != "about:blank")
cefWebBrowser.Load(txtAddress.Text);
else
cefWebBrowser.Load(shopMainUrl);
}
}
@@ -808,5 +841,17 @@ function getElementWithText(sText)
return elem;
};
";
private void btnLoginAgain_Click(object sender, EventArgs e)
{
if (this.currentUrl != shopLoginUrl)
this.cefWebBrowser.Load(shopLoginUrl);
Task.Run(() =>
{
InputUserNameAndPassword(cefWebBrowser, shop.LoginName, DataOpenSSL.DecryptString(shop.Password));
});
}
}
}
+27 -27
View File
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
+22 -21
View File
@@ -50,11 +50,11 @@
this.label38 = new System.Windows.Forms.Label();
this.mobiletextBox = new System.Windows.Forms.TextBox();
this.label39 = new System.Windows.Forms.Label();
this.nametextBox = new System.Windows.Forms.TextBox();
this.txtNickName = new System.Windows.Forms.TextBox();
this.label40 = new System.Windows.Forms.Label();
this.dgvUser = new TemuKJD.UserComponent.DataGridViewEx();
this.UserIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.UserNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.UserNickNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.mobileColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -96,7 +96,7 @@
this.splitContainer5.Panel1.Controls.Add(this.label38);
this.splitContainer5.Panel1.Controls.Add(this.mobiletextBox);
this.splitContainer5.Panel1.Controls.Add(this.label39);
this.splitContainer5.Panel1.Controls.Add(this.nametextBox);
this.splitContainer5.Panel1.Controls.Add(this.txtNickName);
this.splitContainer5.Panel1.Controls.Add(this.label40);
//
// splitContainer5.Panel2
@@ -304,22 +304,22 @@
this.label39.TabIndex = 20;
this.label39.Text = "手机号:";
//
// nametextBox
// txtNickName
//
this.nametextBox.Location = new System.Drawing.Point(112, 100);
this.nametextBox.Name = "nametextBox";
this.nametextBox.Size = new System.Drawing.Size(148, 23);
this.nametextBox.TabIndex = 19;
this.txtNickName.Location = new System.Drawing.Point(112, 100);
this.txtNickName.Name = "txtNickName";
this.txtNickName.Size = new System.Drawing.Size(148, 23);
this.txtNickName.TabIndex = 19;
//
// label40
//
this.label40.AutoSize = true;
this.label40.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label40.Location = new System.Drawing.Point(41, 101);
this.label40.Location = new System.Drawing.Point(55, 101);
this.label40.Name = "label40";
this.label40.Size = new System.Drawing.Size(65, 20);
this.label40.Size = new System.Drawing.Size(51, 20);
this.label40.TabIndex = 18;
this.label40.Text = "账户名:";
this.label40.Text = "昵称:";
//
// dgvUser
//
@@ -341,7 +341,7 @@
this.dgvUser.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvUser.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.UserIdColumn,
this.UserNameColumn,
this.UserNickNameColumn,
this.mobileColumn,
this.groupIdColumn,
this.groupNameColumn,
@@ -373,15 +373,15 @@
this.UserIdColumn.ReadOnly = true;
this.UserIdColumn.Visible = false;
//
// UserNameColumn
// UserNickNameColumn
//
this.UserNameColumn.HeaderText = "用户名";
this.UserNameColumn.Name = "UserNameColumn";
this.UserNameColumn.ReadOnly = true;
this.UserNickNameColumn.HeaderText = "用户昵称";
this.UserNickNameColumn.Name = "UserNickNameColumn";
this.UserNickNameColumn.ReadOnly = true;
//
// mobileColumn
//
this.mobileColumn.HeaderText = "手机";
this.mobileColumn.HeaderText = "手机(登录账号)";
this.mobileColumn.Name = "mobileColumn";
this.mobileColumn.ReadOnly = true;
//
@@ -403,6 +403,7 @@
this.shopCountColumn.HeaderText = "店铺数";
this.shopCountColumn.Name = "shopCountColumn";
this.shopCountColumn.ReadOnly = true;
this.shopCountColumn.Visible = false;
//
// editColumn
//
@@ -459,18 +460,18 @@
private System.Windows.Forms.Label label38;
private System.Windows.Forms.TextBox mobiletextBox;
private System.Windows.Forms.Label label39;
private System.Windows.Forms.TextBox nametextBox;
private System.Windows.Forms.TextBox txtNickName;
private System.Windows.Forms.Label label40;
private UserComponent.DataGridViewEx dgvUser;
private UserControls.ButtonEx btnRefresh;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DataGridViewTextBoxColumn UserIdColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn UserNameColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn UserNickNameColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn mobileColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn groupIdColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn groupNameColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn shopCountColumn;
private System.Windows.Forms.DataGridViewLinkColumn editColumn;
private System.Windows.Forms.DataGridViewLinkColumn deleteColumn;
private UserControls.ButtonEx btnRefresh;
private System.Windows.Forms.Label label1;
}
}
@@ -35,7 +35,7 @@ namespace TemuKJD.KJDForms.ShopForms
BaseMsgForm.ShowInfo("密码最少6位", "提示");
return;
}
if (string.IsNullOrEmpty(nametextBox.Text) || string.IsNullOrEmpty(mobiletextBox.Text) ||
if (string.IsNullOrEmpty(txtNickName.Text) || string.IsNullOrEmpty(mobiletextBox.Text) ||
mobiletextBox.Text.Length != 11)
{
BaseMsgForm.ShowInfo("信息不正确", "提示");
@@ -44,9 +44,10 @@ namespace TemuKJD.KJDForms.ShopForms
StringBuilder data = new StringBuilder();
data.Append(UserLogin.GetSignaturex());
data.Append("&name=" + GetHtml.UrlEncodeUtf8(nametextBox.Text));
data.Append("&sub_user_name=" + GetHtml.UrlEncodeUtf8(mobiletextBox.Text));
data.Append("&sub_user_mobile=" + GetHtml.UrlEncodeUtf8(mobiletextBox.Text));
data.Append("&sub_nick_name=" + GetHtml.UrlEncodeUtf8(txtNickName.Text));
data.Append("&sub_name=" + GetHtml.UrlEncodeUtf8(mobiletextBox.Text));
data.Append("&sub_mobile=" + GetHtml.UrlEncodeUtf8(mobiletextBox.Text));
data.Append("&card_id=");
if (groupIdcomboBox.Text == "客服")
data.Append("&group_id=4");
else if (groupIdcomboBox.Text == "采购")
@@ -63,12 +64,12 @@ namespace TemuKJD.KJDForms.ShopForms
//if (groupIdcomboBox.Text == "登录")
// data.Append("&group_id=8");
if (!string.IsNullOrEmpty(passwordtextBox.Text))
data.Append("&password=" + Md5Base.GetMd5(passwordtextBox.Text).ToLower());
string url = BaseClass.BuildObjString("user/add_user");
data.Append("&sub_password=" + Md5Base.GetMd5(passwordtextBox.Text).ToLower());
string url = BaseClass.BuildObjString("user/add_sub_user");
if (btnOpUser.Text != "添加用户" && !string.IsNullOrEmpty(Uid))
{
data.Append("&id=" + Uid);
url = BaseClass.BuildObjString("user&act=update");
url = BaseClass.BuildObjString("user/update_sub_user");
}
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
@@ -98,7 +99,7 @@ namespace TemuKJD.KJDForms.ShopForms
private void EmptyInput()
{
nametextBox.Clear();
txtNickName.Clear();
passwordtextBox.Clear();
repasstextBox.Clear();
mobiletextBox.Clear();
@@ -108,7 +109,7 @@ namespace TemuKJD.KJDForms.ShopForms
{
dgvUser.Rows.Clear();
AllUsers.Clear();
string url = BaseClass.BuildObjString("user&act=get");
string url = BaseClass.BuildObjString("user/get_sub_user");
string data = UserLogin.GetSignaturex();
string html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html))
@@ -121,13 +122,14 @@ namespace TemuKJD.KJDForms.ShopForms
string oStr = JsonHelper.SerializeObject(obj);
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
user.id = BaseRegex.GetIntJson(ref oStr, "id");
user.name = BaseRegex.GetStringJson(ref oStr, "name");
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
user.mobile = BaseRegex.GetStringJson(ref oStr, "mobile");
user.group_id = BaseRegex.GetStringJson(ref oStr, "group_id");
user.shop_count = BaseRegex.GetIntJson(ref oStr, "shop_count");
AllUsers.Add(user);
dgvUser.Rows.Add(user.id, user.name, user.mobile, user.group_id, user.group_name, user.shop_count, "编辑", "删除");
dgvUser.Rows.Add(user.id, user.nick_name, user.user_name, user.group_id, user.group_name, user.shop_count, "编辑", "删除");
}
}
}
@@ -146,13 +148,13 @@ namespace TemuKJD.KJDForms.ShopForms
return;
string columname = dgvUser.Columns[e.ColumnIndex].HeaderText;
string uid = dgvUser.Rows[e.RowIndex].Cells["UseridColumn"].Value.ToString();
string name = dgvUser.Rows[e.RowIndex].Cells["UserNameColumn"].Value.ToString();
string nickName = dgvUser.Rows[e.RowIndex].Cells["UserNickNameColumn"].Value.ToString();
string mobile = dgvUser.Rows[e.RowIndex].Cells["mobileColumn"].Value.ToString();
string groupName = dgvUser.Rows[e.RowIndex].Cells["groupNameColumn"].Value.ToString();
if (columname == "编辑")
{
Uid = uid;
nametextBox.Text = name;
txtNickName.Text = nickName;
mobiletextBox.Text = mobile;
groupIdcomboBox.Text = groupName;
passwordtextBox.Text = "";
@@ -174,7 +176,7 @@ namespace TemuKJD.KJDForms.ShopForms
StringBuilder data = new StringBuilder();
data.Append(UserLogin.GetSignaturex());
data.Append("&id=" + uid);
string url = BaseClass.BuildObjString("user&act=delete");
string url = BaseClass.BuildObjString("user/delete_user");
string html = GetHtml.PostUtf8(url, data.ToString());
if (!string.IsNullOrEmpty(html))
{
@@ -195,10 +197,16 @@ namespace TemuKJD.KJDForms.ShopForms
private void SubAccountForm_Load(object sender, EventArgs e)
{
this.groupIdcomboBox.Enabled = false;
this.groupIdcomboBox.Items.Clear();
//this.groupIdcomboBox.Items.Add("上货");
this.groupIdcomboBox.Items.Add("采购");
//this.groupIdcomboBox.Items.Add("采购");
this.groupIdcomboBox.Items.Add("客服");
//if (BaseClass.UserName == "18888888888")
//{
// this.groupIdcomboBox.Items.Add("主管");
// this.groupIdcomboBox.Enabled = true;
//}
this.dgvUser.BackgroundColor = Color.White;
GetUser();
}
@@ -120,7 +120,7 @@
<metadata name="UserIdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="UserNameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="UserNickNameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mobileColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -40,7 +40,7 @@ namespace TemuKJD.KJDForms.ShopForms
flpNotSubAccount.Controls.Clear();
flpShopSubAccount.Controls.Clear();
AllSubAccountList.Clear();
string url = BaseClass.BuildObjString("user&act=get");
string url = BaseClass.BuildObjString("user/get_sub_user");
string data = UserLogin.GetSignaturex();
string html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html))
@@ -53,7 +53,8 @@ namespace TemuKJD.KJDForms.ShopForms
string oStr = JsonHelper.SerializeObject(obj);
DouShopSubAccountInfo user = new DouShopSubAccountInfo();
user.id = BaseRegex.GetIntJson(ref oStr, "id");
user.name = BaseRegex.GetStringJson(ref oStr, "name");
user.nick_name = BaseRegex.GetStringJson(ref oStr, "nick_name");
user.user_name = BaseRegex.GetStringJson(ref oStr, "user_name");
user.mobile = BaseRegex.GetStringJson(ref oStr, "mobile");
user.group_id = BaseRegex.GetStringJson(ref oStr, "group_id");
user.shop_count = BaseRegex.GetIntJson(ref oStr, "shop_count");
@@ -63,7 +64,10 @@ namespace TemuKJD.KJDForms.ShopForms
if (shop != null)
{
ShopSubAccountList.AddRange(shop.ShopSubAccountList);
ShopSubAccountList.Clear();
ShopSubAccountList.AddRange(AllSubAccountList.Where(u=>shop.SubUserName==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)
{
@@ -88,6 +92,13 @@ namespace TemuKJD.KJDForms.ShopForms
var s = obj as UcSubAccount;
if (s != null)
{
if (this.flpShopSubAccount.Controls.Count > 0)
{
BaseMsgForm.ShowInfo("只能有一个子账户!");
s.lblRight_Click(null, null);
return;
}
this.flpNotSubAccount.Controls.Remove(s);
this.flpShopSubAccount.Controls.Add(s);
}
@@ -135,13 +146,14 @@ namespace TemuKJD.KJDForms.ShopForms
{
DeleteUsers.Add(co.subAccount);
shop.ShopSubAccountList.Remove(co.subAccount);
string url = BaseClass.BuildObjString("shop&act=delete_shop_user_sub_group");
string data = UserLogin.GetSignaturex()
+ "&shop_id=" + shop.ShopId
+ "&sub_user_id=" + co.subAccount.sub_user_id
+ "&status=" + co.subAccount.status
+ "&group_id=" + co.subAccount.group_id;
string html = GetHtml.PostUtf8(url, data);
//string url = BaseClass.BuildObjString("shop&act=delete_shop_user_sub_group");
//string data = UserLogin.GetSignaturex()
// + "&shop_id=" + shop.ShopId
// + "&sub_user_id=" + co.subAccount.sub_user_id
// + "&sub_user_name=" + co.subAccount.sub_user_name
// + "&status=" + co.subAccount.status
// + "&group_id=" + co.subAccount.group_id;
//string html = GetHtml.PostUtf8(url, data);
}
}
foreach (Control c in this.flpShopSubAccount.Controls)
@@ -154,15 +166,26 @@ namespace TemuKJD.KJDForms.ShopForms
{
AddUsers.Add(co.subAccount);
shop.ShopSubAccountList.Add(co.subAccount);
string url = BaseClass.BuildObjString("shop&act=update_shop_user_sub_group");
string data = UserLogin.GetSignaturex()
+ "&shop_id=" + shop.ShopId
+ "&sub_user_id=" + co.subAccount.sub_user_id
+ "&status=" + co.subAccount.status
+ "&group_id=" + co.subAccount.group_id;
string html = GetHtml.PostUtf8(url, data);
//string url = BaseClass.BuildObjString("shop&act=update_shop_user_sub_group");
//string data = UserLogin.GetSignaturex()
// + "&shop_id=" + shop.ShopId
// + "&sub_user_id=" + co.subAccount.sub_user_id
// + "&sub_user_name=" + co.subAccount.sub_user_name
// + "&status=" + co.subAccount.status
// + "&group_id=" + co.subAccount.group_id;
//string html = GetHtml.PostUtf8(url, data);
}
}
shop.SubUserName = shop.ShopSubAccountList.FirstOrDefault()?.sub_user_name;
var shopLst = AllBase.Helper.GlobalConfig.ShopLoginList.Where(s => s.LoginName == shop.LoginName && s.ShopId!= shop.ShopId);
foreach(var s in shopLst)
{
s.SubUserName = shop.SubUserName;
s.ShopSubAccountList.Clear();
shop.ShopSubAccountList.AddRange(s.ShopSubAccountList);
}
OnSaveComplete(shop);
this.Close();
}
+3 -3
View File
@@ -44,7 +44,7 @@ namespace TemuKJD.KJDForms.ShopForms
private void UcSubAccount_Load(object sender, EventArgs e)
{
this.lblSubAccountName.Text = subAccount.name;
this.lblSubAccountName.Text = subAccount.user_name;
this.lblSubAccountGroupName.Text = subAccount.group_name;
this.lblSubAccountName.Resize += Lbl_Resize;
this.lblSubAccountGroupName.Resize += Lbl_Resize;
@@ -55,14 +55,14 @@ namespace TemuKJD.KJDForms.ShopForms
{
}
private void lblLeft_Click(object sender, EventArgs e)
public void lblLeft_Click(object sender, EventArgs e)
{
this.lblRight.Visible = true;
this.lblLeft.Visible = false;
AddSubAcountEvent?.Invoke(this);
}
private void lblRight_Click(object sender, EventArgs e)
public void lblRight_Click(object sender, EventArgs e)
{
this.lblRight.Visible = false;
this.lblLeft.Visible = true;