用户消费统计 标题筛选逻辑优化

This commit is contained in:
wule committed 2026-08-10 19:30:27 +08:00
1 parent fe39437968
commit 35240505e3
10 files changed
+712 -239

No files matched your search

@@ -1050,9 +1050,9 @@ namespace KJD_Web.BLL.WXXD
string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id")?.Replace("'", "\\'");
string product_name = RegexUtils.GetStringQuery(ref inputData, "product_name")?.Replace("'", "\\'");
int? commission_rate = RegexUtils.GetStringQuery(ref inputData, "commission_rate").ParseToNullableInt();
if (string.IsNullOrEmpty("spu_id"))
if (string.IsNullOrEmpty(spu_id))
return "{\"code\":50001,\"msg\":\"没有商品Id\"}";
if (string.IsNullOrEmpty("product_name"))
if (string.IsNullOrEmpty(product_name))
return "{\"code\":50001,\"msg\":\"没有商品名称\"}";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
@@ -1155,6 +1155,108 @@ namespace KJD_Web.BLL.WXXD
}
public string WXAddMdyQualificationImage(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
//int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
//int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string img_md5 = RegexUtils.GetStringQuery(ref inputData, "img_md5")?.Replace("'", "\\'");
string img_base64 = RegexUtils.GetStringQuery(ref inputData, "img_base64")?.Replace("'", "\\'");
string img_thumb_base64 = RegexUtils.GetStringQuery(ref inputData, "img_thumb_base64")?.Replace("'", "\\'");
string txt_margin = RegexUtils.GetStringQuery(ref inputData, "txt_margin")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(img_md5))
return "{\"code\":50001,\"msg\":\"没有图片码\"}";
if (string.IsNullOrEmpty("product_name"))
return "{\"code\":50001,\"msg\":\"没有图片\"}";
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "INSERT INTO wxxd.wx_qualification_image (img_md5,img_base64,img_thumb_base64,txt_margin) VALUES " +
" ('" + img_md5 + "','" + img_base64 + "','" + img_thumb_base64 + "','" + txt_margin + "')" +
" ON DUPLICATE KEY UPDATE img_base64=VALUES(img_base64),img_thumb_base64=VALUES(img_thumb_base64),txt_margin=VALUES(txt_margin);";
var rst = mySql.ExecuteAffectedRows(sql);
mySql.Close();
if (!mySql.Message.IsNullOrEmpty())
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
else if (rst < 1)
{
return "{\"code\":500,\"msg\":\"未新增或更新\"}";
}
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXGetQualificationImage(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(1);
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
string img_md5 = RegexUtils.GetStringQuery(ref inputData, "img_md5")?.Replace("'", "\\'");
string is_detail = RegexUtils.GetStringQuery(ref inputData, "is_detail")?.Replace("'", "\\'");
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT * FROM wxxd.wx_qualification_image where 1=1";
string where = "";
if (!string.IsNullOrEmpty(img_md5))
where += " and img_md5 in ('" + img_md5.Replace(",", "','") + "')";
sql += where;
sql += " ORDER BY id DESC";
sql += " LIMIT " + (page - 1) * page_size + "," + page_size + ";";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
JArray jArr = new JArray();
try
{
foreach (DataRow row in dt.Rows)
{
JObject jObj = new JObject();
jObj["id"] = row["id"].ToString();
jObj["img_md5"] = row["img_md5"].ToString();
if (is_detail == "true")
jObj["img_base64"] = row["img_base64"].ParseToNullableString();
jObj["img_thumb_base64"] = row["img_thumb_base64"].ParseToNullableString();
jObj["txt_margin"] = row["txt_margin"].ParseToNullableString();
jObj["add_time"] = Convert.ToDateTime(row["add_time"]);
jObj["mdy_time"] = Convert.ToDateTime(row["mdy_time"]);
jArr.Add(jObj);
}
return "{\"code\":200,\"msg\":\"success\",\"data\":" + JsonUtils.SerializeObject(jArr) + "}";
}
catch (Exception ex)
{
return "{\"code\":50002,\"msg\":\"" + ex.Message + "\",\"data\":[]}";
}
}
else
{
return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":[]}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string E57GetFreightTemplate(string inputData)
{
if (string.IsNullOrEmpty(inputData))
@@ -152,6 +152,7 @@
<Compile Include="Model\WxModel\WxOptimizeExpressInfo.cs" />
<Compile Include="Model\WxModel\WXOrderAmountInfo.cs" />
<Compile Include="Model\WxModel\WXOrderDecryptAddressInfo.cs" />
<Compile Include="Model\WxModel\wx_qualification_image_info.cs" />
<Compile Include="Model\WxProdSecretSpuIdShopIdMapParam.cs" />
<Compile Include="Model\WXShopDefaultAddressInfo.cs" />
<Compile Include="Utils\ApiRequestLogger.cs" />
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model.WxModel
{
public class wx_qualification_image_info
{
public int id { get; set; }
public string img_md5 { get; set; }
public string img_base64 { get; set; }
public string txt_margin { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -311,6 +311,18 @@ namespace KJD_Web
Context.Response.End();
}
[WebMethod]
public void wx_add_mdy_qualification_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXProductManage().WXAddMdyQualificationImage(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void e57_get_freight_template()
{
@@ -331,7 +331,7 @@ namespace TemuKJD.ToolForms
}
titleList = titleList.Where(t => t?.Length > 20).ToList();
if (titleList.Count() > 50)
if (titleList.Count() >= 30)
{
if (chkWithTitle.Checked && !data.Contains(currentProd.product_name))
{
+21 -17
View File
@@ -40,11 +40,12 @@
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("充值二维码");
System.Windows.Forms.TreeNode treeNode15 = new System.Windows.Forms.TreeNode("快递费用明细");
System.Windows.Forms.TreeNode treeNode16 = new System.Windows.Forms.TreeNode("中转订单管理");
System.Windows.Forms.TreeNode treeNode17 = 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("充值二维码");
System.Windows.Forms.TreeNode treeNode16 = new System.Windows.Forms.TreeNode("快递费用明细");
System.Windows.Forms.TreeNode treeNode17 = new System.Windows.Forms.TreeNode("中转订单管理");
System.Windows.Forms.TreeNode treeNode18 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3,
@@ -60,7 +61,8 @@
treeNode13,
treeNode14,
treeNode15,
treeNode16});
treeNode16,
treeNode17});
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
@@ -175,18 +177,20 @@
treeNode11.Text = "带货助手";
treeNode12.Name = "图片工具";
treeNode12.Text = "图片工具";
treeNode13.Name = "运单管理";
treeNode13.Text = "运单管理";
treeNode14.Name = "充值二维码";
treeNode14.Text = "充值二维码";
treeNode15.Name = "快递费用明细";
treeNode15.Text = "快递费用明细";
treeNode16.Name = "中转订单管理";
treeNode16.Text = "中转订单管理";
treeNode17.Name = "超级权限管理";
treeNode17.Text = "超级权限管理";
treeNode13.Name = "资质图管理";
treeNode13.Text = "资质图管理";
treeNode14.Name = "运单管理";
treeNode14.Text = "运单管理";
treeNode15.Name = "充值二维码";
treeNode15.Text = "充值二维码";
treeNode16.Name = "快递费用明细";
treeNode16.Text = "快递费用明细";
treeNode17.Name = "中转订单管理";
treeNode17.Text = "中转订单管理";
treeNode18.Name = "超级权限管理";
treeNode18.Text = "超级权限管理";
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode17});
treeNode18});
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.tv.Size = new System.Drawing.Size(140, 572);
this.tv.TabIndex = 1;
@@ -1,4 +1,5 @@
using AllBase;
using AllBase.Model.Result.PDDResult;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -27,6 +28,7 @@ namespace TemuKJD.WXForms.AdminForms
public Lazy<GetJuShuitanProductSKUListForm> getJuShuitanProductSKUListForm = new Lazy<GetJuShuitanProductSKUListForm>();
public Lazy<Get1688ProductForm> get1688ProdForm = new Lazy<Get1688ProductForm>();
public Lazy<ImgToolForm> imgToolForm = new Lazy<ImgToolForm>();
public Lazy<WXAdminQualificationImageForm> qualificationImageForm = new Lazy<WXAdminQualificationImageForm>();
public Lazy<GetAddressForm> getAddressForm = new Lazy<GetAddressForm>();
public Lazy<WXSaleAssistantForm> saleAssistantForm = new Lazy<WXSaleAssistantForm>();
public Lazy<RandomComProductForm> randomComProductForm = new Lazy<RandomComProductForm>();
@@ -122,6 +124,9 @@ namespace TemuKJD.WXForms.AdminForms
case "图片工具":
SetForm(imgToolForm.Value);
break;
case "资质图管理":
SetForm(qualificationImageForm.Value);
break;
case "随机厂商商品":
SetForm(randomComProductForm.Value);
break;
@@ -35,30 +35,36 @@ namespace TemuKJD.WXForms.AdminForms
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.panel4 = new System.Windows.Forms.Panel();
this.txtShopName = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtShopId = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btnSearch = new DevComponents.DotNetBar.PanelEx();
this.txtUserName = new System.Windows.Forms.TextBox();
this.txtCatName = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtLoginName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnEmpty = new DevComponents.DotNetBar.PanelEx();
this.txtNotes = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.panel3 = new System.Windows.Forms.Panel();
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colCat1Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colChangeImage = new System.Windows.Forms.DataGridViewLinkColumn();
this.colDelete = new System.Windows.Forms.DataGridViewLinkColumn();
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.txtBottom = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.txtRight = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtTop = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtLeft = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.btnUploadImg = new DevComponents.DotNetBar.PanelEx();
this.btnSave = new DevComponents.DotNetBar.PanelEx();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.panel3 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -73,7 +79,9 @@ namespace TemuKJD.WXForms.AdminForms
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel3.SuspendLayout();
this.SuspendLayout();
//
@@ -115,62 +123,22 @@ namespace TemuKJD.WXForms.AdminForms
//
// panel4
//
this.panel4.Controls.Add(this.txtShopName);
this.panel4.Controls.Add(this.label3);
this.panel4.Controls.Add(this.txtShopId);
this.panel4.Controls.Add(this.label2);
this.panel4.Controls.Add(this.btnSearch);
this.panel4.Controls.Add(this.txtUserName);
this.panel4.Controls.Add(this.txtCatName);
this.panel4.Controls.Add(this.label5);
this.panel4.Controls.Add(this.txtLoginName);
this.panel4.Controls.Add(this.label1);
this.panel4.Controls.Add(this.btnEmpty);
this.panel4.Controls.Add(this.txtNotes);
this.panel4.Controls.Add(this.label4);
this.panel4.Location = new System.Drawing.Point(3, 3);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(600, 78);
this.panel4.TabIndex = 0;
//
// txtShopName
//
this.txtShopName.Location = new System.Drawing.Point(208, 41);
this.txtShopName.Name = "txtShopName";
this.txtShopName.Size = new System.Drawing.Size(90, 23);
this.txtShopName.TabIndex = 374;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(151, 44);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 17);
this.label3.TabIndex = 375;
this.label3.Text = "店铺名称:";
//
// txtShopId
//
this.txtShopId.Location = new System.Drawing.Point(57, 41);
this.txtShopId.Name = "txtShopId";
this.txtShopId.Size = new System.Drawing.Size(90, 23);
this.txtShopId.TabIndex = 372;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 44);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 17);
this.label2.TabIndex = 373;
this.label2.Text = "店铺id:";
//
// btnSearch
//
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(319, 12);
this.btnSearch.Location = new System.Drawing.Point(181, 12);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(56, 23);
this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -188,44 +156,28 @@ namespace TemuKJD.WXForms.AdminForms
this.btnSearch.Text = "搜索";
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// txtUserName
// txtCatName
//
this.txtUserName.Location = new System.Drawing.Point(57, 12);
this.txtUserName.Name = "txtUserName";
this.txtUserName.Size = new System.Drawing.Size(90, 23);
this.txtUserName.TabIndex = 419;
this.txtCatName.Location = new System.Drawing.Point(83, 12);
this.txtCatName.Name = "txtCatName";
this.txtCatName.Size = new System.Drawing.Size(90, 23);
this.txtCatName.TabIndex = 419;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(24, 15);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(44, 17);
this.label5.Size = new System.Drawing.Size(68, 17);
this.label5.TabIndex = 420;
this.label5.Text = "账户:";
//
// txtLoginName
//
this.txtLoginName.Location = new System.Drawing.Point(208, 12);
this.txtLoginName.Name = "txtLoginName";
this.txtLoginName.Size = new System.Drawing.Size(90, 23);
this.txtLoginName.TabIndex = 417;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(151, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 17);
this.label1.TabIndex = 418;
this.label1.Text = "登录号码:";
this.label5.Text = "类目名称:";
//
// btnEmpty
//
this.btnEmpty.CanvasColor = System.Drawing.SystemColors.Control;
this.btnEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnEmpty.DisabledBackColor = System.Drawing.Color.Empty;
this.btnEmpty.Location = new System.Drawing.Point(380, 12);
this.btnEmpty.Location = new System.Drawing.Point(242, 12);
this.btnEmpty.Name = "btnEmpty";
this.btnEmpty.Size = new System.Drawing.Size(56, 23);
this.btnEmpty.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -244,22 +196,6 @@ namespace TemuKJD.WXForms.AdminForms
this.btnEmpty.Text = "清空条件";
this.btnEmpty.Click += new System.EventHandler(this.pnlEmpty_Click);
//
// txtNotes
//
this.txtNotes.Location = new System.Drawing.Point(346, 41);
this.txtNotes.Name = "txtNotes";
this.txtNotes.Size = new System.Drawing.Size(90, 23);
this.txtNotes.TabIndex = 376;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(313, 44);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 377;
this.label4.Text = "备注:";
//
// pbLoading
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
@@ -308,77 +244,6 @@ namespace TemuKJD.WXForms.AdminForms
this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
this.dgvShop.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvShop_CellMouseDown);
//
// splitContainer2
//
this.splitContainer2.BackColor = System.Drawing.Color.White;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.BackColor = System.Drawing.Color.White;
this.splitContainer2.Panel1.Controls.Add(this.splitContainer3);
this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1);
this.splitContainer2.Panel2.Controls.Add(this.statusBar);
this.splitContainer2.Size = new System.Drawing.Size(1271, 576);
this.splitContainer2.SplitterDistance = 547;
this.splitContainer2.TabIndex = 0;
//
// splitContainer3
//
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer3.Location = new System.Drawing.Point(4, 0);
this.splitContainer3.Name = "splitContainer3";
//
// splitContainer3.Panel1
//
this.splitContainer3.Panel1.Controls.Add(this.splitContainer1);
this.splitContainer3.Size = new System.Drawing.Size(1263, 547);
this.splitContainer3.SplitterDistance = 606;
this.splitContainer3.TabIndex = 0;
//
// ucSplitPage1
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = true;
this.ucSplitPage1.Location = new System.Drawing.Point(882, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.PageSize = 50;
this.ucSplitPage1.Size = new System.Drawing.Size(389, 25);
this.ucSplitPage1.TabIndex = 4;
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(1271, 25);
this.statusBar.TabIndex = 1;
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Controls.Add(this.splitContainer2);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(1, 33);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(1271, 576);
this.panel3.TabIndex = 35;
//
// colSelect
//
this.colSelect.FillWeight = 16F;
@@ -417,6 +282,264 @@ namespace TemuKJD.WXForms.AdminForms
this.colMsg.Name = "colMsg";
this.colMsg.ReadOnly = true;
//
// splitContainer2
//
this.splitContainer2.BackColor = System.Drawing.Color.White;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.BackColor = System.Drawing.Color.White;
this.splitContainer2.Panel1.Controls.Add(this.splitContainer3);
this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1);
this.splitContainer2.Panel2.Controls.Add(this.statusBar);
this.splitContainer2.Size = new System.Drawing.Size(1271, 576);
this.splitContainer2.SplitterDistance = 547;
this.splitContainer2.TabIndex = 0;
//
// splitContainer3
//
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer3.Location = new System.Drawing.Point(4, 0);
this.splitContainer3.Name = "splitContainer3";
//
// splitContainer3.Panel1
//
this.splitContainer3.Panel1.Controls.Add(this.splitContainer1);
//
// splitContainer3.Panel2
//
this.splitContainer3.Panel2.Controls.Add(this.txtBottom);
this.splitContainer3.Panel2.Controls.Add(this.label7);
this.splitContainer3.Panel2.Controls.Add(this.txtRight);
this.splitContainer3.Panel2.Controls.Add(this.label6);
this.splitContainer3.Panel2.Controls.Add(this.txtTop);
this.splitContainer3.Panel2.Controls.Add(this.label4);
this.splitContainer3.Panel2.Controls.Add(this.txtLeft);
this.splitContainer3.Panel2.Controls.Add(this.label3);
this.splitContainer3.Panel2.Controls.Add(this.label2);
this.splitContainer3.Panel2.Controls.Add(this.btnUploadImg);
this.splitContainer3.Panel2.Controls.Add(this.btnSave);
this.splitContainer3.Panel2.Controls.Add(this.pictureBox1);
this.splitContainer3.Panel2.Controls.Add(this.label1);
this.splitContainer3.Panel2.Controls.Add(this.comboBox1);
this.splitContainer3.Size = new System.Drawing.Size(1263, 547);
this.splitContainer3.SplitterDistance = 606;
this.splitContainer3.TabIndex = 0;
//
// txtBottom
//
this.txtBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.txtBottom.Location = new System.Drawing.Point(557, 442);
this.txtBottom.Name = "txtBottom";
this.txtBottom.Size = new System.Drawing.Size(56, 23);
this.txtBottom.TabIndex = 471;
this.txtBottom.Text = "270";
//
// label7
//
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(531, 445);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(32, 17);
this.label7.TabIndex = 472;
this.label7.Text = "下:";
//
// txtRight
//
this.txtRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.txtRight.Location = new System.Drawing.Point(557, 413);
this.txtRight.Name = "txtRight";
this.txtRight.Size = new System.Drawing.Size(56, 23);
this.txtRight.TabIndex = 469;
this.txtRight.Text = "240";
//
// label6
//
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(531, 416);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(32, 17);
this.label6.TabIndex = 470;
this.label6.Text = "右:";
//
// txtTop
//
this.txtTop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.txtTop.Location = new System.Drawing.Point(557, 384);
this.txtTop.Name = "txtTop";
this.txtTop.Size = new System.Drawing.Size(56, 23);
this.txtTop.TabIndex = 467;
this.txtTop.Text = "270";
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(531, 387);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 17);
this.label4.TabIndex = 468;
this.label4.Text = "上:";
//
// txtLeft
//
this.txtLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.txtLeft.Location = new System.Drawing.Point(557, 355);
this.txtLeft.Name = "txtLeft";
this.txtLeft.Size = new System.Drawing.Size(56, 23);
this.txtLeft.TabIndex = 465;
this.txtLeft.Text = "240";
this.txtLeft.TextChanged += new System.EventHandler(this.txt_TextChanged);
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(531, 358);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(32, 17);
this.label3.TabIndex = 466;
this.label3.Text = "左:";
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(531, 325);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 17);
this.label2.TabIndex = 464;
this.label2.Text = "文字边距:";
//
// btnUploadImg
//
this.btnUploadImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnUploadImg.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnUploadImg.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnUploadImg.DisabledBackColor = System.Drawing.Color.Empty;
this.btnUploadImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUploadImg.Location = new System.Drawing.Point(534, 471);
this.btnUploadImg.Name = "btnUploadImg";
this.btnUploadImg.Size = new System.Drawing.Size(79, 23);
this.btnUploadImg.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnUploadImg.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUploadImg.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnUploadImg.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnUploadImg.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnUploadImg.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnUploadImg.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnUploadImg.Style.GradientAngle = 90;
this.btnUploadImg.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnUploadImg.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUploadImg.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUploadImg.TabIndex = 457;
this.btnUploadImg.Text = "选择图片";
this.btnUploadImg.Click += new System.EventHandler(this.btnUploadImg_Click);
//
// btnSave
//
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(534, 500);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(79, 23);
this.btnSave.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSave.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSave.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSave.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSave.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSave.Style.GradientAngle = 90;
this.btnSave.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSave.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSave.TabIndex = 453;
this.btnSave.Text = "保存";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// pictureBox1
//
this.pictureBox1.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.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(76, 88);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(437, 436);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 422;
this.pictureBox1.TabStop = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(73, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 17);
this.label1.TabIndex = 421;
this.label1.Text = "类目名称:";
//
// comboBox1
//
this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(141, 30);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(372, 25);
this.comboBox1.TabIndex = 0;
//
// ucSplitPage1
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = true;
this.ucSplitPage1.Location = new System.Drawing.Point(882, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.PageSize = 50;
this.ucSplitPage1.Size = new System.Drawing.Size(389, 25);
this.ucSplitPage1.TabIndex = 4;
this.ucSplitPage1.TotalPage = 1;
this.ucSplitPage1.Visible = false;
//
// 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(1271, 25);
this.statusBar.TabIndex = 1;
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Controls.Add(this.splitContainer2);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(1, 33);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(1271, 576);
this.panel3.TabIndex = 35;
//
// WXAdminQualificationImageForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -445,8 +568,11 @@ namespace TemuKJD.WXForms.AdminForms
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel2.ResumeLayout(false);
this.splitContainer3.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panel3.ResumeLayout(false);
this.ResumeLayout(false);
@@ -455,21 +581,13 @@ namespace TemuKJD.WXForms.AdminForms
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox txtNotes;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtShopName;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtShopId;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.PictureBox pbLoading;
private UserComponent.DataGridViewEx dgvShop;
private UserControls.StatusBarUserControl statusBar;
private DevComponents.DotNetBar.PanelEx btnEmpty;
private UserControls.UcSplitPage ucSplitPage1;
private System.Windows.Forms.TextBox txtLoginName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.TextBox txtCatName;
private System.Windows.Forms.Label label5;
private DevComponents.DotNetBar.PanelEx btnSearch;
private System.Windows.Forms.Panel panel3;
@@ -481,5 +599,19 @@ namespace TemuKJD.WXForms.AdminForms
private System.Windows.Forms.DataGridViewLinkColumn colChangeImage;
private System.Windows.Forms.DataGridViewLinkColumn colDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox1;
private DevComponents.DotNetBar.PanelEx btnUploadImg;
private DevComponents.DotNetBar.PanelEx btnSave;
private System.Windows.Forms.TextBox txtBottom;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtRight;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox txtTop;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtLeft;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
}
}
@@ -1,6 +1,7 @@
using AllBase;
using AllBase.Model.Param.TemuProductManage;
using AllBase.Model.Result;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
@@ -11,16 +12,16 @@ using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.BaseForms;
using Work;
using NaiBa.Util;
using TemuKJD.WXForms.ShopForms;
using Work;
namespace TemuKJD.WXForms.AdminForms
{
@@ -149,11 +150,7 @@ namespace TemuKJD.WXForms.AdminForms
private void pnlEmpty_Click(object sender, EventArgs e)
{
this.txtUserName.Text = "";
this.txtLoginName.Text = "";
this.txtNotes.Text = "";
this.txtShopId.Text = "";
this.txtShopName.Text = "";
this.txtCatName.Text = "";
}
bool IsOperate { get; set; } = false;
@@ -225,14 +222,10 @@ namespace TemuKJD.WXForms.AdminForms
seconds = 0;
var url = BaseClass.BuildObjString("shop/admin_get_server_qualification_image_list");
var data = UserLogin.GetSignaturex() +
"&page=" + page +
var data = UserLogin.GetSignaturex() +
"&page=" + page +
"&page_size=" + pageSize +
"&search_user_name=" + txtUserName.Text.Trim() +
"&search_login_name=" + txtLoginName.Text.Trim() +
"&search_notes=" + txtNotes.Text.Trim() +
"&search_id=" + txtShopId.Text.Trim() +
"&search_name=" + txtShopName.Text.Trim();
"&search_cat_name=" + txtCatName.Text.Trim();
if (BaseClass.SaLevel > 1)
data += "&operate_sub_sa_name=" + BaseClass.UserName;
var html = GetHtml.PostUtf8(url, data);
@@ -253,5 +246,210 @@ namespace TemuKJD.WXForms.AdminForms
private void dgvShop_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
}
public static Image EmptyImage = null;
private void btnUploadImg_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = false;
// 设置过滤条件,只显示文本文件
openFileDialog.Filter = "图片文件 (*.jpeg;*.jpg;*.png)|*.jpeg;*.jpg;*.png|All files (*.*)|*.*";
// 显示对话框并获取结果
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
try
{
string filePath = openFileDialog.FileName;
Image imageSource = Image.FromFile(filePath);
EmptyImage = new Bitmap(900, 1200);
using (Graphics g = Graphics.FromImage(EmptyImage))
{
g.DrawImage(imageSource, new Rectangle(0, 0, EmptyImage.Width, EmptyImage.Height), 0, 0, imageSource.Width, imageSource.Height, GraphicsUnit.Pixel);
}
string imgBase64 = "";
using (MemoryStream memoryStream = new MemoryStream())
{
EmptyImage.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] imageBytes = memoryStream.ToArray();
imgBase64 = Convert.ToBase64String(imageBytes);
}
if (this.pictureBox1.Tag.ParseToString() != imgBase64)
{
this.pictureBox1.Tag = imgBase64;
this.pictureBox1.ImageLocation = "";
Image image = new Bitmap(900, 1200);
using (Graphics g = Graphics.FromImage(image))
{
g.DrawImage(EmptyImage, new Rectangle(0, 0, image.Width, image.Height), 0, 0, EmptyImage.Width, EmptyImage.Height, GraphicsUnit.Pixel);
}
DrawText(image, txtLeft.Text.ParseToInt(), txtTop.Text.ParseToInt(), txtRight.Text.ParseToInt(), txtBottom.Text.ParseToInt());
this.pictureBox1.Image = image;
}
}
catch (Exception ex)
{
BaseMsgForm.ShowError("打开自定义sku图片失败 " + ex.Message);
return;
}
}
}
public static void DrawText(Image img, int _txtLeft, int _txtTop, int _txtRight, int _txtBottom)
{
if (img == null)
return;
string bookName = "行走中国 : 人文风情和自然生态发现之旅";
string author = "雷东军";
string publisher = "中国工人出版社";
string isbn = "978-7-500-87761-5";
string binding = "装  帧:平装";
string edition = "版  次:1";
string publishTime = "2021-12-01";
string bookPrice = "37.39";
var bookImg = img;
var imgH = bookImg.Height;
var imgW = bookImg.Width;
using (Graphics g = Graphics.FromImage(bookImg))
{
Brush textBrush = Brushes.Black;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
float txtTop = _txtTop;
float txtBottom = _txtBottom;
float txtLeft = _txtLeft;
float txtRight = _txtRight;
int txtWidth = (int)imgW - (int)txtLeft - (int)txtRight; // 370;
// 书名
Font font = new Font("宋体", 22, FontStyle.Bold);
RectangleF rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(bookName.Replace("图书名称:", ""), font, textBrush, rectF);
// 测量文本的高度 决定接下来文字绘制位置
var textSize = g.MeasureString(bookName.Replace("图书名称:", ""), font, txtWidth);
txtTop += 20 + textSize.Height;
font = new Font("宋体", 15, FontStyle.Bold);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(author.Replace("作  者:", "").TrimEnd('著', ' ') + " 著", font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(author.Replace("作  者:", "").TrimEnd('著', ' ') + " 著", font, txtWidth);
txtTop += 20 + textSize.Height;
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(publisher.Replace("出版发行:", ""), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publisher.Replace("出版发行:", ""), font, txtWidth);
txtTop += 20 + textSize.Height;
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(isbn.Replace("ISBN/CN刊号:", "ISBN "), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(isbn.Replace("ISBN/CN刊号:", "ISBN "), font, txtWidth);
txtTop += 20 + textSize.Height;
// 以下从下往上写
txtTop = imgH - txtBottom;
// 测量文本的高度
textSize = g.MeasureString(binding, font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(binding, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(edition, font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(edition, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publishTime, font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(publishTime, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(author, font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(author, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(bookPrice + "元", font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(bookPrice + "元", font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(bookName, font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(bookName, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(isbn.Replace("ISBN/CN刊号:", "书  号:ISBN "), font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(isbn.Replace("ISBN/CN刊号:", "书  号:ISBN "), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publisher, font, txtWidth);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(publisher, font, textBrush, rectF);
}
}
private void txt_TextChanged(object sender, EventArgs e)
{
Image image = new Bitmap(900, 1200);
using (Graphics g = Graphics.FromImage(image))
{
g.DrawImage(EmptyImage, new Rectangle(0, 0, image.Width, image.Height), 0, 0, EmptyImage.Width, EmptyImage.Height, GraphicsUnit.Pixel);
}
DrawText(image, txtLeft.Text.ParseToInt(), txtTop.Text.ParseToInt(), txtRight.Text.ParseToInt(), txtBottom.Text.ParseToInt());
this.pictureBox1.Image = image;
}
private void btnSave_Click(object sender, EventArgs e)
{
if (pictureBox1.Tag.ParseToString().IsNullOrEmpty())
return;
var thumbImage = new Bitmap(90, 120);
using (Graphics g = Graphics.FromImage(thumbImage))
{
g.DrawImage(EmptyImage, new Rectangle(0, 0, thumbImage.Width, thumbImage.Height), 0, 0, EmptyImage.Width, EmptyImage.Height, GraphicsUnit.Pixel);
}
string thumbBase64 = "";
using (MemoryStream memoryStream = new MemoryStream())
{
thumbImage.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] imageBytes = memoryStream.ToArray();
thumbBase64 = Convert.ToBase64String(imageBytes);
}
var url = BaseClass.BuildWXObjString("product/wx_add_mdy_qualification_image");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex();
data += "&img_md5=" + BaseClass.GetMd5(pictureBox1.Tag.ParseToString());
data += "&img_base64=" + pictureBox1.Tag.ParseToString();
data += "&txt_margin=" + txtLeft.Text.ParseToInt() + "," + txtTop.Text.ParseToInt() + "," + txtRight.Text.ParseToInt() + "," + txtBottom.Text.ParseToInt();
data += "&img_thumb_base64=" + thumbBase64;
}));
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);
}
}
}
@@ -4799,85 +4799,87 @@ namespace TemuKJD.WXForms.ProductForms
{
Brush textBrush = Brushes.Black;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
float txtY = 240;
float txtX = 280;
int txtWidth = 370;
float txtTop = 240;
float txtBottom = 240;
float txtLeft = 280;
float txtRight = 270;
int txtWidth = (int)imgW - (int)txtLeft - (int)txtRight; // 370;
// 书名
Font font = new Font("宋体", 22, FontStyle.Bold);
RectangleF rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
RectangleF rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(bookName.Replace("图书名称:", ""), font, textBrush, rectF);
// 测量文本的高度 决定接下来文字绘制位置
var textSize = g.MeasureString(bookName.Replace("图书名称:", ""), font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
font = new Font("宋体", 15, FontStyle.Bold);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(author.Replace("作  者:", "").TrimEnd('著', ' ') + " 著", font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(author.Replace("作  者:", "").TrimEnd('著', ' ') + " 著", font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(publisher.Replace("出版发行:", ""), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publisher.Replace("出版发行:", ""), font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY - 80);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop - 80);
g.DrawString(isbn.Replace("ISBN/CN刊号:", "ISBN "), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(isbn.Replace("ISBN/CN刊号:", "ISBN "), font, txtWidth);
txtY += 20 + textSize.Height;
txtTop += 20 + textSize.Height;
// 以下从下往上写
txtY = imgH - 240;
txtTop = imgH - txtBottom;
// 测量文本的高度
textSize = g.MeasureString(binding, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(binding, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(edition, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(edition, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publishTime, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(publishTime, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(author, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(author, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(bookPrice + "元", font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(bookPrice + "元", font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(bookName, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(bookName, font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(isbn.Replace("ISBN/CN刊号:", "书  号:ISBN "), font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(isbn.Replace("ISBN/CN刊号:", "书  号:ISBN "), font, textBrush, rectF);
// 测量文本的高度
textSize = g.MeasureString(publisher, font, txtWidth);
txtY -= (10 + textSize.Height);
rectF = new RectangleF(txtX, txtY, txtWidth, imgH - txtY);
txtTop -= (10 + textSize.Height);
rectF = new RectangleF(txtLeft, txtTop, txtWidth, imgH - txtTop);
g.DrawString(publisher, font, textBrush, rectF);
}