广告直通车功能 2修复活动勾选问题 3加入发货台功能完成20%
This commit is contained in:
1 parent
a6b36c64b0
commit
e2b37df00b
35 files changed
+6832
-236
No files matched your search
+9
-5
@@ -35,14 +35,16 @@
|
||||
System.Windows.Forms.TreeNode treeNode5 = 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("商品核价");
|
||||
System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
|
||||
System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("加入发货台");
|
||||
System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1,
|
||||
treeNode2,
|
||||
treeNode3,
|
||||
treeNode4,
|
||||
treeNode5,
|
||||
treeNode6,
|
||||
treeNode7});
|
||||
treeNode7,
|
||||
treeNode8});
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
@@ -147,10 +149,12 @@
|
||||
treeNode6.Text = "库存上传";
|
||||
treeNode7.Name = "商品核价";
|
||||
treeNode7.Text = "商品核价";
|
||||
treeNode8.Name = "超级权限管理";
|
||||
treeNode8.Text = "超级权限管理";
|
||||
treeNode8.Name = "加入发货台";
|
||||
treeNode8.Text = "加入发货台";
|
||||
treeNode9.Name = "超级权限管理";
|
||||
treeNode9.Text = "超级权限管理";
|
||||
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
treeNode8});
|
||||
treeNode9});
|
||||
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
|
||||
this.tv.Size = new System.Drawing.Size(140, 446);
|
||||
this.tv.TabIndex = 1;
|
||||
|
||||
@@ -13,6 +13,7 @@ using TemuKJD.KJDForms.AdminForms;
|
||||
using TemuKJD.BaseForms;
|
||||
using TemuKJD.KJDForms.ProductSelectForms;
|
||||
using TemuKJD.KJDForms.ProductThirdSelectForms;
|
||||
using TemuKJD.KJDForms.ProductForms;
|
||||
|
||||
namespace TemuKJD.KJDForms.AdminForms
|
||||
{
|
||||
@@ -25,6 +26,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
public Lazy<DbProductSelectListManageForm> dbProductSelectListManageForm = new Lazy<DbProductSelectListManageForm>();
|
||||
public Lazy<ProductThirdSelectListManageForm> productThirdSelectListManageForm = new Lazy<ProductThirdSelectListManageForm>();
|
||||
public Lazy<AdminProductPriceCheckForm> adminProductPriceCheckForm = new Lazy<AdminProductPriceCheckForm>();
|
||||
public Lazy<JoinDeliveryFrom> joinDeliveryFrom = new Lazy<JoinDeliveryFrom>();
|
||||
|
||||
public AdminForm()
|
||||
{
|
||||
@@ -35,7 +37,8 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
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)
|
||||
{
|
||||
@@ -49,6 +52,9 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
hideName.Remove("认领待上传");
|
||||
hideName.Remove("库存上传");
|
||||
hideName.Remove("商品核价");
|
||||
#if DEBUG
|
||||
hideName.Remove("加入发货台");
|
||||
#endif
|
||||
}
|
||||
if (BaseClass.SaLevel==2)
|
||||
{
|
||||
@@ -56,6 +62,9 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
hideName.Remove("认领待上传");
|
||||
hideName.Remove("库存上传");
|
||||
hideName.Remove("商品核价");
|
||||
#if DEBUG
|
||||
hideName.Remove("加入发货台");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +112,10 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
case "商品核价":
|
||||
SetForm(adminProductPriceCheckForm.Value);
|
||||
break;
|
||||
case "加入发货台":
|
||||
joinDeliveryFrom.Value.IsAdmin = true;
|
||||
SetForm(joinDeliveryFrom.Value);
|
||||
break;
|
||||
}
|
||||
}));
|
||||
}).Start();
|
||||
|
||||
@@ -104,7 +104,9 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
|
||||
public void SearchShop(int page)
|
||||
{
|
||||
List<string> shopIdSelectList = GetCheckedShopIdList();
|
||||
List<string> userShopIdList = dgvShop.Rows.Cast<DataGridViewRow>()
|
||||
.Where(r => r.Cells["colSelect"].Value.ParseToBool())
|
||||
.Select(r => r.Cells["colShopId"].Value.ParseToString() + r.Cells["colUser"].Value.ParseToString()).ToList();
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
@@ -133,7 +135,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
int rowIndex = this.dgvShop.Rows.Add(
|
||||
shopIdSelectList.Contains(shop.ShopId + shop.UserName),
|
||||
userShopIdList.Contains(shop.ShopId + shop.UserName),
|
||||
shop.UserName,
|
||||
shop.LoginName,
|
||||
shop.ShopId,
|
||||
@@ -144,11 +146,6 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
string.Empty
|
||||
);
|
||||
displayShopStatus(shop);
|
||||
//var row = dgvShop.Rows[rowIndex];
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
//(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -159,21 +156,6 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
});
|
||||
}
|
||||
|
||||
private List<string> GetCheckedShopIdList()
|
||||
{
|
||||
List<string> shopNameList = new List<string>();
|
||||
for (int i = 0; i < dgvShop.Rows.Count; i++)
|
||||
{
|
||||
if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool())
|
||||
{
|
||||
string shopName = dgvShop.Rows[i].Cells["colShopId"].Value.ParseToString();
|
||||
shopName += dgvShop.Rows[i].Cells["colUser"].Value.ParseToString();
|
||||
shopNameList.Add(shopName);
|
||||
}
|
||||
}
|
||||
return shopNameList;
|
||||
}
|
||||
|
||||
public List<ShopLoginInfo> AdminGetServerShopLst(out int pageCount, int page = 1, int pageSize = 50)
|
||||
{
|
||||
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
|
||||
@@ -213,6 +195,21 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
txtNotes.Text = txtShopId.Text = txtShopName.Text = "";
|
||||
}
|
||||
|
||||
void displayShopStatus(ShopLoginInfo shop)
|
||||
{
|
||||
bool canUse = shop.LoginStatus2 == "国际版在线";
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colLoginName"].Value.ParseToString() == shop?.LoginName);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
@@ -248,21 +245,6 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
displayShopStatus(shop);
|
||||
}
|
||||
|
||||
void displayShopStatus(ShopLoginInfo shop)
|
||||
{
|
||||
bool canUse = shop.LoginStatus2 == "国际版在线";
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colLoginName"].Value.ParseToString() == shop?.LoginName);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
|
||||
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvCheckPrice_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
|
||||
@@ -508,7 +508,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
foreach (var sc in campanys)
|
||||
{
|
||||
sc.LoginStatus = "未登录";
|
||||
shop.Cookies = "empty=true;";
|
||||
sc.Cookies = "empty=true;";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,6 +32,10 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
public partial class AdminShopLoginForm : LRBaseForm
|
||||
{
|
||||
public int CloseAfterSecond { get; set; }
|
||||
/// <summary>
|
||||
/// 推广直通车登录
|
||||
/// </summary>
|
||||
public bool IsAdsLogin { get; set; } = false;
|
||||
public EnumOpenType openType = EnumOpenType.manage;
|
||||
public bool isMultiLogin = false;
|
||||
public string MultiLoginCookieName = "";
|
||||
@@ -234,7 +238,7 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
List<Cookie> cookieList2 = CEFBrowser.GetCookieList(shopCookieHead2, cefWebBrowser.GetCookieManager(null)); // cef138
|
||||
if (cookieList2 != null && cookieList2.Count > 0)
|
||||
{
|
||||
for(int i =0; i < cookieList2.Count; i++)
|
||||
for(int i = 0; i < cookieList2.Count; i++)
|
||||
{
|
||||
var cookie = cookieList2[i];
|
||||
cookies2 += cookie.Name + "=" + cookie.Value + "; ";
|
||||
@@ -280,24 +284,104 @@ namespace TemuKJD.KJDForms.AdminForms
|
||||
ShopListForm.UpdateServerShopCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
}
|
||||
OnSaveComplete(shop);
|
||||
if (this.Created && this.chkCloseAfterLogin.Checked)
|
||||
if (!IsAdsLogin)
|
||||
{
|
||||
//Invoke(new Action(() => { this.Close(); }));
|
||||
if (this.Created && this.chkCloseAfterLogin.Checked)
|
||||
Invoke(new Action(() => { this.Close(); }));
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsAdsLogin && !string.IsNullOrEmpty(shop.ad_seller_unique_id) && 1 == 2)
|
||||
{
|
||||
var obtainCodeRst = ShopListForm.GetObtainCode(shop);
|
||||
var obtainCode = BaseRegex.GetStringJson(ref obtainCodeRst, "code");
|
||||
//https://ads.temu.com/login.html?
|
||||
//redirectUrl=https%3A%2F%2Fads.temu.com%2Findex.html%3FadAreaOverride%3D2&userType=1&mallType=0
|
||||
//&ticket=Zjze2NHyZFaGP88ROyjN19a47ae59611391a296ae6403bbbfa39e9046ceba744aafe8227fd6
|
||||
//&adSellerUniqueId=eyJ1IjoiTVF3NFRGVmN2ZUVyZG1USDdOQ2o5dz09IiwidiI6MX0%3D&source=2&seller_source=11&adAreaOverride=2
|
||||
string url = "https://ads.temu.com/login.html?" +
|
||||
"redirectUrl=https%3A%2F%2Fads.temu.com%2Findex.html%3FadAreaOverride%3D2&userType=1&mallType=0&ticket=" + obtainCode +
|
||||
"&adSellerUniqueId=" + shop.ad_seller_unique_id + "&source=2&seller_source=11&adAreaOverride=2";
|
||||
cefWebBrowser.Load(url);
|
||||
}
|
||||
else if (IsAdsLogin)
|
||||
{
|
||||
cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(sGetElementWithText);
|
||||
|
||||
//点击商品推广按钮
|
||||
var adsJsStr = "window.scrollTo(0, document.body.scrollHeight);";
|
||||
var adsResponse = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(adsJsStr);
|
||||
adsResponse.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
|
||||
adsJsStr = "var clickItem = getElementWithText('商品推广'); " +
|
||||
"clickItem.click()";
|
||||
adsResponse = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(adsJsStr);
|
||||
adsResponse.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(500, 1000));
|
||||
|
||||
// 模拟人为点击一次,否则窗口不跳转
|
||||
var host = cefWebBrowser.GetBrowser().GetHost();
|
||||
int x = Randomx.GetId(50, 200);
|
||||
int y = Randomx.GetId(1, 10);
|
||||
// 按下鼠标左键
|
||||
host.SendMouseClickEvent(x, y, MouseButtonType.Left, false, 1, CefEventFlags.None);
|
||||
Thread.Sleep(50 + Randomx.GetId(200));
|
||||
host.SendMouseClickEvent(x, y, MouseButtonType.Left, true, 1, CefEventFlags.None);
|
||||
Thread.Sleep(Randomx.GetId(100, 500));
|
||||
|
||||
//点击确认授权并前往按钮
|
||||
adsJsStr = "var clickItem = getElementWithText('确认授权并前往'); " +
|
||||
"clickItem.parentElement.click();";
|
||||
adsResponse = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(adsJsStr);
|
||||
adsResponse.Wait(1000);
|
||||
Thread.Sleep(Randomx.GetId(300, 800));
|
||||
}
|
||||
}
|
||||
|
||||
if (1 == 1 && this.shop != null && currentUrl.StartsWith("https://ads.temu.com/index.html?adAreaOverride="))
|
||||
{
|
||||
if (!cefWebBrowser.GetBrowser().MainFrame.IsValid)
|
||||
continue;
|
||||
|
||||
if (openType != EnumOpenType.login)
|
||||
continue;
|
||||
|
||||
if (!lstShopCompany.Any(c => c.AccountId == shop.ShopId))
|
||||
continue;
|
||||
|
||||
shop.ad_url = txtAddress.Text;
|
||||
string cookiesAds = "";
|
||||
List<Cookie> cookieAdsList = CEFBrowser.GetCookieList("ads.temu.com", cefWebBrowser.GetCookieManager(null));
|
||||
if (cookieAdsList != null && cookieAdsList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < cookieAdsList.Count; i++)
|
||||
{
|
||||
var cookie = cookieAdsList[i];
|
||||
cookiesAds += cookie.Name + "=" + cookie.Value + "; ";
|
||||
}
|
||||
cookiesAds = cookiesAds.Trim().TrimEnd(';');
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(cookiesAds))
|
||||
{
|
||||
shop.ad_login_status = "在线";
|
||||
shop.ad_cookie = cookiesAds;
|
||||
StartUp.SaveLocalShopLoginInfo(); // 店铺保存到本地
|
||||
ShopListForm.UpdateServerShopAdsCookies(shop); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie
|
||||
OnSaveComplete(shop);
|
||||
if (this.Created && this.chkCloseAfterLogin.Checked)
|
||||
{
|
||||
Invoke(new Action(() => { this.Close(); }));
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
var obtainCodeRst = ShopListForm.GetObtainCode(shop);
|
||||
var obtainCode = BaseRegex.GetStringJson(ref obtainCodeRst, "code");
|
||||
//https://ads.temu.com/login.html?
|
||||
//redirectUrl=https%3A%2F%2Fads.temu.com%2Findex.html%3FadAreaOverride%3D2&userType=1&mallType=0
|
||||
//&ticket=Zjze2NHyZFaGP88ROyjN19a47ae59611391a296ae6403bbbfa39e9046ceba744aafe8227fd6
|
||||
//&adSellerUniqueId=eyJ1IjoiTVF3NFRGVmN2ZUVyZG1USDdOQ2o5dz09IiwidiI6MX0%3D&source=2&seller_source=11&adAreaOverride=2
|
||||
string url = "https://ads.temu.com/login.html?" +
|
||||
"redirectUrl=https%3A%2F%2Fads.temu.com%2Findex.html%3FadAreaOverride%3D2&userType=1&mallType=0&ticket=" + obtainCode +
|
||||
"&source=2&seller_source=11&adAreaOverride=2";
|
||||
cefWebBrowser.Load(url);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user