优化了微店商品上传 优化pdd买手读单
This commit is contained in:
1 parent
6c4f16b897
commit
f360688c43
62 files changed
+5620
-1432
No files matched your search
+12
-8
@@ -40,8 +40,9 @@
|
||||
System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("库存上传");
|
||||
System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("商品核价");
|
||||
System.Windows.Forms.TreeNode treeNode12 = new System.Windows.Forms.TreeNode("随机厂商商品");
|
||||
System.Windows.Forms.TreeNode treeNode13 = new System.Windows.Forms.TreeNode("微店管理");
|
||||
System.Windows.Forms.TreeNode treeNode14 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
|
||||
System.Windows.Forms.TreeNode treeNode13 = new System.Windows.Forms.TreeNode("商品导入");
|
||||
System.Windows.Forms.TreeNode treeNode14 = new System.Windows.Forms.TreeNode("微店管理");
|
||||
System.Windows.Forms.TreeNode treeNode15 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1,
|
||||
treeNode2,
|
||||
treeNode3,
|
||||
@@ -54,7 +55,8 @@
|
||||
treeNode10,
|
||||
treeNode11,
|
||||
treeNode12,
|
||||
treeNode13});
|
||||
treeNode13,
|
||||
treeNode14});
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
@@ -169,12 +171,14 @@
|
||||
treeNode11.Text = "商品核价";
|
||||
treeNode12.Name = "随机厂商商品";
|
||||
treeNode12.Text = "随机厂商商品";
|
||||
treeNode13.Name = "微店管理";
|
||||
treeNode13.Text = "微店管理";
|
||||
treeNode14.Name = "超级权限管理";
|
||||
treeNode14.Text = "超级权限管理";
|
||||
treeNode13.Name = "商品导入";
|
||||
treeNode13.Text = "商品导入";
|
||||
treeNode14.Name = "微店管理";
|
||||
treeNode14.Text = "微店管理";
|
||||
treeNode15.Name = "超级权限管理";
|
||||
treeNode15.Text = "超级权限管理";
|
||||
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
treeNode14});
|
||||
treeNode15});
|
||||
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;
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BaseForms;
|
||||
using TemuKJD.PDDForms.ProductForms;
|
||||
using TemuKJD.PDDForms.ProductSelectForms;
|
||||
using TemuKJD.ToolForms;
|
||||
//using TemuKJD.KJDForms.ProductSelectForms;
|
||||
@@ -28,6 +29,7 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
public Lazy<PDDGetChanceProdByImgForm> getChanceProdByImgForm = new Lazy<PDDGetChanceProdByImgForm>();
|
||||
public Lazy<GetJuShuitanProdForm> getJuShuitanProdForm = new Lazy<GetJuShuitanProdForm>();
|
||||
public Lazy<RandomComProductForm> randomComProductForm = new Lazy<RandomComProductForm>();
|
||||
public Lazy<ExprotProductForm> importProdForm = new Lazy<ExprotProductForm>();
|
||||
public Lazy<VDianUploadProductForm> vDianUploadProductForm = new Lazy<VDianUploadProductForm>();
|
||||
//public Lazy<DbPriceMarkUpForm> dbPriceMarkUpForm = new Lazy<DbPriceMarkUpForm>();
|
||||
//public Lazy<DbProductSelectListManageForm> dbProductSelectListManageForm = new Lazy<DbProductSelectListManageForm>();
|
||||
@@ -108,6 +110,9 @@ namespace TemuKJD.PDDForms.AdminForms
|
||||
case "随机厂商商品":
|
||||
SetForm(randomComProductForm.Value);
|
||||
break;
|
||||
case "商品导入":
|
||||
SetForm(importProdForm.Value);
|
||||
break;
|
||||
case "微店管理":
|
||||
SetForm(vDianUploadProductForm.Value);
|
||||
break;
|
||||
|
||||
@@ -2861,7 +2861,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (isForceRefresh || (shop.AuthAddTime <= DateTime.Now.AddDays(-1) && shop.AuthExpiresTime <= DateTime.Now))
|
||||
if (isForceRefresh || (shop.AuthUpdateTime <= DateTime.Now.AddDays(-1) && shop.AuthExpiresTime <= DateTime.Now))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -2876,26 +2876,26 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
|
||||
}));
|
||||
}
|
||||
}
|
||||
List<List<AuthInfo>> NewApiInfolsts = JsonHelper.DeserializeJsonToList<List<AuthInfo>>(JsonHelper.SerializeObject(GlobalConfig.ShopLoginList.Select(s => s.ApiAuthInfoList).ToList()));
|
||||
foreach (var newLst in NewApiInfolsts)
|
||||
{
|
||||
if (newLst.FirstOrDefault()!= null)
|
||||
{
|
||||
var oldApiAuths = PddApiHelper.LstAuthInfos.FirstOrDefault(oldLst => oldLst.FirstOrDefault()?.ShopId == newLst.FirstOrDefault().ShopId);
|
||||
if (oldApiAuths != null)
|
||||
{
|
||||
oldApiAuths.Clear();
|
||||
oldApiAuths.AddRange(newLst);
|
||||
}
|
||||
else
|
||||
{
|
||||
PddApiHelper.LstAuthInfos.Add(newLst);
|
||||
}
|
||||
}
|
||||
}
|
||||
//List<List<AuthInfo>> NewApiInfolsts = JsonHelper.DeserializeJsonToList<List<AuthInfo>>(JsonHelper.SerializeObject(GlobalConfig.ShopLoginList.Select(s => s.ApiAuthInfoList).ToList()));
|
||||
//foreach (var newLst in NewApiInfolsts)
|
||||
//{
|
||||
// if (newLst.FirstOrDefault()!= null)
|
||||
// {
|
||||
// var oldApiAuths = PddApiHelper.LstAuthInfos.FirstOrDefault(oldLst => oldLst.FirstOrDefault()?.ShopId == newLst.FirstOrDefault().ShopId);
|
||||
// if (oldApiAuths != null)
|
||||
// {
|
||||
// oldApiAuths.Clear();
|
||||
// oldApiAuths.AddRange(newLst);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PddApiHelper.LstAuthInfos.Add(newLst);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
PddApiHelper.LstAuthInfos = PddApiHelper.LstAuthInfos.Where(a => a.OrderBy(o => o.AddTime).LastOrDefault().AddTime > DateTime.Now.AddDays(-30)).ToList();
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_shop_api_auth_info_lists", PddApiHelper.LstAuthInfos);
|
||||
//PddApiHelper.LstAuthInfos = PddApiHelper.LstAuthInfos.Where(a => a.OrderBy(o => o.UpdateTime).LastOrDefault().UpdateTime > DateTime.Now.AddDays(-30)).ToList();
|
||||
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_shop_api_auth_info_lists", PddApiHelper.LstAuthInfos);
|
||||
Invoke(new Action(() => { pbShopLoading.Visible = false; }));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
namespace TemuKJD.PDDForms.ProductForms
|
||||
{
|
||||
partial class ExprotProductForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.btnExportWxApp = new DevComponents.DotNetBar.PanelEx();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.White;
|
||||
this.panel1.Controls.Add(this.statusBar);
|
||||
this.panel1.Controls.Add(this.btnExportWxApp);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(800, 450);
|
||||
this.panel1.TabIndex = 432;
|
||||
//
|
||||
// statusBar
|
||||
//
|
||||
this.statusBar.BackColor = System.Drawing.Color.White;
|
||||
this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.statusBar.Location = new System.Drawing.Point(0, 427);
|
||||
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.statusBar.Name = "statusBar";
|
||||
this.statusBar.Size = new System.Drawing.Size(800, 23);
|
||||
this.statusBar.TabIndex = 435;
|
||||
//
|
||||
// btnExportWxApp
|
||||
//
|
||||
this.btnExportWxApp.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnExportWxApp.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnExportWxApp.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnExportWxApp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnExportWxApp.Location = new System.Drawing.Point(32, 26);
|
||||
this.btnExportWxApp.Name = "btnExportWxApp";
|
||||
this.btnExportWxApp.Size = new System.Drawing.Size(167, 23);
|
||||
this.btnExportWxApp.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnExportWxApp.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnExportWxApp.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnExportWxApp.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.btnExportWxApp.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.btnExportWxApp.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.btnExportWxApp.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.btnExportWxApp.Style.GradientAngle = 90;
|
||||
this.btnExportWxApp.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnExportWxApp.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnExportWxApp.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnExportWxApp.TabIndex = 431;
|
||||
this.btnExportWxApp.Text = "微信App商品";
|
||||
this.btnExportWxApp.Click += new System.EventHandler(this.btnExportWxApp_Click);
|
||||
//
|
||||
// ExprotProductForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "ExprotProductForm";
|
||||
this.Text = "ExprotProductForm";
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevComponents.DotNetBar.PanelEx btnExportWxApp;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private UserControls.StatusBarUserControl statusBar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
using AllBase;
|
||||
using AllBase.Model.Result.WXResult;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BaseForms;
|
||||
using Work;
|
||||
|
||||
namespace TemuKJD.PDDForms.ProductForms
|
||||
{
|
||||
public partial class ExprotProductForm : BaseForms.BaseForm
|
||||
{
|
||||
public ExprotProductForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnExportWxApp_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Multiselect = true;
|
||||
// 设置过滤条件,只显示文本文件
|
||||
openFileDialog.Filter = "文本文件 (*.txt)|*.txt|All files (*.*)|*.*";
|
||||
// 显示对话框并获取结果
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var filePathLst = openFileDialog.FileNames.ToList();
|
||||
//pbLoading.Visible = true;
|
||||
this.statusBar.pgbTaskProgress.Maximum = filePathLst.Count;
|
||||
this.statusBar.UpdateProgressBar(0);
|
||||
Task.Run(() =>
|
||||
{
|
||||
int successNum = 0;
|
||||
int failedNum = 0;
|
||||
foreach (var path in filePathLst)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在导入 " + (successNum + failedNum) + "/" + filePathLst.Count + " 成功:" + successNum + " 失败:" + failedNum;
|
||||
}));
|
||||
//string content = "";
|
||||
string rst = "";
|
||||
try
|
||||
{
|
||||
rst = getProd(path);
|
||||
if (!rst.Contains("成功"))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
rst = ex.Message;
|
||||
}
|
||||
if (string.IsNullOrEmpty(rst) || rst.Contains("入库成功"))
|
||||
successNum++;
|
||||
else
|
||||
failedNum++;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
|
||||
this.statusBar.lblTaskStatus.Text = "正在导入 " + (successNum + failedNum) + "/" + filePathLst.Count + " 成功:" + successNum + " 失败:" + failedNum;
|
||||
}));
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
//pbLoading.Visible = false;
|
||||
this.statusBar.lblTaskStatus.Text = "导入完成" + (successNum + failedNum) + "/" + filePathLst.Count + " 成功:" + successNum + " 失败:" + failedNum;
|
||||
BaseMsgForm.ShowInfo("导入完成!");
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
string getProd(string filePath)
|
||||
{
|
||||
string prodStr = "";
|
||||
//prodStr = Encoding.UTF8.GetString(this.FileUpload1.FileBytes);
|
||||
//prodStr = TextBox2.Text.Trim();
|
||||
//prodStr = FileBase.ReadAllText(filePath, Encoding.UTF8);
|
||||
|
||||
using (StreamReader sr = new StreamReader(filePath))
|
||||
{
|
||||
prodStr = sr.ReadToEnd();
|
||||
|
||||
}
|
||||
|
||||
var reducePer = filePath.Replace(".txt", "").Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault().ParseToInt();
|
||||
if (reducePer > 0)
|
||||
prodStr = "{\"reducePre\":" + reducePer + "}" + prodStr;
|
||||
var realPricePer = 1m - reducePer * 0.01m;
|
||||
if (realPricePer < 0.1m)
|
||||
realPricePer = 0.1m;
|
||||
|
||||
WXClientProductInfoLite wxClientProd = new WXClientProductInfoLite();
|
||||
|
||||
var str_lst = BaseRegex.GetJsonObjStrJson(ref prodStr, "product_key");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.product_key = JsonHelper.DeserializeJsonToObject<wx_client_prod_key>(regex_str);
|
||||
if (wxClientProd.product_key == null)
|
||||
return "解析失败product_key";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败product_key";
|
||||
}
|
||||
|
||||
//商品详情格式
|
||||
wxClientProd.info = new wx_client_prod_info();
|
||||
|
||||
//主标题
|
||||
wxClientProd.info.title = BaseRegex.GetStringJson(ref prodStr, "title");
|
||||
if (wxClientProd.info.title.IsNullOrEmpty())
|
||||
return "解析失败title";
|
||||
|
||||
//副标题
|
||||
wxClientProd.info.sub_title = BaseRegex.GetStringJson(ref prodStr, "sub_title");
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "head_img");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.head_img = JsonHelper.DeserializeJsonToListNullable<string>(regex_str);
|
||||
if (wxClientProd.info.head_img == null)
|
||||
return "解析失败sub_title";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败sub_title";
|
||||
}
|
||||
|
||||
var nodeCatId = BaseRegex.GetStringJson(ref prodStr, "nodeCatId");
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "category");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.category = JsonHelper.DeserializeJsonToListNullable<wx_client_category>(regex_str);
|
||||
if (wxClientProd.info.category != null && !str_lst.IsNullOrEmpty() && !wxClientProd.info.category.Any(c => c.catIdStr == nodeCatId))
|
||||
{
|
||||
wxClientProd.info.category.Add(new wx_client_category() { catId = nodeCatId, cat_id = nodeCatId });
|
||||
}
|
||||
//if (wxClientProd.info.category == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败category";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonObjStrJson(ref prodStr, "detail");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.detail = JsonHelper.DeserializeJsonToObjectNullable<wx_client_prod_detail>(regex_str);
|
||||
if (wxClientProd.info.detail == null)
|
||||
{
|
||||
wxClientProd.info.detail = new wx_client_prod_detail();
|
||||
wxClientProd.info.detail.detail_img.Add(wxClientProd.info.head_img.FirstOrDefault());
|
||||
}
|
||||
|
||||
//if (wxClientProd.info.detail == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败detail";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "param");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.param = JsonHelper.DeserializeJsonToListNullable<wx_client_param>(regex_str);
|
||||
if (wxClientProd.info.param == null)
|
||||
wxClientProd.info.param = new List<wx_client_param>();
|
||||
//if (wxClientProd.info.param == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败param";
|
||||
}
|
||||
|
||||
//品牌id
|
||||
wxClientProd.info.brand_id = BaseRegex.GetStringJson(ref prodStr, "brand_id");
|
||||
//if (wxClientProd.info.brand_id.IsNullOrEmpty())
|
||||
// return "解析失败";
|
||||
|
||||
str_lst = BaseRegex.GetJsonObjStrJson(ref prodStr, "sku_id_list");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.sku_id_list = JsonHelper.DeserializeJsonToObjectNullable<wx_client_sku_id_list>(regex_str);
|
||||
//if (wxClientProd.info.sku_id_list == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败sku_id_list";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonObjStrJson(ref prodStr, "sku_list");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.sku_list = JsonHelper.DeserializeJsonToObjectNullable<wx_sku>(regex_str);
|
||||
//if (wxClientProd.info.sku_list == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败sku_id_list";
|
||||
}
|
||||
|
||||
if (wxClientProd.info.sku_list == null)
|
||||
{
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "sku_info");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
var sku_infos = JsonHelper.DeserializeJsonToListNullable<wx_client_sku_info>(regex_str);
|
||||
if (sku_infos != null)
|
||||
{
|
||||
wxClientProd.info.sku_list = new wx_sku();
|
||||
wxClientProd.info.sku_list.sku_info = sku_infos;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败sku_info";
|
||||
}
|
||||
}
|
||||
|
||||
// 佣金商品 根据折扣价格和佣金比例减去佣金
|
||||
if (wxClientProd.info.sku_list != null)
|
||||
{
|
||||
foreach (var sku in wxClientProd.info.sku_list.sku_info)
|
||||
{
|
||||
sku.price = (sku.price - (sku.price - sku.discounted_price) * (1m - realPricePer)).ParseToInt();
|
||||
}
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "product_sale_attrs");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.product_sale_attrs = JsonHelper.DeserializeJsonToListNullable<wx_client_product_sale_attr>(regex_str);
|
||||
//if (wxClientProd.info.product_sale_attrs == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败product_sale_attrs";
|
||||
}
|
||||
|
||||
|
||||
//总销量
|
||||
wxClientProd.info.total_sold_num = BaseRegex.GetStringJson(ref prodStr, "total_sold_num");
|
||||
//if (wxClientProd.info.total_sold_num.IsNullOrEmpty())
|
||||
// return "解析失败";
|
||||
|
||||
str_lst = BaseRegex.GetJsonObjStrJson(ref prodStr, "service_desc");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.service_desc = JsonHelper.DeserializeJsonToObjectNullable<wx_client_service_desc>(regex_str);
|
||||
//if (wxClientProd.info.service_desc == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败service_desc";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonObjStrJson(ref prodStr, "express_info");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.express_info = JsonHelper.DeserializeJsonToObjectNullable<wx_client_express_info>(regex_str);
|
||||
//if (wxClientProd.info.express_info == null)
|
||||
// return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败express_info";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "headVideoInfo");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.headVideoInfo = JsonHelper.DeserializeJsonToListNullable<wx_client_head_video_info>(regex_str);
|
||||
//if (wxClientProd.info.headVideoInfo == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败headVideoInfo";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonObjStrJson(ref prodStr, "afterSaleInfo");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.afterSaleInfo = JsonHelper.DeserializeJsonToObjectNullable<object>(regex_str);
|
||||
//if (wxClientProd.info.afterSaleInfo == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败afterSaleInfo";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "deliveryExpressFee");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.deliveryExpressFee = JsonHelper.DeserializeJsonToListNullable<object>(regex_str);
|
||||
//if (wxClientProd.info.deliveryExpressFee == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败deliveryExpressFee";
|
||||
}
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "templateInfo");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.info.templateInfo = JsonHelper.DeserializeJsonToListNullable<object>(regex_str);
|
||||
//if (wxClientProd.info.templateInfo == null)
|
||||
// return "解析失败";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败templateInfo";
|
||||
}
|
||||
|
||||
wxClientProd.info.spuCode = BaseRegex.GetStringJson(ref prodStr, "spuCode");
|
||||
|
||||
str_lst = BaseRegex.GetJsonArrStrJson(ref prodStr, "productSkus");
|
||||
try
|
||||
{
|
||||
var regex_str = str_lst.OrderByDescending(s => s.Length).FirstOrDefault();
|
||||
wxClientProd.productSkus = JsonHelper.DeserializeJsonToList<WXProductSkuInfoLite>(regex_str);
|
||||
if (wxClientProd.productSkus == null)
|
||||
return "解析失败productSkus";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "解析失败productSkus";
|
||||
}
|
||||
|
||||
// 佣金商品 根据价格给售卖价格赋值,如果价格丢失,直接在售卖价上计算
|
||||
foreach (var sku in wxClientProd.productSkus)
|
||||
{
|
||||
var wxDisSku = wxClientProd.info.sku_list?.sku_info?.FirstOrDefault(s => s.sku_id == sku.skuKey.skuId);
|
||||
if (wxDisSku != null)
|
||||
sku.productSkuInfo.salePrice = wxDisSku.price;
|
||||
else
|
||||
sku.productSkuInfo.salePrice = (sku.productSkuInfo.salePrice - sku.productSkuInfo.salePrice * realPricePer).ParseToInt();
|
||||
}
|
||||
|
||||
if (wxClientProd.productSkus.Min(s => s.productSkuInfo.salePrice * 0.01m) == 0)
|
||||
{
|
||||
return "解析失败Sku价格为0";
|
||||
}
|
||||
|
||||
return SaveWxProd(wxClientProd.product_key.product_id, wxClientProd, prodStr);
|
||||
}
|
||||
|
||||
string SaveWxProd(string prodId, WXClientProductInfoLite wxClientProdInfoLite, string baseStr)
|
||||
{
|
||||
bool isExist = false;
|
||||
var existUrl = BaseClass.BuildPDDObjString("product/get_product_spu_id_list");
|
||||
string existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prodId;
|
||||
//if (!string.IsNullOrEmpty(prod.dbProduct.real_spu_id))
|
||||
// existData = UserLogin.GetSignaturex() + "&search_spu_ids=" + prod.spuId + "," + prod.dbProduct.real_spu_id;
|
||||
string html = GetHtml.PostUtf8(existUrl, existData);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(existUrl, existData);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
return "采集入库失败,产品数据库连接失败";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
|
||||
isExist = true;
|
||||
}
|
||||
|
||||
var url = BaseClass.BuildPDDObjString("product/add_product");
|
||||
if (isExist)
|
||||
url = BaseClass.BuildPDDObjString("product/mdy_product");
|
||||
|
||||
var skus = wxClientProdInfoLite.productSkus;
|
||||
|
||||
var product_json = "{\"wxxdData\":" + JsonHelper.SerializeObject(wxClientProdInfoLite) + ",\"baseData\":" + JsonHelper.SerializeObject(baseStr) + "}";
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&from_shop_id=" + wxClientProdInfoLite.product_key.appid +
|
||||
"&from_shop_name=" + wxClientProdInfoLite.product_key.appid +
|
||||
"&spu_id=" + prodId +
|
||||
"&skc_id=" + prodId +
|
||||
"&price_text=" + skus.Min(s => s.productSkuInfo.salePrice * 0.01m) + " - " + skus.Max(s => s.productSkuInfo.salePrice * 0.01m) +
|
||||
"&ext_code=" + wxClientProdInfoLite.info.spuCode +
|
||||
"&product_name=" + HttpUtility.UrlEncode(wxClientProdInfoLite.info.title, Encoding.UTF8) +
|
||||
"&product_json=" + HttpUtility.UrlEncode(product_json, Encoding.UTF8) + // product_json /*HttpUtility.UrlEncode(JsonUtils.SerializeObject(wxClientProdInfoLite), Encoding.UTF8)*/
|
||||
"&sale_count=" + wxClientProdInfoLite.info.total_sold_num +
|
||||
"&sale_count_text=" + wxClientProdInfoLite.info.total_sold_num +
|
||||
"&main_img=" + HttpUtility.UrlEncode(wxClientProdInfoLite.info.head_img.FirstOrDefault(), Encoding.UTF8) +
|
||||
"&wx_safe_status=" + HttpUtility.UrlEncode("安全商品", Encoding.UTF8) +
|
||||
"&product_get_type=" + HttpUtility.UrlEncode("微信小店", Encoding.UTF8);
|
||||
|
||||
if (wxClientProdInfoLite.info.category.Count > 0)
|
||||
{
|
||||
data += "&wx_cat_1=" + wxClientProdInfoLite.info.category[0].catIdStr;
|
||||
data += "&main_cat_id=" + wxClientProdInfoLite.info.category[0].catIdStr;
|
||||
data += "&main_cat_name=" + wxClientProdInfoLite.info.category[0].name;
|
||||
|
||||
data += "&wx_cat_leaf=" + wxClientProdInfoLite.info.category.LastOrDefault()?.catIdStr;
|
||||
data += "&cat_id=" + wxClientProdInfoLite.info.category.LastOrDefault()?.catIdStr;
|
||||
data += "&cat_name=" + HttpUtility.UrlEncode((wxClientProdInfoLite.info.category.LastOrDefault()?.name).ParseToString(), Encoding.UTF8);
|
||||
}
|
||||
if (wxClientProdInfoLite.info.category.Count > 1)
|
||||
{
|
||||
data += "&wx_cat_2=" + wxClientProdInfoLite.info.category[1].catIdStr;
|
||||
}
|
||||
if (wxClientProdInfoLite.info.category.Count > 2)
|
||||
{
|
||||
data += "&wx_cat_3=" + wxClientProdInfoLite.info.category[2].catIdStr;
|
||||
}
|
||||
|
||||
if (wxClientProdInfoLite.info.category.FirstOrDefault().name == "图书")
|
||||
{
|
||||
data += "&special_prod_type=" + HttpUtility.UrlEncode("书籍", Encoding.UTF8);
|
||||
}
|
||||
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
string msg = "商品入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
// row.Cells["colMsg"].Value = msg;
|
||||
//}));
|
||||
return msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
//prod.getProductMsg = "商品入库成功!";
|
||||
//Invoke(new Action(() =>
|
||||
//{
|
||||
// row.Cells["colMsg"].Value = prod.getProductMsg;
|
||||
//}));
|
||||
if (!isExist)
|
||||
{
|
||||
url = BaseClass.BuildPDDObjString("product/mdy_product");
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
string msg = "商品入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
return "微信商品采集入库成功!";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
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
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<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
|
||||
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
|
||||
mimetype set.
|
||||
|
||||
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
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
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
|
||||
: 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
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -43,8 +43,8 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
|
||||
if (info.updateDay == DateTime.Now.ToString("yyMMdd"))
|
||||
{
|
||||
// 今日同步过,跳过
|
||||
continue;
|
||||
// 今日同步过,跳过,暂时关闭改为每次打开立即读取
|
||||
//continue;
|
||||
}
|
||||
|
||||
info.failReason = "";
|
||||
@@ -148,8 +148,8 @@ namespace TemuKJD.PDDForms.ProductForms
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
// 休眠一小时
|
||||
Thread.Sleep(1000 * 60 * 60);
|
||||
// 休眠两个小时
|
||||
Thread.Sleep(1000 * 60 * 60 * 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+661
-545
File diff suppressed because it is too large.
Load diff
@@ -412,6 +412,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
data += "&problem_prod_data=2";
|
||||
else if (!string.IsNullOrEmpty(cmbHasReturn.Text.Trim()))
|
||||
data += "&problem_prod_data=" + cmbHasReturn.Text.Trim();
|
||||
|
||||
|
||||
if (cmbPddRelation.Text == "否")
|
||||
data += "&is_relation=0";
|
||||
else if (cmbPddRelation.Text == "是")
|
||||
data += "&is_relation=1";
|
||||
}));
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
@@ -526,6 +532,24 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
var cate3 = cates3.FirstOrDefault(c => c.level == 3 && c.name == cmbCat1.Text.Trim());
|
||||
}
|
||||
|
||||
private void dgvDbProduct_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvDbProduct.Columns[e.ColumnIndex].HeaderText;
|
||||
var dbId = dgvDbProduct.Rows[e.RowIndex].Cells["col_db_id"].Value.ParseToString();
|
||||
var dbProduct = lstTemuDbProduct.FirstOrDefault(p => p.id.ToString() == dbId);
|
||||
|
||||
switch (headerText)
|
||||
{
|
||||
case "标题":
|
||||
dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvDbProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
|
||||
@@ -40,6 +40,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
|
||||
this.txtMultiPcsSku4 = new System.Windows.Forms.TextBox();
|
||||
this.label27 = new System.Windows.Forms.Label();
|
||||
this.txtMultiPcsSku3 = new System.Windows.Forms.TextBox();
|
||||
this.txtMultiPcsSku2 = new System.Windows.Forms.TextBox();
|
||||
this.txtMultiPcsSku1 = new System.Windows.Forms.TextBox();
|
||||
@@ -96,6 +98,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.line2 = new DevComponents.DotNetBar.Controls.Line();
|
||||
this.label26 = new System.Windows.Forms.Label();
|
||||
this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
|
||||
this.chkRelation = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.cmbCateFilter3 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
|
||||
this.label25 = new System.Windows.Forms.Label();
|
||||
this.cmbCateFilter2 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
|
||||
@@ -186,8 +189,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.btnClear = new DevComponents.DotNetBar.PanelEx();
|
||||
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.txtMultiPcsSku4 = new System.Windows.Forms.TextBox();
|
||||
this.label27 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -306,6 +307,27 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucGroupBoxEx2.TabStop = false;
|
||||
this.ucGroupBoxEx2.Text = "商品上传";
|
||||
//
|
||||
// txtMultiPcsSku4
|
||||
//
|
||||
this.txtMultiPcsSku4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtMultiPcsSku4.Location = new System.Drawing.Point(849, 109);
|
||||
this.txtMultiPcsSku4.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtMultiPcsSku4.Name = "txtMultiPcsSku4";
|
||||
this.txtMultiPcsSku4.Size = new System.Drawing.Size(25, 23);
|
||||
this.txtMultiPcsSku4.TabIndex = 884;
|
||||
this.txtMultiPcsSku4.Text = "1.1";
|
||||
//
|
||||
// label27
|
||||
//
|
||||
this.label27.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label27.AutoSize = true;
|
||||
this.label27.Location = new System.Drawing.Point(812, 112);
|
||||
this.label27.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label27.Name = "label27";
|
||||
this.label27.Size = new System.Drawing.Size(41, 17);
|
||||
this.label27.TabIndex = 883;
|
||||
this.label27.Text = "价格×";
|
||||
//
|
||||
// txtMultiPcsSku3
|
||||
//
|
||||
this.txtMultiPcsSku3.Location = new System.Drawing.Point(787, 109);
|
||||
@@ -486,7 +508,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.btnApiUpload.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnApiUpload.TabIndex = 742;
|
||||
this.btnApiUpload.Text = "批量上传";
|
||||
this.btnApiUpload.Visible = false;
|
||||
this.btnApiUpload.Click += new System.EventHandler(this.btnApiUpload_Click);
|
||||
//
|
||||
// btnUpload
|
||||
@@ -1027,6 +1048,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ucGroupBoxEx4.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.ucGroupBoxEx4.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
|
||||
this.ucGroupBoxEx4.Controls.Add(this.chkRelation);
|
||||
this.ucGroupBoxEx4.Controls.Add(this.cmbCateFilter3);
|
||||
this.ucGroupBoxEx4.Controls.Add(this.label25);
|
||||
this.ucGroupBoxEx4.Controls.Add(this.cmbCateFilter2);
|
||||
@@ -1057,6 +1079,18 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.ucGroupBoxEx4.TabStop = false;
|
||||
this.ucGroupBoxEx4.Text = "待传商品";
|
||||
//
|
||||
// chkRelation
|
||||
//
|
||||
this.chkRelation.Checked = true;
|
||||
this.chkRelation.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chkRelation.Location = new System.Drawing.Point(262, 76);
|
||||
this.chkRelation.Name = "chkRelation";
|
||||
this.chkRelation.Size = new System.Drawing.Size(64, 21);
|
||||
this.chkRelation.TabIndex = 856;
|
||||
this.chkRelation.Text = "转换数据";
|
||||
this.chkRelation.UseVisualStyleBackColor = true;
|
||||
this.chkRelation.Visible = false;
|
||||
//
|
||||
// cmbCateFilter3
|
||||
//
|
||||
this.cmbCateFilter3.DefaultText = "全部";
|
||||
@@ -2249,27 +2283,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
this.panel1.TabIndex = 189;
|
||||
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
|
||||
//
|
||||
// txtMultiPcsSku4
|
||||
//
|
||||
this.txtMultiPcsSku4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.txtMultiPcsSku4.Location = new System.Drawing.Point(849, 109);
|
||||
this.txtMultiPcsSku4.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
this.txtMultiPcsSku4.Name = "txtMultiPcsSku4";
|
||||
this.txtMultiPcsSku4.Size = new System.Drawing.Size(25, 23);
|
||||
this.txtMultiPcsSku4.TabIndex = 884;
|
||||
this.txtMultiPcsSku4.Text = "1.1";
|
||||
//
|
||||
// label27
|
||||
//
|
||||
this.label27.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label27.AutoSize = true;
|
||||
this.label27.Location = new System.Drawing.Point(812, 112);
|
||||
this.label27.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
this.label27.Name = "label27";
|
||||
this.label27.Size = new System.Drawing.Size(41, 17);
|
||||
this.label27.TabIndex = 883;
|
||||
this.label27.Text = "价格×";
|
||||
//
|
||||
// PDDDBProdUserSelectForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
@@ -2474,5 +2487,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private System.Windows.Forms.Label label26;
|
||||
private System.Windows.Forms.TextBox txtMultiPcsSku4;
|
||||
private System.Windows.Forms.Label label27;
|
||||
private UserComponent.UcCheckBox chkRelation;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
|
||||
private void UserSelectDbProductForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Task.Run(() => { InitPddToken(); });
|
||||
RefreshApi();
|
||||
//RefreshApi();
|
||||
|
||||
this.splitContainer1.Dock = DockStyle.Fill;
|
||||
this.panel1.Location = new Point(40, 30);
|
||||
@@ -6275,6 +6275,10 @@ Content-Type: image/jpeg
|
||||
data += "&is_supplier_prod_ok=" + "已设置";
|
||||
data += "&wx_safe_status=" + "安全商品,未校验";
|
||||
}
|
||||
if (chkRelation.Checked)
|
||||
{
|
||||
data += "&is_relation=1";
|
||||
}
|
||||
}));
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
@@ -7239,6 +7243,32 @@ Content-Type: image/jpeg
|
||||
//Thread.Sleep(Randomx.GetId(500, 5000));
|
||||
//return "{\"success\":true,\"goods_id\":" + 1000000 + ",\"status\":\"已上传\",\"msg\":\"上传成功\"}";
|
||||
|
||||
// 获取映射关系
|
||||
List<PddRelationParam> relationLst = new List<PddRelationParam>();
|
||||
PddRelationParam relationData = null;
|
||||
{
|
||||
var url = BaseClass.BuildPDDObjString("product/get_relation");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&up_spu_id=" + selectProd.spu_id;
|
||||
data += "&index=" + Math.Abs((selectProd.spu_id).GetHashCode()) % 128;
|
||||
var result = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(result) || !result.Contains("\"code\":200"))
|
||||
result = GetHtml.PostUtf8(url, data);
|
||||
if (result.Contains("\"data\":[]"))
|
||||
{
|
||||
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"转换数据获取失败\"}";
|
||||
}
|
||||
try
|
||||
{
|
||||
var jStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(result)["data"]);
|
||||
relationLst = JsonHelper.DeserializeJsonToList<PddRelationParam>(jStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"转换数据获取失败" + ex.Message + "\"}";
|
||||
}
|
||||
}
|
||||
|
||||
KJDDBProduct dbProd = selectProd.kjdDbProduct;
|
||||
if (dbProd == null)
|
||||
dbProd = GetProductDetail(selectProd.out_product_Id.ToString());
|
||||
@@ -7773,6 +7803,14 @@ Content-Type: image/jpeg
|
||||
// sk.multi_price = maxPrice1;
|
||||
// sk.price = maxPrice1 + 100;
|
||||
//}
|
||||
|
||||
var addPriceFakeSkuInfoMinPrice = addPriceFakeSkuInfoLst.Min(s => s.price);
|
||||
var addPriceFakeSkuInfoMaxPrice = addPriceFakeSkuInfoLst.Max(s => s.price);
|
||||
relationData = relationLst?
|
||||
.OrderBy(r => r.price_min.ParseToInt())
|
||||
.FirstOrDefault(r => r.price_min.ParseToInt() * 1.08m > addPriceFakeSkuInfoMinPrice && r.price_max.ParseToInt() * 1.08m > addPriceFakeSkuInfoMaxPrice);
|
||||
if (relationData == null)
|
||||
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"转换数据获取价格失败\"}";
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -7831,6 +7869,17 @@ Content-Type: image/jpeg
|
||||
|
||||
addPriceSkuInfoLst.Add(skuInfo);
|
||||
}
|
||||
|
||||
if (relationData == null)
|
||||
{
|
||||
var addPriceSkuInfoMinPrice = addPriceSkuInfoLst.Min(s => s.price);
|
||||
var addPriceSkuInfoMaxPrice = addPriceSkuInfoLst.Max(s => s.price);
|
||||
relationData = relationLst?
|
||||
.OrderBy(r => r.price_min.ParseToInt())
|
||||
.FirstOrDefault(r => r.price_min.ParseToInt() * 1.08m > addPriceSkuInfoMinPrice && r.price_max.ParseToInt() * 1.08m > addPriceSkuInfoMaxPrice);
|
||||
if (relationData == null)
|
||||
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"转换数据获取价格失败\"}";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -8024,6 +8073,25 @@ Content-Type: image/jpeg
|
||||
}
|
||||
|
||||
var goods_id = BaseRegex.GetStringJson(ref upLoadRst, "goods_id");
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(goods_id))
|
||||
{
|
||||
var pddRelationApi = new PddApi(shop);
|
||||
int sourceType = 8;
|
||||
if (relationData.from_site == "vd")
|
||||
sourceType = 8;
|
||||
var relationRst = pddRelationApi.Relation2603(goods_id.ParseToLong(), relationData.goods_id, relationData.price_min.ParseToInt(), relationData.price_max.ParseToInt(), 0, sourceType);
|
||||
if (!relationRst.Contains("\"is_success\":true"))
|
||||
relationRst = pddRelationApi.Relation2603(goods_id.ParseToLong(), relationData.goods_id, relationData.price_min.ParseToInt(), relationData.price_max.ParseToInt(), 0, sourceType);
|
||||
if (!relationRst.Contains("\"is_success\":true"))
|
||||
relationRst = pddRelationApi.Relation2603(goods_id.ParseToLong(), relationData.goods_id, relationData.price_min.ParseToInt(), relationData.price_max.ParseToInt(), 0, sourceType);
|
||||
if (!relationRst.Contains("\"is_success\":true"))
|
||||
{
|
||||
return "{\"success\":true,\"goods_id\":" + goods_id + ",\"status\":\"已上传但转换异常\",\"msg\":\"上传成功\"}";
|
||||
}
|
||||
}
|
||||
|
||||
return "{\"success\":true,\"goods_id\":" + goods_id + ",\"status\":\"已上传\",\"msg\":\"上传成功\"}";
|
||||
}
|
||||
|
||||
@@ -8631,7 +8699,12 @@ Content-Type: image/jpeg
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (isForceRefresh || (shop.AuthAddTime <= DateTime.Now.AddDays(-1) && shop.AuthExpiresTime <= DateTime.Now))
|
||||
if (shop.ShopAccount.Contains("阿杰"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (isForceRefresh || (shop.AuthUpdateTime <= DateTime.Now.AddDays(-1) && shop.AuthExpiresTime <= DateTime.Now))
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -8646,26 +8719,26 @@ Content-Type: image/jpeg
|
||||
}));
|
||||
}
|
||||
}
|
||||
List<List<AuthInfo>> NewApiInfolsts = JsonHelper.DeserializeJsonToList<List<AuthInfo>>(JsonHelper.SerializeObject(GlobalConfig.ShopLoginList.Select(s => s.ApiAuthInfoList).ToList()));
|
||||
foreach (var newLst in NewApiInfolsts)
|
||||
{
|
||||
if (newLst.FirstOrDefault()!= null)
|
||||
{
|
||||
var oldApiAuths = PddApiHelper.LstAuthInfos.FirstOrDefault(oldLst => oldLst.FirstOrDefault()?.ShopId == newLst.FirstOrDefault().ShopId);
|
||||
if (oldApiAuths != null)
|
||||
{
|
||||
oldApiAuths.Clear();
|
||||
oldApiAuths.AddRange(newLst);
|
||||
}
|
||||
else
|
||||
{
|
||||
PddApiHelper.LstAuthInfos.Add(newLst);
|
||||
}
|
||||
}
|
||||
}
|
||||
//List<List<AuthInfo>> NewApiInfolsts = JsonHelper.DeserializeJsonToList<List<AuthInfo>>(JsonHelper.SerializeObject(GlobalConfig.ShopLoginList.Select(s => s.ApiAuthInfoList).ToList()));
|
||||
//foreach (var newLst in NewApiInfolsts)
|
||||
//{
|
||||
// if (newLst.FirstOrDefault()!= null)
|
||||
// {
|
||||
// var oldApiAuths = PddApiHelper.LstAuthInfos.FirstOrDefault(oldLst => oldLst.FirstOrDefault()?.ShopId == newLst.FirstOrDefault().ShopId);
|
||||
// if (oldApiAuths != null)
|
||||
// {
|
||||
// oldApiAuths.Clear();
|
||||
// oldApiAuths.AddRange(newLst);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PddApiHelper.LstAuthInfos.Add(newLst);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
PddApiHelper.LstAuthInfos = PddApiHelper.LstAuthInfos.Where(a => a.OrderBy(o => o.AddTime).LastOrDefault().AddTime > DateTime.Now.AddDays(-30)).ToList();
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_shop_api_auth_info_lists", PddApiHelper.LstAuthInfos);
|
||||
//PddApiHelper.LstAuthInfos = PddApiHelper.LstAuthInfos.Where(a => a.OrderBy(o => o.UpdateTime).LastOrDefault().UpdateTime > DateTime.Now.AddDays(-30)).ToList();
|
||||
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_shop_api_auth_info_lists", PddApiHelper.LstAuthInfos);
|
||||
Invoke(new Action(() => { pbShopLoading.Visible = false; }));
|
||||
});
|
||||
}
|
||||
@@ -8675,6 +8748,9 @@ Content-Type: image/jpeg
|
||||
WXUserProdListForm.Instance.lstTemuDBProductSelect = this.lstTemuDBProductSelect;
|
||||
WXUserProdListForm.Instance.cmbSourceType.Items.Clear();
|
||||
WXUserProdListForm.Instance.cmbSourceType.Items.AddRange(this.cmbSourceType.Items.Cast<Object>().ToArray());
|
||||
WXUserProdListForm.Instance.lblRelation.Visible = false;
|
||||
WXUserProdListForm.Instance.cmbRelation.Visible = false;
|
||||
WXUserProdListForm.Instance.cmbRelation.Text = "是";
|
||||
WXUserProdListForm.Instance.SaveComplete -= dbProdList_SaveComplete;
|
||||
WXUserProdListForm.Instance.SaveComplete += dbProdList_SaveComplete;
|
||||
WXUserProdListForm.Instance.Show();
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
localShop.ApiAuthInfoList.AddRange(serverShop.ApiAuthInfoList);
|
||||
}
|
||||
localShop.BuyApiAuth.AccessToken = serverShop.BuyApiAuth.AccessToken;
|
||||
localShop.BuyApiAuth.AddTime = serverShop.BuyApiAuth.AddTime;
|
||||
localShop.BuyApiAuth.UpdateTime = serverShop.BuyApiAuth.UpdateTime;
|
||||
localShop.BuyApiAuth.AppKey = serverShop.BuyApiAuth.AppKey;
|
||||
localShop.BuyApiAuth.ExpiresTime = serverShop.BuyApiAuth.ExpiresTime;
|
||||
localShop.BuyApiAuth.RefreshToken = serverShop.BuyApiAuth.RefreshToken;
|
||||
@@ -82,7 +82,7 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
GlobalConfig.ShopLoginList.Add(localShop);
|
||||
}
|
||||
}
|
||||
PddApiHelper.PddGetLocalTokens();
|
||||
//PddApiHelper.GetPddLocalTokens();
|
||||
}
|
||||
|
||||
public static List<ShopLoginInfo> GetServerShop()
|
||||
@@ -152,7 +152,7 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
AppKey = appkey,
|
||||
AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"),
|
||||
RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"),
|
||||
AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
|
||||
UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
|
||||
ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(),
|
||||
});
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
AppKey = appkey,
|
||||
AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"),
|
||||
RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"),
|
||||
AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
|
||||
UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(),
|
||||
ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(),
|
||||
});
|
||||
}
|
||||
@@ -174,7 +174,7 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
shop.BuyApiAuth.AppKey = appkey;
|
||||
shop.BuyApiAuth.AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token");
|
||||
shop.BuyApiAuth.RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token");
|
||||
shop.BuyApiAuth.AddTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime();
|
||||
shop.BuyApiAuth.UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime();
|
||||
shop.BuyApiAuth.ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime();
|
||||
}
|
||||
}
|
||||
@@ -805,23 +805,6 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=mms.pinduoduo.com; expires=" +
|
||||
DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
|
||||
}
|
||||
// 全球站cookie
|
||||
//foreach (var shopCook in shop.Cookies2.Split(';'))
|
||||
//{
|
||||
// var cookie = shopCook.Trim();
|
||||
// if (cookie.StartsWith("mallid"))
|
||||
// cookie = "mallid=" + shop.ShopId;
|
||||
// if (!keys2.Any(k => cookie.StartsWith(k)))
|
||||
// continue;
|
||||
// if (!cookie.StartsWith("seller_temp") && !cookie.StartsWith("_nano_fp") && !cookie.StartsWith("mallid"))
|
||||
// cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.temu.com; expires=" +
|
||||
// DateTime.Now.AddDays(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
|
||||
// else
|
||||
// cookJs += "\r\ndocument.cookie='" + cookie + "; domain=agentseller.temu.com; expires=" +
|
||||
// DateTime.Now.AddDays(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
|
||||
//}
|
||||
//cookJs += "\r\nwindow.localStorage.setItem('" + "mall-info-id" + "', '" + shop.ShopId + "');";
|
||||
//cookJs += "\r\nwindow.localStorage.setItem('" + "agentseller-mall-info-id" + "', '" + shop.ShopId + "');";
|
||||
cookJs += "\r\nsetTimeout(() => { window.location.href='https://mms.pinduoduo.com/home'; }, 200)";
|
||||
Clipboard.SetDataObject(cookJs);
|
||||
BaseMsgForm.ShowInfo("复制成功");
|
||||
@@ -831,6 +814,7 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
//PDDShopUpdateCookieForm updateCookieForm = new PDDShopUpdateCookieForm(shop);
|
||||
//updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
|
||||
//updateCookieForm.ShowDialog();
|
||||
// 使用fiddler工具获取小密封破解工作台cookie
|
||||
PDDShopUpdateFddlCookieForm updateFddlCookieForm = new PDDShopUpdateFddlCookieForm(shop);
|
||||
updateFddlCookieForm.SaveComplete += UpdateCookieForm_SaveComplete;
|
||||
updateFddlCookieForm.ShowDialog();
|
||||
@@ -861,23 +845,36 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
break;
|
||||
case "购买授权":
|
||||
{
|
||||
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
|
||||
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=84862";
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
|
||||
shopLoginForm.ShowDialog();
|
||||
btnRefreshCookie_Click(null, null);
|
||||
var currentPddClient = GlobalConfig.PddClentInfoList.FirstOrDefault(c => c.is_current == true);
|
||||
if (currentPddClient != null)
|
||||
{
|
||||
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
|
||||
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=84862";
|
||||
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=84690";
|
||||
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/service-detail?detailId=" + currentPddClient.market_id;
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
|
||||
shopLoginForm.ShowDialog();
|
||||
btnRefreshCookie_Click(null, null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "绑定授权":
|
||||
{
|
||||
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
|
||||
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=" + PddApi.clientId + "&redirect_uri=" +
|
||||
GetHtml.UrlEncodeUtf8("http://po.e57.cn/login") + "?source=pdd_code&response_type=code";
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
|
||||
shopLoginForm.ShowDialog();
|
||||
btnRefreshCookie_Click(null, null);
|
||||
var currentPddClient = GlobalConfig.PddClentInfoList.FirstOrDefault(c => c.is_current == true);
|
||||
if (currentPddClient != null)
|
||||
{
|
||||
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
|
||||
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=" + PddApi.clientId_pi_xiu_guan_jia + "&redirect_uri=" + GetHtml.UrlEncodeUtf8("http://po.e57.cn/login") + "?source=pdd_code&response_type=code";
|
||||
//shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=48e76c60853d47d8a4e2e631b6db26b5&redirect_uri=http%3A%2F%2Fxtjpd.jiaotian.vip%2Fpdd_token.html&response_type=code"
|
||||
shopLoginForm.InitUrl = "https://fuwu.pinduoduo.com/service-market/auth?client_id=" + currentPddClient.client_id +
|
||||
"&redirect_uri=" + currentPddClient.redirect_uri + "&response_type=code";
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.AuthClientId = currentPddClient.client_id;
|
||||
shopLoginForm.SaveComplete += shopLoginForm_SaveComplete;
|
||||
shopLoginForm.ShowDialog();
|
||||
btnRefreshCookie_Click(null, null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
//case "多重登录":
|
||||
|
||||
@@ -27,6 +27,7 @@ using Work.BLL.Tools;
|
||||
using TemuKJD.BLL;
|
||||
using AllBase.Model.Result.PDDResult;
|
||||
using AllBase.Model.Param.PDDProdParam;
|
||||
using TemuKJD.BLL.PddApi;
|
||||
|
||||
namespace TemuKJD.PDDForms.ShopForms
|
||||
{
|
||||
@@ -63,6 +64,8 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
private ShopLoginInfo shop = null;
|
||||
private List<ShopCompany> lstShopCompany = new List<ShopCompany>();
|
||||
private string currentUrl = "";
|
||||
// 绑定授权的时候传进来和回调信息封装好传到数据库端
|
||||
public string AuthClientId = "";
|
||||
|
||||
public PDDShopLoginForm(ShopLoginInfo shopInfo)
|
||||
{
|
||||
@@ -754,45 +757,6 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
}
|
||||
}
|
||||
|
||||
//if (responseData.Contains("球球小小店铺55") && responseData.Contains("pdd24873711027"))
|
||||
//{
|
||||
// Task.Run(() =>
|
||||
// {
|
||||
// var data = responseData;
|
||||
// if (this.shop != null && data.Contains("\"success\":true"))
|
||||
// {
|
||||
// var username = BaseRegex.GetStringJson(ref data, "username");
|
||||
// var maskMobile = BaseRegex.GetStringJson(ref data, "mobile");
|
||||
// maskMobile = maskMobile.Split('*').Last();
|
||||
// if (string.IsNullOrWhiteSpace(maskMobile) || string.IsNullOrWhiteSpace(username))
|
||||
// return;
|
||||
|
||||
// if (shop.LoginName.EndsWith(maskMobile) || shop.LoginName == username)
|
||||
// {
|
||||
// lstShopCompany.Clear();
|
||||
// //var jObj = JObject.Parse(data);
|
||||
// //var jArr = jObj["result"] as JArray;
|
||||
// //if (jArr == null)
|
||||
// // jArr = new JArray();
|
||||
|
||||
// Thread.Sleep(500);
|
||||
|
||||
// ShopCompany sc = new ShopCompany()
|
||||
// {
|
||||
// MallId = BaseRegex.GetStringJson(ref data, "mall_id"),
|
||||
// AccountId = BaseRegex.GetStringJson(ref data, "username"),
|
||||
// AccountName = BaseRegex.GetStringJson(ref data, "mall_name"),
|
||||
// LoginName = shop.LoginName,
|
||||
// UserName = BaseClass.UserName,
|
||||
// LoginStatus = "登录成功",
|
||||
// AntiContent = antiContent,
|
||||
// };
|
||||
// this.lstShopCompany.Add(sc);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
//if (url == "https://mms.pinduoduo.com/janus/api/userinfo" /*|| url == "https://mms.pinduoduo.com/janus/api/new/userinfo"*/)
|
||||
//{
|
||||
// Task.Run(() =>
|
||||
@@ -889,6 +853,47 @@ namespace TemuKJD.PDDForms.ShopForms
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (url.Contains("https://xtjpd.jiaotian.vip/") && responseData.Contains("access_token"))
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var pddClientData = responseData;
|
||||
pddClientData = GetHtml.Unicode2String(pddClientData);
|
||||
// {"id":"2","cid":"2","company_id":"0","site_id":"2","main_sid":"0","shop_id":"490943134","shop_name":"pdd49094313446","mall_name":"阿杰小铺浦哈哈","mall_desc":"您的小店已开启,为了更方便消费者了解您的店铺,快来补充店铺详情吧~","logo":"http:\/\/t16img.yangkeduo.com\/pdd_ims\/img_check\/v2\/E62F2CFFFFFF0720200112155452281\/7a235545414b40deaa2a90ab8eaebfd3.png","merchant_type":"1","mall_character":"2","access_token":"3f66557920e0481697325b46c73299e76e3d9e7e","refresh_token":"aa163da98e944063abbbe57a5365fad2fa90fe50","expires_at":"1776264848","expires_in":"26259","refresh_token_expires_at":"1776264848","refresh_token_expires_in":"26259","buy_sku_id":"435494","spec_name":"服务版本:专业版,周期:15天","spec_value":"专业版","goods_get_time":null,"order_get_time":null,"addtime":"2026-03-31 22:54:29","add_user_id":"2","add_user_name":"授权","update_time":"2026-04-15 15:36:27","update_user_id":"0","delete_user_id":"0"}
|
||||
var access_token = BaseRegex.GetStringJson(ref pddClientData, "access_token");
|
||||
var refresh_token = BaseRegex.GetStringJson(ref pddClientData, "refresh_token");
|
||||
var mall_id = BaseRegex.GetStringJson(ref pddClientData, "shop_id");
|
||||
var shop_id = BaseRegex.GetStringJson(ref pddClientData, "shop_name");
|
||||
var mall_name = BaseRegex.GetStringJson(ref pddClientData, "mall_name"); // 阿杰小铺浦哈哈
|
||||
var expires_at = BaseRegex.GetStringJson(ref pddClientData, "expires_at");
|
||||
if (shop?.MallId == mall_id && !string.IsNullOrWhiteSpace(AuthClientId))
|
||||
{
|
||||
var auth = shop.ApiAuthInfoList.FirstOrDefault(a => a.AppKey == AuthClientId);
|
||||
if (auth == null)
|
||||
{
|
||||
auth = new AuthInfo();
|
||||
shop.ApiAuthInfoList.Add(auth);
|
||||
}
|
||||
auth.ShopId = shop_id;
|
||||
auth.AccessToken = access_token;
|
||||
auth.RefreshToken = refresh_token;
|
||||
auth.AppKey = AuthClientId;
|
||||
auth.ExpiresTime = BaseClass.StampToDateTime(expires_at.ParseToInt());
|
||||
auth.UpdateTime = DateTime.Now;
|
||||
auth.ApiAuthStatus = "授权成功";
|
||||
auth.AppSecret = "";
|
||||
|
||||
var rst = PddApiHelper.SaveShopClientInfo(auth);
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (this.Created && !this.IsDisposed && !this.Disposing)
|
||||
this.Close();
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user