书籍类目上传

This commit is contained in:
wule_5900x committed 2026-01-18 20:40:11 +08:00
1 parent dbc954a200
commit 2ae38c8105
10 files changed
+339 -89

No files matched your search

@@ -30,6 +30,7 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdEditForm));
this.panel2 = new System.Windows.Forms.Panel();
this.btnBookImg = new DevComponents.DotNetBar.PanelEx();
this.btnEditDetail = new DevComponents.DotNetBar.PanelEx();
this.btnSelect = new TemuKJD.UserControls.ButtonEx();
this.buttonEx1 = new TemuKJD.UserControls.ButtonEx();
@@ -61,6 +62,7 @@
// panel2
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.Controls.Add(this.btnBookImg);
this.panel2.Controls.Add(this.btnEditDetail);
this.panel2.Controls.Add(this.btnSelect);
this.panel2.Controls.Add(this.buttonEx1);
@@ -90,6 +92,31 @@
this.panel2.Size = new System.Drawing.Size(464, 651);
this.panel2.TabIndex = 1;
//
// btnBookImg
//
this.btnBookImg.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnBookImg.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnBookImg.DisabledBackColor = System.Drawing.Color.Empty;
this.btnBookImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBookImg.Location = new System.Drawing.Point(341, 523);
this.btnBookImg.Name = "btnBookImg";
this.btnBookImg.Size = new System.Drawing.Size(85, 26);
this.btnBookImg.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnBookImg.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnBookImg.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnBookImg.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnBookImg.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnBookImg.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnBookImg.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnBookImg.Style.GradientAngle = 90;
this.btnBookImg.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnBookImg.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnBookImg.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnBookImg.TabIndex = 654;
this.btnBookImg.Text = "生成书籍图片";
this.btnBookImg.Visible = false;
this.btnBookImg.Click += new System.EventHandler(this.btnBookImg_Click);
//
// btnEditDetail
//
this.btnEditDetail.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
@@ -415,5 +442,6 @@
private UserControls.ButtonEx buttonEx1;
private UserControls.ButtonEx btnSelect;
private DevComponents.DotNetBar.PanelEx btnEditDetail;
private DevComponents.DotNetBar.PanelEx btnBookImg;
}
}
@@ -240,5 +240,65 @@ namespace TemuKJD.PDDForms.ProductSelectForms
PDDDBProdEditDetailForm editDetailForm = new PDDDBProdEditDetailForm(this.dbProd);
editDetailForm.ShowDialog();
}
private void btnBookImg_Click(object sender, EventArgs e)
{
var prodJson = this.dbProd.product_json;
var prodInfo = JsonHelper.DeserializeJsonToObject<AllBase.Model.Result.PDDResult.PDDProductInfo>(prodJson);
if (prodInfo != null)
{
string publisher = "出版社:" + new List<string> () { "技术出版社", "文化出版社", "美术出版社" }[Randomx.GetId(3)];
string isbn = "ISBN:";
string bookName = "书名:";
string bookPrice = "定价:" + prodInfo.detail.sku.Max(s => s.multi_price) * 0.01;
string author = "作者:王老师";
string publishTime = "出版时间:" + DateTime.Now.AddMonths(-3);
string edition = "版次:1";
string binding = "装帧:平装";
foreach (var propInfo in prodInfo.property.goods_properties)
{
if (propInfo.name.Contains("出版社名称"))
publisher = "出版社:" + propInfo.values.FirstOrDefault()?.value;
else if (propInfo.name.Contains("ISBN"))
isbn = "ISBN:" + propInfo.values.FirstOrDefault()?.value;
else if (propInfo.name.Contains("书名"))
bookName = "书名:" + propInfo.values.FirstOrDefault()?.value;
else if (propInfo.name.Contains("定价"))
bookPrice = "定价:" + propInfo.values.FirstOrDefault()?.value;
else if (propInfo.name.Contains("作者"))
author = "作者:" + propInfo.values.FirstOrDefault()?.value;
else if (propInfo.name.Contains("出版时间"))
publishTime = "出版时间:" + propInfo.values.FirstOrDefault()?.value;
else if (propInfo.name.Contains("版次"))
edition = "版次:" + propInfo.values.FirstOrDefault()?.value;
else if (propInfo.name.Contains("装帧"))
binding = "装帧:" + propInfo.values.FirstOrDefault()?.value;
}
var bookStr = publisher + "\r\n" + "\r\n" +
isbn + "\r\n" + "\r\n" +
bookName + "\r\n" + "\r\n" +
bookPrice + "\r\n" + "\r\n" +
author + "\r\n" + "\r\n" +
publishTime + "\r\n" + "\r\n" +
edition + "\r\n" + "\r\n" +
binding;
var imageBg = new Bitmap(800, 800);
using (Graphics g = Graphics.FromImage(imageBg))
{
g.Clear(Color.White);
//Font font = new Font("宋体", 15, FontStyle.Bold);
Font font = new Font("微软雅黑", 15, FontStyle.Regular);
Brush textBrush = Brushes.Black;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
RectangleF rectF = new RectangleF(80, 80, 800 - 80, 800 - 80);
g.DrawString(bookStr, font, textBrush, rectF);
}
ShowImgForm imgFrom = new ShowImgForm(imageBg);
imgFrom.ShowDialog();
}
}
}
}
@@ -5220,7 +5220,7 @@ Content-Disposition: form-data; name=""pic_operations""
}
public static string GetChanceGoodsList(ShopLoginInfo shop, string searchWord, List<string> labels = null, string desc="", int page = 1,
long? cat1 = null, long? cat2 = null, int? price1 = null, int? price2 = null)
long? cat1 = null, long? cat2 = null, decimal? price1 = null, decimal? price2 = null)
{
//labels
//newinfashion_new 当季新品
@@ -5245,7 +5245,7 @@ Content-Disposition: form-data; name=""pic_operations""
}
if (string.IsNullOrEmpty(searchWord))
{
jObj["banner_type"] = 0;
//jObj["banner_type"] = 0;
}
else
{
@@ -40,8 +40,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.label11 = new System.Windows.Forms.Label();
this.txtMaxPrice = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.txtSearchMaxPrice = new System.Windows.Forms.TextBox();
this.txtSearchMinPrice = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.cmbCat2 = new System.Windows.Forms.ComboBox();
@@ -149,8 +149,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx1.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx1.Controls.Add(this.label11);
this.ucGroupBoxEx1.Controls.Add(this.txtMaxPrice);
this.ucGroupBoxEx1.Controls.Add(this.textBox1);
this.ucGroupBoxEx1.Controls.Add(this.txtSearchMaxPrice);
this.ucGroupBoxEx1.Controls.Add(this.txtSearchMinPrice);
this.ucGroupBoxEx1.Controls.Add(this.label10);
this.ucGroupBoxEx1.Controls.Add(this.label7);
this.ucGroupBoxEx1.Controls.Add(this.cmbCat2);
@@ -198,19 +198,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.label11.TabIndex = 943;
this.label11.Text = "至";
//
// txtMaxPrice
// txtSearchMaxPrice
//
this.txtMaxPrice.Location = new System.Drawing.Point(704, 59);
this.txtMaxPrice.Name = "txtMaxPrice";
this.txtMaxPrice.Size = new System.Drawing.Size(40, 23);
this.txtMaxPrice.TabIndex = 942;
this.txtSearchMaxPrice.Location = new System.Drawing.Point(704, 59);
this.txtSearchMaxPrice.Name = "txtSearchMaxPrice";
this.txtSearchMaxPrice.Size = new System.Drawing.Size(40, 23);
this.txtSearchMaxPrice.TabIndex = 942;
//
// textBox1
// txtSearchMinPrice
//
this.textBox1.Location = new System.Drawing.Point(644, 59);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(40, 23);
this.textBox1.TabIndex = 941;
this.txtSearchMinPrice.Location = new System.Drawing.Point(644, 59);
this.txtSearchMinPrice.Name = "txtSearchMinPrice";
this.txtSearchMinPrice.Size = new System.Drawing.Size(40, 23);
this.txtSearchMinPrice.TabIndex = 941;
//
// label10
//
@@ -1094,8 +1094,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.ComboBox cmbCat1;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox txtMaxPrice;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox txtSearchMaxPrice;
private System.Windows.Forms.TextBox txtSearchMinPrice;
private System.Windows.Forms.Label label10;
}
}
@@ -417,7 +417,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
int totalPage = 1;
int getCount = 0;
int total = 2000;
while(getCount < searchCount && page <=totalPage)
while(getCount < searchCount && page <= totalPage)
{
if (shop == null)
break;
@@ -455,14 +455,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
long? cat1 = null;
long? cat2 = null;
int? price1 = null;
int? price2 = null;
decimal? price1 = null;
decimal? price2 = null;
Invoke(new Action(() =>
{
cat1 = lstChanceCateInfo.FirstOrDefault(c => c.cate_lvl == 1 && c.cate_name == cmbCat1.Text)?.cate_id;
cat2 = lstChanceCateInfo.FirstOrDefault(c => cat1 != null && c.cate_lvl == 2 && c.cate_name == cmbCat2.Text)?.cate_id;
price1 = txtMinPrice.Text.Trim().ParseToInt();
price2 = txtMaxPrice.Text.Trim().ParseToInt();
price1 = txtSearchMinPrice.Text.Trim().ParseToDecimal();
price2 = txtSearchMaxPrice.Text.Trim().ParseToDecimal();
if (price1 == 0 || price2 == 0)
price1 = price2 = null;
}));
@@ -527,7 +527,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
return;
}
total = BaseRegex.GetIntJson(ref rst, "total");
totalPage = total / getResult.list.Count;
if (getResult.list.Count == 0)
totalPage = 0;
else
{
totalPage = Math.Ceiling(total * 1.0 / getResult.list.Count).ParseToInt();
}
page++;
}
@@ -583,7 +588,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
private string GetChanceGoodsList(ShopLoginInfo shop, string searchWord, List<string> labels = null, string desc="", int page = 1,
long? cat1 = null, long? cat2 = null, int? price1 = null, int? price2 = null)
long? cat1 = null, long? cat2 = null, decimal? price1 = null, decimal? price2 = null)
{
return PDDDBProdUserSelectForm.GetChanceGoodsList(shop, searchWord, labels, desc, page, cat1, cat2, price1, price2);
}