超级用户管理功能

This commit is contained in:
wule committed 2025-07-07 15:45:43 +08:00
1 parent 2b21ecf62a
commit 0646f19990
13 files changed
+610 -333

No files matched your search

+9 -5
View File
@@ -33,12 +33,14 @@
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("运费模板");
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("高级运费模板");
System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("素材库管理");
System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("超级用户管理");
System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("店铺管理", new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3,
treeNode4,
treeNode5});
treeNode5,
treeNode6});
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
@@ -139,10 +141,12 @@
treeNode4.Text = "高级运费模板";
treeNode5.Name = "素材库管理";
treeNode5.Text = "素材库管理";
treeNode6.Name = "店铺管理";
treeNode6.Text = "店铺管理";
treeNode6.Name = "超级用户管理";
treeNode6.Text = "超级用户管理";
treeNode7.Name = "店铺管理";
treeNode7.Text = "店铺管理";
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode6});
treeNode7});
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.tv.Size = new System.Drawing.Size(140, 461);
this.tv.TabIndex = 1;
+8 -3
View File
@@ -9,6 +9,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.KJDForms.AccountForms;
namespace TemuKJD.KJDForms.ShopForms
{
@@ -19,6 +20,7 @@ namespace TemuKJD.KJDForms.ShopForms
public Lazy<FreightTemplateAddForm> freightForm = new Lazy<FreightTemplateAddForm>();
public Lazy<FreightTemplateForm> freightTemplateForm = new Lazy<FreightTemplateForm>();
public Lazy<MaterialManageForm> materialManageForm = new Lazy<MaterialManageForm>();
public Lazy<MainAccountForm> mainAccountForm = new Lazy<MainAccountForm>();
public ShopForm()
{
@@ -29,12 +31,12 @@ namespace TemuKJD.KJDForms.ShopForms
tv.SelectedNode = tv.Nodes[0].Nodes[0];
tv.ExpandGroup(tv.Nodes[0].Name);
List<string> hideName = new List<string>() { "高级运费模板", "运费模板", "素材库管理" };
List<string> hideName = new List<string>() { "高级运费模板", "运费模板", "素材库管理", "超级用户管理" };
if (BaseClass.GroupId != 3)
{
hideName.Add("用户管理");
}
if (BaseClass.GroupId == 3 && (BaseClass.UserName == "18888888888" || BaseClass.UserName == "15266666666"))
hideName.Remove("超级用户管理");
foreach (var item in hideName)
{
@@ -74,6 +76,9 @@ namespace TemuKJD.KJDForms.ShopForms
case "素材库管理":
SetForm(materialManageForm.Value);
break;
case "超级用户管理":
SetForm(mainAccountForm.Value);
break;
}
}));
}).Start();
+56 -4
View File
@@ -760,10 +760,26 @@ namespace TemuKJD.KJDForms.ShopForms
case "复制Cookies":
//SUB_PASS_ID=eyJ0IjoiRHBPWTBvVGxKWlZCZ1FmNVpPNGFwUjczdDZzUGk5bWVzbHZGejBUYlFkK3c4VjN4ZUIyV1RtZ24ybCtwWkhyNSIsInYiOjEsInMiOjEwMDAwLCJ1IjoyNDg3NDUxOTIxNzE0fQ==
string cook = shop.Cookies;
cook = BaseRegex.GetStringCookie(ref cook, "SUB_PASS_ID");
cook = "SUB_PASS_ID=" + cook;
cook = "document.cookie='" + cook + "';window.location.href='https://seller.kuajingmaihuo.com'";
Clipboard.SetDataObject(cook);
//cook = BaseRegex.GetStringCookie(ref cook, "SUB_PASS_ID");
//cook = "SUB_PASS_ID=" + cook;
//cook = "document.cookie='" + cook + "';window.location.href='https://seller.kuajingmaihuo.com'";
//Clipboard.SetDataObject(cook);
//var subPassId = cook = BaseRegex.GetStringCookie(ref cook, "SUB_PASS_ID");
//var nanoFp = cook = BaseRegex.GetStringCookie(ref cook, "_nano_fp");
//var cookJs = sJsSetCookie;
//cookJs += "\r\nsetCookie('SUB_PASS_ID', '" + subPassId + "', 'Session', '/', 'seller.kuajingmaihuo.com');";
//cookJs += "\r\nsetCookie('_nano_fp', '" + nanoFp + "', 1, '/', 'seller.kuajingmaihuo.com', true);";
//cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)";
string cookJs = "";
foreach(var cookie in shop.Cookies.Split(';'))
{
//if (!cookie.StartsWith("SUB_PASS_ID") && !cookie.StartsWith("_nano_fp"))
cookJs += "\r\ndocument.cookie='" + cookie.Trim() + "';";
}
cookJs += "\r\nsetTimeout(() => { window.location.href='https://seller.kuajingmaihuo.com'; }, 200)";
Clipboard.SetDataObject(cookJs);
BaseMsgForm.ShowInfo("复制成功");
break;
case "删除":
@@ -937,5 +953,41 @@ namespace TemuKJD.KJDForms.ShopForms
});
}
}
private static string sJsSetCookie = @"
function setCookie(name, value, daysToLive, path, domain, secure, httpOnly, sameSite) {
//let cookie = name + '=' + encodeURIComponent(value) + ';';
let cookie = name + '=' + value + ';';
if (daysToLive) {
if (typeof daysToLive === 'string' && daysToLive.toLowerCase() == 'session') {
cookie += 'expires=Session;';
}
else {
let date = new Date();
date.setTime(date.getTime() + (daysToLive * 24 * 60 * 60 * 1000));
cookie += 'expires=' + date.toUTCString() + ';';
}
}
if (path) {
cookie += 'path=' + path + ';';
}
if (domain)
{
cookie += 'domain=' + domain + ';';
}
if (secure)
{
cookie += 'secure;';
}
if (httpOnly)
{
cookie += 'HttpOnly;';
}
if (sameSite)
{
cookie += 'SameSite=' + sameSite + ';';
}
document.cookie = cookie;
}";
}
}
+3 -1
View File
@@ -102,6 +102,8 @@ namespace TemuKJD.KJDForms.ShopForms
{
Thread.Sleep(3000);
//continue;
if (!this.Created)
break;
if (this.shop != null && currentUrl.TrimEnd('/') == shopMainUrl)
{
@@ -122,7 +124,7 @@ namespace TemuKJD.KJDForms.ShopForms
{
//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"))
&& cookieList.Any(c=>c.Name== "SUB_PASS_ID" && c.Domain == "seller.kuajingmaihuo.com"))
continue;
cookies += cookie.Name + "=" + cookie.Value + "; ";
+48 -48
View File
@@ -28,9 +28,9 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer5 = new System.Windows.Forms.SplitContainer();
this.label1 = new System.Windows.Forms.Label();
this.btnRefresh = new TemuKJD.UserControls.ButtonEx();
@@ -38,15 +38,15 @@
this.btnOpUser = new TemuKJD.UserControls.ButtonEx();
this.label30 = new System.Windows.Forms.Label();
this.label31 = new System.Windows.Forms.Label();
this.repasstextBox = new System.Windows.Forms.TextBox();
this.txtRePass = new System.Windows.Forms.TextBox();
this.label32 = new System.Windows.Forms.Label();
this.label33 = new System.Windows.Forms.Label();
this.label34 = new System.Windows.Forms.Label();
this.label35 = new System.Windows.Forms.Label();
this.label36 = new System.Windows.Forms.Label();
this.groupIdcomboBox = new System.Windows.Forms.ComboBox();
this.cmbGroup = new System.Windows.Forms.ComboBox();
this.label37 = new System.Windows.Forms.Label();
this.passwordtextBox = new System.Windows.Forms.TextBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.label38 = new System.Windows.Forms.Label();
this.mobiletextBox = new System.Windows.Forms.TextBox();
this.label39 = new System.Windows.Forms.Label();
@@ -84,15 +84,15 @@
this.splitContainer5.Panel1.Controls.Add(this.btnOpUser);
this.splitContainer5.Panel1.Controls.Add(this.label30);
this.splitContainer5.Panel1.Controls.Add(this.label31);
this.splitContainer5.Panel1.Controls.Add(this.repasstextBox);
this.splitContainer5.Panel1.Controls.Add(this.txtRePass);
this.splitContainer5.Panel1.Controls.Add(this.label32);
this.splitContainer5.Panel1.Controls.Add(this.label33);
this.splitContainer5.Panel1.Controls.Add(this.label34);
this.splitContainer5.Panel1.Controls.Add(this.label35);
this.splitContainer5.Panel1.Controls.Add(this.label36);
this.splitContainer5.Panel1.Controls.Add(this.groupIdcomboBox);
this.splitContainer5.Panel1.Controls.Add(this.cmbGroup);
this.splitContainer5.Panel1.Controls.Add(this.label37);
this.splitContainer5.Panel1.Controls.Add(this.passwordtextBox);
this.splitContainer5.Panel1.Controls.Add(this.txtPassword);
this.splitContainer5.Panel1.Controls.Add(this.label38);
this.splitContainer5.Panel1.Controls.Add(this.mobiletextBox);
this.splitContainer5.Panel1.Controls.Add(this.label39);
@@ -187,11 +187,11 @@
//
// repasstextBox
//
this.repasstextBox.Location = new System.Drawing.Point(112, 226);
this.repasstextBox.Name = "repasstextBox";
this.repasstextBox.PasswordChar = '*';
this.repasstextBox.Size = new System.Drawing.Size(148, 23);
this.repasstextBox.TabIndex = 24;
this.txtRePass.Location = new System.Drawing.Point(112, 226);
this.txtRePass.Name = "repasstextBox";
this.txtRePass.PasswordChar = '*';
this.txtRePass.Size = new System.Drawing.Size(148, 23);
this.txtRePass.TabIndex = 24;
//
// label32
//
@@ -245,19 +245,19 @@
//
// groupIdcomboBox
//
this.groupIdcomboBox.Enabled = false;
this.groupIdcomboBox.FormattingEnabled = true;
this.groupIdcomboBox.Items.AddRange(new object[] {
this.cmbGroup.Enabled = false;
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.Items.AddRange(new object[] {
"客服",
"采购",
"上货",
"数据",
"登录"});
this.groupIdcomboBox.Location = new System.Drawing.Point(112, 267);
this.groupIdcomboBox.Name = "groupIdcomboBox";
this.groupIdcomboBox.Size = new System.Drawing.Size(148, 25);
this.groupIdcomboBox.TabIndex = 26;
this.groupIdcomboBox.Text = "客服";
this.cmbGroup.Location = new System.Drawing.Point(112, 267);
this.cmbGroup.Name = "groupIdcomboBox";
this.cmbGroup.Size = new System.Drawing.Size(148, 25);
this.cmbGroup.TabIndex = 26;
this.cmbGroup.Text = "客服";
//
// label37
//
@@ -271,11 +271,11 @@
//
// passwordtextBox
//
this.passwordtextBox.Location = new System.Drawing.Point(112, 184);
this.passwordtextBox.Name = "passwordtextBox";
this.passwordtextBox.PasswordChar = '*';
this.passwordtextBox.Size = new System.Drawing.Size(148, 23);
this.passwordtextBox.TabIndex = 23;
this.txtPassword.Location = new System.Drawing.Point(112, 184);
this.txtPassword.Name = "passwordtextBox";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(148, 23);
this.txtPassword.TabIndex = 23;
//
// label38
//
@@ -325,19 +325,19 @@
//
this.dgvUser.AllowUserToAddRows = false;
this.dgvUser.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(249)))), ((int)(((byte)(249)))));
this.dgvUser.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(249)))), ((int)(((byte)(249)))));
this.dgvUser.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
this.dgvUser.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvUser.BackgroundColor = System.Drawing.Color.White;
this.dgvUser.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvUser.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvUser.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.dgvUser.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvUser.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.UserIdColumn,
@@ -348,14 +348,14 @@
this.shopCountColumn,
this.editColumn,
this.deleteColumn});
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvUser.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvUser.DefaultCellStyle = dataGridViewCellStyle6;
this.dgvUser.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvUser.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(215)))), ((int)(((byte)(229)))));
this.dgvUser.Location = new System.Drawing.Point(0, 5);
@@ -448,15 +448,15 @@
private UserControls.ButtonEx btnOpUser;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label label31;
private System.Windows.Forms.TextBox repasstextBox;
private System.Windows.Forms.TextBox txtRePass;
private System.Windows.Forms.Label label32;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.Label label34;
private System.Windows.Forms.Label label35;
private System.Windows.Forms.Label label36;
private System.Windows.Forms.ComboBox groupIdcomboBox;
private System.Windows.Forms.ComboBox cmbGroup;
private System.Windows.Forms.Label label37;
private System.Windows.Forms.TextBox passwordtextBox;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Label label38;
private System.Windows.Forms.TextBox mobiletextBox;
private System.Windows.Forms.Label label39;
@@ -25,12 +25,12 @@ namespace TemuKJD.KJDForms.ShopForms
}
private void btnOpUser_Click(object sender, EventArgs e)
{
if (passwordtextBox.Text != repasstextBox.Text)
if (txtPassword.Text != txtRePass.Text)
{
BaseMsgForm.ShowInfo("两次密码不正确", "提示");
return;
}
if (btnOpUser.Text == "添加用户" && passwordtextBox.Text.Length < 6)
if (btnOpUser.Text == "添加用户" && txtPassword.Text.Length < 6)
{
BaseMsgForm.ShowInfo("密码最少6位", "提示");
return;
@@ -48,23 +48,23 @@ namespace TemuKJD.KJDForms.ShopForms
data.Append("&sub_name=" + GetHtml.UrlEncodeUtf8(mobiletextBox.Text));
data.Append("&sub_mobile=" + GetHtml.UrlEncodeUtf8(mobiletextBox.Text));
data.Append("&card_id=");
if (groupIdcomboBox.Text == "客服")
if (cmbGroup.Text == "客服")
data.Append("&group_id=4");
else if (groupIdcomboBox.Text == "采购")
data.Append("&group_id=9");
else
{
BaseMsgForm.ShowInfo("分组不正确", "提示");
return;
}
//else if (groupIdcomboBox.Text == "采购")
// data.Append("&group_id=9");
//if (groupIdcomboBox.Text == "上货")
// data.Append("&group_id=10");
//if (groupIdcomboBox.Text == "数据")
// data.Append("&group_id=11");
//if (groupIdcomboBox.Text == "登录")
// data.Append("&group_id=8");
if (!string.IsNullOrEmpty(passwordtextBox.Text))
data.Append("&sub_password=" + Md5Base.GetMd5(passwordtextBox.Text).ToLower());
if (!string.IsNullOrEmpty(txtPassword.Text))
data.Append("&sub_password=" + Md5Base.GetMd5(txtPassword.Text).ToLower());
string url = BaseClass.BuildObjString("user/add_sub_user");
if (btnOpUser.Text != "添加用户" && !string.IsNullOrEmpty(Uid))
{
@@ -100,8 +100,8 @@ namespace TemuKJD.KJDForms.ShopForms
private void EmptyInput()
{
txtNickName.Clear();
passwordtextBox.Clear();
repasstextBox.Clear();
txtPassword.Clear();
txtRePass.Clear();
mobiletextBox.Clear();
}
@@ -156,9 +156,9 @@ namespace TemuKJD.KJDForms.ShopForms
Uid = uid;
txtNickName.Text = nickName;
mobiletextBox.Text = mobile;
groupIdcomboBox.Text = groupName;
passwordtextBox.Text = "";
repasstextBox.Text = "";
cmbGroup.Text = groupName;
txtPassword.Text = "";
txtRePass.Text = "";
btnOpUser.Text = "保存用户";
btnCancel.Visible = true;
}
@@ -182,7 +182,7 @@ namespace TemuKJD.KJDForms.ShopForms
{
if (html.Contains("\"code\":200"))
{
BaseMsgForm.ShowInfo("提交成功", "提示");
BaseMsgForm.ShowInfo("删除成功", "提示");
GetUser();
return;
}
@@ -197,11 +197,11 @@ namespace TemuKJD.KJDForms.ShopForms
private void SubAccountForm_Load(object sender, EventArgs e)
{
this.groupIdcomboBox.Enabled = false;
this.groupIdcomboBox.Items.Clear();
this.cmbGroup.Enabled = false;
this.cmbGroup.Items.Clear();
//this.groupIdcomboBox.Items.Add("上货");
//this.groupIdcomboBox.Items.Add("采购");
this.groupIdcomboBox.Items.Add("客服");
this.cmbGroup.Items.Add("客服");
//if (BaseClass.UserName == "18888888888")
//{
// this.groupIdcomboBox.Items.Add("主管");