商品可以选择类目再进行上传
This commit is contained in:
1 parent
e73359e283
commit
7d5daf27ad
8 files changed
+531
-165
No files matched your search
@@ -27,8 +27,8 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 532;
|
||||
//public static int VersionCount = 532;
|
||||
public static int VersionCount = 533;
|
||||
//public static int VersionCount = 533;
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
|
||||
@@ -278,6 +278,49 @@ namespace KJD_Web.BLL
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string MdyProductCategory(string inputData, bool isAdmin = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
|
||||
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
|
||||
if (time1 != EncrypUtil.Encryption(time))
|
||||
return "{\"code\":50000,\"msg\":\"校验失败\"}";
|
||||
|
||||
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
|
||||
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
|
||||
string change_cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "change_cat_id"))?.Replace("'", "\\'");
|
||||
string change_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "change_cat_name"))?.Replace("'", "\\'");
|
||||
|
||||
if (string.IsNullOrEmpty(user_name))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"没有用户名\"}";
|
||||
}
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "update kjd.third_product set";
|
||||
if (change_cat_id != null)
|
||||
sql += " change_cat_id='" + change_cat_id + "',";
|
||||
if (change_cat_name != null)
|
||||
sql += " change_cat_name='" + change_cat_name + "',";
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " where id=" + id + ";";
|
||||
|
||||
var rst = mySql.ExecuteNonQuery(sql);
|
||||
mySql.Close();
|
||||
if (rst)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
|
||||
public string AddUserSelectProduct(string inputData, bool isAdmin = false)
|
||||
{
|
||||
|
||||
@@ -120,6 +120,17 @@ namespace KJD_Web
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void mdy_product_category()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new ProductThirdManage().MdyProductCategory(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void add_user_select_product()
|
||||
|
||||
+158
-21
@@ -31,48 +31,155 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DbProductCategorySearch));
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.txtProductName = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.lblNewCategory = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.btnSearch = new DevComponents.DotNetBar.PanelEx();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.lblOldCategory = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.btnSave = new DevComponents.DotNetBar.PanelEx();
|
||||
this.txtSearchText = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.BackColor = System.Drawing.Color.White;
|
||||
this.panel2.Controls.Add(this.txtProductName);
|
||||
this.panel2.Controls.Add(this.label3);
|
||||
this.panel2.Controls.Add(this.pictureBox1);
|
||||
this.panel2.Controls.Add(this.lblNewCategory);
|
||||
this.panel2.Controls.Add(this.label4);
|
||||
this.panel2.Controls.Add(this.btnSearch);
|
||||
this.panel2.Controls.Add(this.listBox1);
|
||||
this.panel2.Controls.Add(this.lblOldCategory);
|
||||
this.panel2.Controls.Add(this.label2);
|
||||
this.panel2.Controls.Add(this.btnSave);
|
||||
this.panel2.Controls.Add(this.textBox1);
|
||||
this.panel2.Controls.Add(this.txtSearchText);
|
||||
this.panel2.Controls.Add(this.label1);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(1, 33);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(798, 366);
|
||||
this.panel2.Size = new System.Drawing.Size(898, 330);
|
||||
this.panel2.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
// txtProductName
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(37, 48);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(53, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "类目搜索";
|
||||
this.txtProductName.Location = new System.Drawing.Point(181, 31);
|
||||
this.txtProductName.Multiline = true;
|
||||
this.txtProductName.Name = "txtProductName";
|
||||
this.txtProductName.ReadOnly = true;
|
||||
this.txtProductName.Size = new System.Drawing.Size(675, 38);
|
||||
this.txtProductName.TabIndex = 504;
|
||||
//
|
||||
// textBox1
|
||||
// label3
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(93, 45);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(653, 21);
|
||||
this.textBox1.TabIndex = 1;
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(124, 34);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(65, 12);
|
||||
this.label3.TabIndex = 503;
|
||||
this.label3.Text = "商品标题:";
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(33, 32);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(86, 86);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pictureBox1.TabIndex = 502;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// lblNewCategory
|
||||
//
|
||||
this.lblNewCategory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblNewCategory.AutoSize = true;
|
||||
this.lblNewCategory.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.lblNewCategory.Location = new System.Drawing.Point(103, 277);
|
||||
this.lblNewCategory.Name = "lblNewCategory";
|
||||
this.lblNewCategory.Size = new System.Drawing.Size(41, 12);
|
||||
this.lblNewCategory.TabIndex = 495;
|
||||
this.lblNewCategory.Text = "新类目";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(33, 277);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(77, 12);
|
||||
this.label4.TabIndex = 494;
|
||||
this.label4.Text = "商品新类目:";
|
||||
//
|
||||
// btnSearch
|
||||
//
|
||||
this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSearch.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnSearch.Location = new System.Drawing.Point(794, 101);
|
||||
this.btnSearch.Name = "btnSearch";
|
||||
this.btnSearch.Size = new System.Drawing.Size(62, 21);
|
||||
this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnSearch.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnSearch.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnSearch.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.btnSearch.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.btnSearch.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.btnSearch.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.btnSearch.Style.GradientAngle = 90;
|
||||
this.btnSearch.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnSearch.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnSearch.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnSearch.TabIndex = 487;
|
||||
this.btnSearch.Text = "搜索";
|
||||
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.ItemHeight = 12;
|
||||
this.listBox1.Location = new System.Drawing.Point(181, 122);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(675, 136);
|
||||
this.listBox1.TabIndex = 483;
|
||||
this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
|
||||
//
|
||||
// lblOldCategory
|
||||
//
|
||||
this.lblOldCategory.AutoSize = true;
|
||||
this.lblOldCategory.Location = new System.Drawing.Point(183, 77);
|
||||
this.lblOldCategory.Name = "lblOldCategory";
|
||||
this.lblOldCategory.Size = new System.Drawing.Size(41, 12);
|
||||
this.lblOldCategory.TabIndex = 482;
|
||||
this.lblOldCategory.Text = "原类目";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(123, 77);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(65, 12);
|
||||
this.label2.TabIndex = 481;
|
||||
this.label2.Text = "商品类目:";
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSave.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnSave.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnSave.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnSave.Location = new System.Drawing.Point(670, 288);
|
||||
this.btnSave.Location = new System.Drawing.Point(780, 274);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(76, 26);
|
||||
this.btnSave.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
@@ -88,21 +195,42 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.btnSave.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnSave.TabIndex = 477;
|
||||
this.btnSave.Text = "保存类目";
|
||||
this.btnSave.Visible = false;
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// txtSearchText
|
||||
//
|
||||
this.txtSearchText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtSearchText.Location = new System.Drawing.Point(181, 101);
|
||||
this.txtSearchText.MaxLength = 50;
|
||||
this.txtSearchText.Name = "txtSearchText";
|
||||
this.txtSearchText.Size = new System.Drawing.Size(611, 21);
|
||||
this.txtSearchText.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(124, 106);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(65, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "类目搜索:";
|
||||
//
|
||||
// DbProductCategorySearch
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 400);
|
||||
this.ClientSize = new System.Drawing.Size(900, 364);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "DbProductCategorySearch";
|
||||
this.Text = "商品类目查询";
|
||||
this.TitleText = "商品类目查询";
|
||||
this.Load += new System.EventHandler(this.DbProductCategorySearch_Load);
|
||||
this.Controls.SetChildIndex(this.panel2, 0);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -110,8 +238,17 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TextBox txtSearchText;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private DevComponents.DotNetBar.PanelEx btnSave;
|
||||
private System.Windows.Forms.Label lblOldCategory;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private DevComponents.DotNetBar.PanelEx btnSearch;
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private System.Windows.Forms.Label lblNewCategory;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox txtProductName;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
using System;
|
||||
using AllBase;
|
||||
using AllBase.Model.Result;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -8,14 +12,162 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.KJDForms.BaseForms;
|
||||
using Work;
|
||||
|
||||
namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
{
|
||||
public partial class DbProductCategorySearch : LRBaseForm
|
||||
{
|
||||
public DbProductCategorySearch()
|
||||
ShopLoginInfo Shop;
|
||||
TemuDBProductSelect ProdSelect;
|
||||
SetProductSelectNotesType SelectType;
|
||||
//string ChangeCatId = "";
|
||||
//string ChangeCatName = "";
|
||||
Dictionary<string, string> cateIdNameMap = new Dictionary<string, string>();
|
||||
public DbProductCategorySearch(ShopLoginInfo shop, TemuDBProductSelect prodSelect, SetProductSelectNotesType selectType = SetProductSelectNotesType.DbProduct)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Shop = shop;
|
||||
SelectType = selectType;
|
||||
ProdSelect = prodSelect;
|
||||
}
|
||||
|
||||
private void DbProductCategorySearch_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.listBox1.Visible = false;
|
||||
this.lblOldCategory.Text = string.IsNullOrWhiteSpace(ProdSelect.change_cat_name) ? ProdSelect.cat_name : ProdSelect.change_cat_name;
|
||||
this.lblNewCategory.Text = "";
|
||||
this.pictureBox1.ImageLocation = ProdSelect.main_img.Replace("https", "http");
|
||||
this.txtProductName.Text = ProdSelect.product_name;
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("product/mdy_product_category");
|
||||
if (this.SelectType == SetProductSelectNotesType.ThirdProduct)
|
||||
url = BaseClass.BuildObjString("product_third/mdy_product_category");
|
||||
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&db_id=" + this.ProdSelect.out_product_Id;
|
||||
data += "&change_cat_name=" + this.lblNewCategory.Text.Trim();
|
||||
data += "&change_cat_id=" + this.cateIdNameMap[this.lblNewCategory.Text.Trim()].Trim();
|
||||
var 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"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
BaseMsgForm.ShowError("商品类目编辑失败,请重试!" + BaseRegex.GetStringJson(ref html, "msg"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ProdSelect.change_cat_name = this.lblNewCategory.Text.Trim();
|
||||
ProdSelect.change_cat_id = this.cateIdNameMap[this.lblNewCategory.Text.Trim()].Trim();
|
||||
this.OnSaveComplete(ProdSelect);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(txtSearchText.Text))
|
||||
{
|
||||
BaseMsgForm.ShowError("搜索项目不能为空");
|
||||
return;
|
||||
}
|
||||
if (Shop.LoginStatus2 != "国际版在线")
|
||||
{
|
||||
BaseMsgForm.ShowError("查询失败 店铺已掉线");
|
||||
return;
|
||||
}
|
||||
this.listBox1.Items.Clear();
|
||||
cateIdNameMap.Clear();
|
||||
Task.Run(() =>
|
||||
{
|
||||
string html = SearchCategory(Shop, this.txtSearchText.Text.Trim());
|
||||
if (html.Contains("\"success\":true"))
|
||||
{
|
||||
Dictionary<int, TemuCat> catIdDic = new Dictionary<int, TemuCat>();
|
||||
try
|
||||
{
|
||||
//var catObj = JObject.Parse(html)["result"]["categoryPaths"][0];
|
||||
foreach (var catObj in JObject.Parse(html)["result"]["categoryPaths"])
|
||||
{
|
||||
catIdDic[1] = catObj["cat1NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat1NodeVO"].ToString());
|
||||
catIdDic[2] = catObj["cat2NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat2NodeVO"].ToString());
|
||||
catIdDic[3] = catObj["cat3NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat3NodeVO"].ToString());
|
||||
catIdDic[4] = catObj["cat4NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat4NodeVO"].ToString());
|
||||
catIdDic[5] = catObj["cat5NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat5NodeVO"].ToString());
|
||||
catIdDic[6] = catObj["cat6NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat6NodeVO"].ToString());
|
||||
catIdDic[7] = catObj["cat7NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat7NodeVO"].ToString());
|
||||
catIdDic[8] = catObj["cat8NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat8NodeVO"].ToString());
|
||||
catIdDic[9] = catObj["cat9NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat9NodeVO"].ToString());
|
||||
catIdDic[10] = catObj["cat10NodeVO"].IsNullOrEmpty() ?
|
||||
null : JsonHelper.DeserializeJsonToObject<TemuCat>(catObj["cat10NodeVO"].ToString());
|
||||
|
||||
string changeCatId = "";
|
||||
string changeCatName = "";
|
||||
for (int i = 1; i <= 10; i++)
|
||||
{
|
||||
changeCatId += catIdDic[i]?.catId + ">";
|
||||
changeCatName += catIdDic[i]?.catName + ">";
|
||||
}
|
||||
changeCatId = changeCatId.Trim('>');
|
||||
changeCatName = changeCatName.Trim('>');
|
||||
cateIdNameMap[changeCatName] = changeCatId;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
listBox1.Visible = true;
|
||||
this.listBox1.Items.Add(changeCatName);
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowError("查询失败 " + ex.Message);
|
||||
}));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string err = BaseRegex.GetStringJson(ref html, "errorMsg");
|
||||
if (string.IsNullOrEmpty(err))
|
||||
err = BaseRegex.GetStringJson(ref html, "error_msg");
|
||||
if (err == null)
|
||||
err = "";
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowError("查询失败 " + err.Replace("Invalid Login State", "店铺已掉线"));
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private string SearchCategory(ShopLoginInfo shop, string searchStr)
|
||||
{
|
||||
string url = "https://agentseller.temu.com/anniston-agent-seller/category/search";
|
||||
string body = @"{""searchText"":""" + searchStr + @"""}";
|
||||
|
||||
string refere = "https://agentseller.temu.com/goods/create/category";
|
||||
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
|
||||
}
|
||||
|
||||
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.lblNewCategory.Text = listBox1.SelectedItem.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-28
@@ -86,8 +86,6 @@
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.pbLoading = new System.Windows.Forms.PictureBox();
|
||||
this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx();
|
||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colSelectId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -114,6 +112,8 @@
|
||||
this.colEditNotes = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -264,7 +264,7 @@
|
||||
"全部",
|
||||
"重上",
|
||||
"已买"});
|
||||
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 5);
|
||||
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 8);
|
||||
this.cmbUserNotes.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbUserNotes.Name = "cmbUserNotes";
|
||||
this.cmbUserNotes.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -281,7 +281,7 @@
|
||||
"核价成功",
|
||||
"核价成功(重复)",
|
||||
"重复"});
|
||||
this.cmbNotes.Location = new System.Drawing.Point(917, 5);
|
||||
this.cmbNotes.Location = new System.Drawing.Point(917, 8);
|
||||
this.cmbNotes.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbNotes.Name = "cmbNotes";
|
||||
this.cmbNotes.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -308,7 +308,7 @@
|
||||
"已上传",
|
||||
"草稿箱",
|
||||
"全部"});
|
||||
this.cmbStatus.Location = new System.Drawing.Point(814, 5);
|
||||
this.cmbStatus.Location = new System.Drawing.Point(814, 8);
|
||||
this.cmbStatus.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbStatus.Name = "cmbStatus";
|
||||
this.cmbStatus.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -864,29 +864,6 @@
|
||||
this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick);
|
||||
this.dgvSelectProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll);
|
||||
//
|
||||
// ucSplitPage1
|
||||
//
|
||||
this.ucSplitPage1.CurrentPage = 1;
|
||||
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.ucSplitPage1.Location = new System.Drawing.Point(1196, 0);
|
||||
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ucSplitPage1.Name = "ucSplitPage1";
|
||||
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
|
||||
this.ucSplitPage1.Size = new System.Drawing.Size(362, 25);
|
||||
this.ucSplitPage1.TabIndex = 6;
|
||||
this.ucSplitPage1.TotalPage = 1;
|
||||
//
|
||||
// statusBar
|
||||
//
|
||||
this.statusBar.BackColor = System.Drawing.Color.White;
|
||||
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
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, 0);
|
||||
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.statusBar.Name = "statusBar";
|
||||
this.statusBar.Size = new System.Drawing.Size(1558, 25);
|
||||
this.statusBar.TabIndex = 5;
|
||||
//
|
||||
// colSelect
|
||||
//
|
||||
this.colSelect.HeaderText = "选择";
|
||||
@@ -1100,6 +1077,29 @@
|
||||
this.colOpResult.ReadOnly = true;
|
||||
this.colOpResult.Width = 150;
|
||||
//
|
||||
// ucSplitPage1
|
||||
//
|
||||
this.ucSplitPage1.CurrentPage = 1;
|
||||
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.ucSplitPage1.Location = new System.Drawing.Point(1196, 0);
|
||||
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ucSplitPage1.Name = "ucSplitPage1";
|
||||
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
|
||||
this.ucSplitPage1.Size = new System.Drawing.Size(362, 25);
|
||||
this.ucSplitPage1.TabIndex = 6;
|
||||
this.ucSplitPage1.TotalPage = 1;
|
||||
//
|
||||
// statusBar
|
||||
//
|
||||
this.statusBar.BackColor = System.Drawing.Color.White;
|
||||
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
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, 0);
|
||||
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.statusBar.Name = "statusBar";
|
||||
this.statusBar.Size = new System.Drawing.Size(1558, 25);
|
||||
this.statusBar.TabIndex = 5;
|
||||
//
|
||||
// ProductThirdSelectListManageForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
prodSelect.main_img.Replace("https:", "http:"),
|
||||
defaultBitmap,//prod.main_img,
|
||||
prodSelect.fission_product_name,
|
||||
string.IsNullOrWhiteSpace(prodSelect.change_cat_name) ? prodSelect.cat_name : prodSelect.change_cat_name,
|
||||
string.IsNullOrWhiteSpace(prodSelect.change_cat_name) ? prodSelect.cat_name : prodSelect.change_cat_name.Split('>').LastOrDefault(),
|
||||
prodSelect.ext_code,
|
||||
prodSelect.status,
|
||||
prodSelect.draft_id,
|
||||
@@ -336,6 +336,12 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
//Task.Run(() => { SelectProduct(new TemuDBProduct[] { dbProduct }); });
|
||||
break;
|
||||
case "商品类目":
|
||||
{
|
||||
var shop = GetShop(shopId);
|
||||
DbProductCategorySearch searchForm = new DbProductCategorySearch(shop, dbSelectProduct, SetProductSelectNotesType.ThirdProduct);
|
||||
searchForm.SaveComplete += SearchForm_SaveComplete;
|
||||
searchForm.ShowDialog();
|
||||
}
|
||||
break;
|
||||
case "草稿箱Id":
|
||||
if (!string.IsNullOrEmpty(draftId))
|
||||
@@ -446,6 +452,21 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchForm_SaveComplete(object obj)
|
||||
{
|
||||
TemuDBProductSelect dbSelectProduct = obj as TemuDBProductSelect;
|
||||
if (dbSelectProduct == null)
|
||||
return;
|
||||
|
||||
var rows = this.dgvSelectProduct.Rows.Cast<DataGridViewRow>()
|
||||
.Where(r => r.Cells["colSpuId"].Value.ParseToString() == dbSelectProduct.spu_id);
|
||||
foreach(var row in rows)
|
||||
{
|
||||
row.Cells["colProductCat"].Value = string.IsNullOrWhiteSpace(dbSelectProduct.change_cat_name) ?
|
||||
dbSelectProduct.cat_name : dbSelectProduct.change_cat_name.Split('>').LastOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private bool DeleteProduct(string dbId, bool showErrMsg=true)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("product_third/del_select_product");
|
||||
@@ -823,25 +844,28 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
//if (index > 0 && index < 5)
|
||||
// catSearchStr = catSearchStr.Substring(index + 4).Trim();
|
||||
|
||||
var catSearchStr = selectProd.change_cat_name;
|
||||
if (!string.IsNullOrWhiteSpace(catSearchStr))
|
||||
var changeCatName = selectProd.change_cat_name;
|
||||
var changeCatId = selectProd.change_cat_id;
|
||||
if (!string.IsNullOrWhiteSpace(changeCatName) && !string.IsNullOrWhiteSpace(changeCatId))
|
||||
{
|
||||
html = SearchCategory(shop, catSearchStr);
|
||||
var changeCatNameList = selectProd.change_cat_name.Split('>').ToList();
|
||||
var changeCatIdList = selectProd.change_cat_id.Split('>').ToList();
|
||||
while (changeCatNameList.Count < 10)
|
||||
changeCatNameList.Add("");
|
||||
while (changeCatIdList.Count < 10)
|
||||
changeCatIdList.Add("0");
|
||||
try
|
||||
{
|
||||
var catObj = JObject.Parse(html)["result"]["categoryPaths"][0];
|
||||
var catStr = JsonHelper.SerializeObject(catObj);
|
||||
|
||||
prodParam.cat1Id = catIdDic[1] = (catObj["cat1NodeVO"].IsNullOrEmpty() ? null : catObj["cat1NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat2Id = catIdDic[2] = (catObj["cat2NodeVO"].IsNullOrEmpty() ? null : catObj["cat2NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat3Id = catIdDic[3] = (catObj["cat3NodeVO"].IsNullOrEmpty() ? null : catObj["cat3NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat4Id = catIdDic[4] = (catObj["cat4NodeVO"].IsNullOrEmpty() ? null : catObj["cat4NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat5Id = catIdDic[5] = (catObj["cat5NodeVO"].IsNullOrEmpty() ? null : catObj["cat5NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat6Id = catIdDic[6] = (catObj["cat6NodeVO"].IsNullOrEmpty() ? null : catObj["cat6NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat7Id = catIdDic[7] = (catObj["cat7NodeVO"].IsNullOrEmpty() ? null : catObj["cat7NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat8Id = catIdDic[8] = (catObj["cat8NodeVO"].IsNullOrEmpty() ? null : catObj["cat8NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat9Id = catIdDic[9] = (catObj["cat9NodeVO"].IsNullOrEmpty() ? null : catObj["cat9NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat10Id = catIdDic[10] = (catObj["cat10NodeVO"].IsNullOrEmpty() ? null : catObj["cat10NodeVO"]["catId"]).ParseToLong();
|
||||
prodParam.cat1Id = catIdDic[1] = changeCatIdList[0].ParseToLong();
|
||||
prodParam.cat2Id = catIdDic[2] = changeCatIdList[1].ParseToLong();
|
||||
prodParam.cat3Id = catIdDic[3] = changeCatIdList[2].ParseToLong();
|
||||
prodParam.cat4Id = catIdDic[4] = changeCatIdList[3].ParseToLong();
|
||||
prodParam.cat5Id = catIdDic[5] = changeCatIdList[4].ParseToLong();
|
||||
prodParam.cat6Id = catIdDic[6] = changeCatIdList[5].ParseToLong();
|
||||
prodParam.cat7Id = catIdDic[7] = changeCatIdList[6].ParseToLong();
|
||||
prodParam.cat8Id = catIdDic[8] = changeCatIdList[7].ParseToLong();
|
||||
prodParam.cat9Id = catIdDic[9] = changeCatIdList[8].ParseToLong();
|
||||
prodParam.cat10Id = catIdDic[10] = changeCatIdList[9].ParseToLong();
|
||||
for (int i = 10; i >= 1; i--)
|
||||
{
|
||||
catLevel = i;
|
||||
@@ -855,7 +879,6 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms
|
||||
catId = catIdDic[catLevel - 1];
|
||||
}
|
||||
}
|
||||
|
||||
html = AddDraft(shop, catId.ToString());
|
||||
}
|
||||
|
||||
|
||||
+94
-94
@@ -120,100 +120,100 @@ namespace TemuKJD
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
List<Task> tList = new List<Task>();
|
||||
var tick = BaseClass.DateTimeToTimestampSeconds(new DateTime(2022, 4, 25));
|
||||
while (true)
|
||||
{
|
||||
if (GlobalConfig.ShopLoginList.All(shop => shop.ApiAuthStatus != "授权成功"
|
||||
|| GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess)))
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
tList.Clear();
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess))
|
||||
continue;
|
||||
|
||||
if (shop.ApiAuthStatus != "授权成功")
|
||||
continue;
|
||||
|
||||
var t = Task.Run(() =>
|
||||
{
|
||||
var shopTemp = shop;
|
||||
try
|
||||
{
|
||||
var sameProductCheckParam = GlobalConfig.SameProductCheckParamList.FirstOrDefault(sp => sp.ShopId == shop.ShopId);
|
||||
if (sameProductCheckParam == null)
|
||||
{
|
||||
sameProductCheckParam = new SameProductCheckParam()
|
||||
{
|
||||
ShopId = shopTemp.ShopId,
|
||||
ShopName = shopTemp.ShopAccount,
|
||||
ShopSamePrpductItemList = new List<ShopOurterProductItemParam>(),
|
||||
};
|
||||
}
|
||||
for (int i = 1; i <= 500; i++)
|
||||
{
|
||||
if (sameProductCheckParam.ShopSamePrpductItemList != null && sameProductCheckParam.ShopSamePrpductItemList.Count > 0)
|
||||
tick = sameProductCheckParam.ShopSamePrpductItemList.Min(it => it.create_time).ParseToInt() - 1;
|
||||
|
||||
DouyinApi douApi = new DouyinApi(shopTemp);
|
||||
douApi.JsonData["page"] = "1";
|
||||
douApi.JsonData["size"] = "100";
|
||||
douApi.JsonData["end_time"] = tick.ToString();
|
||||
// check_status 指定审核状态返回商品列表:1未提审 2审核中 3审核通过 4审核驳回 5封禁 7审核通过,待上架状态
|
||||
//douApi.JsonData["check_status"] = "3";
|
||||
//douApi.JsonData["check_status"] = "1";
|
||||
//douApi.JsonData["status"] = "0";
|
||||
var resultOnline = douApi.GetProductList();
|
||||
if (resultOnline.Contains("已过期"))
|
||||
{
|
||||
shopTemp.ApiAuthStatus = "未授权";
|
||||
return;
|
||||
}
|
||||
while (!resultOnline.Contains("\"code\":10000"))
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(500, 1000) * tList.Count);
|
||||
resultOnline = douApi.GetProductList();
|
||||
}
|
||||
if (resultOnline != null && resultOnline.Contains("\"data\":[]"))
|
||||
{
|
||||
sameProductCheckParam.IsGetSuccess = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Newtonsoft.Json.Linq.JObject jObj = JsonHelper.JObjectParse(resultOnline);
|
||||
var itemList = JsonHelper.DeserializeJsonToList<ShopOurterProductItemParam>(jObj["data"]?["data"]?.ToString());
|
||||
sameProductCheckParam.ShopSamePrpductItemList.AddRange(itemList);
|
||||
|
||||
if (i % 10 == 9)
|
||||
{
|
||||
if (!GlobalConfig.SameProductCheckParamList.Contains(sameProductCheckParam))
|
||||
GlobalConfig.SameProductCheckParamList.Add(sameProductCheckParam);
|
||||
sameProductCheckParam.ShopSamePrpductItemList = sameProductCheckParam.ShopSamePrpductItemList.DistinctBy(it => it.product_id).ToList();
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<SameProductCheckParam>>("same_product_check_list", GlobalConfig.SameProductCheckParamList);
|
||||
}
|
||||
|
||||
Thread.Sleep(Randomx.GetId(500, 1000) * tList.Count);
|
||||
}
|
||||
if (!GlobalConfig.SameProductCheckParamList.Contains(sameProductCheckParam))
|
||||
GlobalConfig.SameProductCheckParamList.Add(sameProductCheckParam);
|
||||
sameProductCheckParam.ShopSamePrpductItemList = sameProductCheckParam.ShopSamePrpductItemList.DistinctBy(it => it.product_id).ToList();
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<SameProductCheckParam>>("same_product_check_list", GlobalConfig.SameProductCheckParamList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
});
|
||||
tList.Add(t);
|
||||
}
|
||||
Task.WaitAll(tList.ToArray());
|
||||
|
||||
Thread.Sleep(10000);
|
||||
}
|
||||
//List<Task> tList = new List<Task>();
|
||||
//var tick = BaseClass.DateTimeToTimestampSeconds(new DateTime(2022, 4, 25));
|
||||
//while (true)
|
||||
//{
|
||||
// if (GlobalConfig.ShopLoginList.All(shop => shop.ApiAuthStatus != "授权成功"
|
||||
// || GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess)))
|
||||
// {
|
||||
// Thread.Sleep(1000);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// tList.Clear();
|
||||
// foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
// {
|
||||
// if (GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess))
|
||||
// continue;
|
||||
//
|
||||
// if (shop.ApiAuthStatus != "授权成功")
|
||||
// continue;
|
||||
//
|
||||
// var t = Task.Run(() =>
|
||||
// {
|
||||
// var shopTemp = shop;
|
||||
// try
|
||||
// {
|
||||
// var sameProductCheckParam = GlobalConfig.SameProductCheckParamList.FirstOrDefault(sp => sp.ShopId == shop.ShopId);
|
||||
// if (sameProductCheckParam == null)
|
||||
// {
|
||||
// sameProductCheckParam = new SameProductCheckParam()
|
||||
// {
|
||||
// ShopId = shopTemp.ShopId,
|
||||
// ShopName = shopTemp.ShopAccount,
|
||||
// ShopSamePrpductItemList = new List<ShopOurterProductItemParam>(),
|
||||
// };
|
||||
// }
|
||||
// for (int i = 1; i <= 500; i++)
|
||||
// {
|
||||
// if (sameProductCheckParam.ShopSamePrpductItemList != null && sameProductCheckParam.ShopSamePrpductItemList.Count > 0)
|
||||
// tick = sameProductCheckParam.ShopSamePrpductItemList.Min(it => it.create_time).ParseToInt() - 1;
|
||||
//
|
||||
// DouyinApi douApi = new DouyinApi(shopTemp);
|
||||
// douApi.JsonData["page"] = "1";
|
||||
// douApi.JsonData["size"] = "100";
|
||||
// douApi.JsonData["end_time"] = tick.ToString();
|
||||
// // check_status 指定审核状态返回商品列表:1未提审 2审核中 3审核通过 4审核驳回 5封禁 7审核通过,待上架状态
|
||||
// //douApi.JsonData["check_status"] = "3";
|
||||
// //douApi.JsonData["check_status"] = "1";
|
||||
// //douApi.JsonData["status"] = "0";
|
||||
// var resultOnline = douApi.GetProductList();
|
||||
// if (resultOnline.Contains("已过期"))
|
||||
// {
|
||||
// shopTemp.ApiAuthStatus = "未授权";
|
||||
// return;
|
||||
// }
|
||||
// while (!resultOnline.Contains("\"code\":10000"))
|
||||
// {
|
||||
// Thread.Sleep(Randomx.GetId(500, 1000) * tList.Count);
|
||||
// resultOnline = douApi.GetProductList();
|
||||
// }
|
||||
// if (resultOnline != null && resultOnline.Contains("\"data\":[]"))
|
||||
// {
|
||||
// sameProductCheckParam.IsGetSuccess = true;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// Newtonsoft.Json.Linq.JObject jObj = JsonHelper.JObjectParse(resultOnline);
|
||||
// var itemList = JsonHelper.DeserializeJsonToList<ShopOurterProductItemParam>(jObj["data"]?["data"]?.ToString());
|
||||
// sameProductCheckParam.ShopSamePrpductItemList.AddRange(itemList);
|
||||
//
|
||||
// if (i % 10 == 9)
|
||||
// {
|
||||
// if (!GlobalConfig.SameProductCheckParamList.Contains(sameProductCheckParam))
|
||||
// GlobalConfig.SameProductCheckParamList.Add(sameProductCheckParam);
|
||||
// sameProductCheckParam.ShopSamePrpductItemList = sameProductCheckParam.ShopSamePrpductItemList.DistinctBy(it => it.product_id).ToList();
|
||||
// NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<SameProductCheckParam>>("same_product_check_list", GlobalConfig.SameProductCheckParamList);
|
||||
// }
|
||||
//
|
||||
// Thread.Sleep(Randomx.GetId(500, 1000) * tList.Count);
|
||||
// }
|
||||
// if (!GlobalConfig.SameProductCheckParamList.Contains(sameProductCheckParam))
|
||||
// GlobalConfig.SameProductCheckParamList.Add(sameProductCheckParam);
|
||||
// sameProductCheckParam.ShopSamePrpductItemList = sameProductCheckParam.ShopSamePrpductItemList.DistinctBy(it => it.product_id).ToList();
|
||||
// NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<SameProductCheckParam>>("same_product_check_list", GlobalConfig.SameProductCheckParamList);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// }
|
||||
// });
|
||||
// tList.Add(t);
|
||||
// }
|
||||
// Task.WaitAll(tList.ToArray());
|
||||
//
|
||||
// Thread.Sleep(10000);
|
||||
//}
|
||||
});
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user