云收藏 增加AI检测图片

This commit is contained in:
chfei committed 2026-11-05 18:50:13 +08:00
1 parent b28940c02d
commit b54a5f5310
36 files changed
+1978 -523

No files matched your search

+3 -1
View File
@@ -30,8 +30,9 @@
{
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("解除限制");
System.Windows.Forms.TreeNode violationNode = new System.Windows.Forms.TreeNode("违规检测");
System.Windows.Forms.TreeNode complianceNode = new System.Windows.Forms.TreeNode("商品 AI 检测");
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("系统设置", new System.Windows.Forms.TreeNode[] {
treeNode1, violationNode});
treeNode1, violationNode, complianceNode});
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
@@ -104,6 +105,7 @@
this.tv.Name = "tv";
treeNode1.Name = "解除限制";
treeNode1.Text = "解除限制";
complianceNode.Name = "商品 AI 检测";
violationNode.Name = "违规检测";
violationNode.Text = "违规检测";
treeNode2.Name = "系统设置";
@@ -16,6 +16,8 @@ namespace TemuKJD.KJDForms.SystemForms
{
public Lazy<SystemRemoveRestrictionsForm> systemRemoveRestrictionsForm = new Lazy<SystemRemoveRestrictionsForm>();
public Lazy<SystemViolationDetectionForm> systemViolationDetectionForm = new Lazy<SystemViolationDetectionForm>();
private readonly Lazy<SystemGoodsComplianceForm> goodsComplianceForm = new Lazy<SystemGoodsComplianceForm>();
public SystemForm()
{
InitializeComponent();
@@ -47,6 +49,9 @@ namespace TemuKJD.KJDForms.SystemForms
case "解除限制":
SetForm(systemRemoveRestrictionsForm.Value);
break;
case "商品 AI 检测":
SetForm(goodsComplianceForm.Value);
break;
case "违规检测":
SetForm(systemViolationDetectionForm.Value);
break;
@@ -0,0 +1,186 @@
using System.Drawing;
using System.Windows.Forms;
namespace TemuKJD.KJDForms.SystemForms
{
partial class SystemGoodsComplianceForm
{
private GroupBox imagesGroup;
private Label mainLabel;
private ComboBox main;
private NumericUpDown mainCount;
private Label mainUnit;
private Label detailLabel;
private ComboBox detail;
private NumericUpDown detailCount;
private Label detailUnit;
private CheckBox sku;
private GroupBox keywordsGroup;
private TextBox keywords;
private Label keywordsHint;
private Button btnSaveDetection;
private void InitializeComponent()
{
this.imagesGroup = new GroupBox();
this.mainLabel = new Label();
this.main = new ComboBox();
this.mainCount = new NumericUpDown();
this.mainUnit = new Label();
this.detailLabel = new Label();
this.detail = new ComboBox();
this.detailCount = new NumericUpDown();
this.detailUnit = new Label();
this.sku = new CheckBox();
this.keywordsGroup = new GroupBox();
this.keywords = new TextBox();
this.keywordsHint = new Label();
this.btnSaveDetection = new Button();
this.imagesGroup.SuspendLayout();
this.keywordsGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.mainCount)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.detailCount)).BeginInit();
this.SuspendLayout();
this.imagesGroup.Name = "imagesGroup";
this.imagesGroup.Location = new Point(20, 16);
this.imagesGroup.TabIndex = 0;
this.imagesGroup.Size = new Size(760, 153);
this.imagesGroup.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
this.imagesGroup.Text = "检测图片";
this.imagesGroup.Controls.Add(this.mainLabel);
this.imagesGroup.Controls.Add(this.main);
this.imagesGroup.Controls.Add(this.mainCount);
this.imagesGroup.Controls.Add(this.mainUnit);
this.imagesGroup.Controls.Add(this.detailLabel);
this.imagesGroup.Controls.Add(this.detail);
this.imagesGroup.Controls.Add(this.detailCount);
this.imagesGroup.Controls.Add(this.detailUnit);
this.imagesGroup.Controls.Add(this.sku);
this.mainLabel.Name = "mainLabel";
this.mainLabel.Location = new Point(16, 34);
this.mainLabel.TabIndex = 0;
this.mainLabel.AutoSize = true;
this.mainLabel.Text = "商品主图";
this.main.Name = "main";
this.main.Location = new Point(106, 30);
this.main.TabIndex = 1;
this.main.Width = 110;
this.main.DropDownStyle = ComboBoxStyle.DropDownList;
this.main.Items.AddRange(new object[] { "全部", "前几张" });
this.main.SelectedIndexChanged += new System.EventHandler(this.ImageRangeChanged);
this.mainCount.Name = "mainCount";
this.mainCount.Location = new Point(228, 30);
this.mainCount.TabIndex = 2;
this.mainCount.Enabled = false;
this.mainCount.Minimum = 1M;
this.mainCount.Maximum = 999M;
this.mainCount.Value = 1M;
this.mainCount.Width = 60;
this.mainCount.AccessibleName = "商品主图检测张数";
this.mainUnit.Name = "mainUnit";
this.mainUnit.Location = new Point(294, 34);
this.mainUnit.TabIndex = 3;
this.mainUnit.AutoSize = true;
this.mainUnit.Text = "张";
this.detailLabel.Name = "detailLabel";
this.detailLabel.Location = new Point(16, 72);
this.detailLabel.TabIndex = 4;
this.detailLabel.AutoSize = true;
this.detailLabel.Text = "详情图";
this.detail.Name = "detail";
this.detail.Location = new Point(106, 68);
this.detail.TabIndex = 5;
this.detail.Width = 110;
this.detail.DropDownStyle = ComboBoxStyle.DropDownList;
this.detail.Items.AddRange(new object[] { "不检测", "前几张", "全部" });
this.detail.SelectedIndexChanged += new System.EventHandler(this.ImageRangeChanged);
this.detailCount.Name = "detailCount";
this.detailCount.Location = new Point(228, 68);
this.detailCount.TabIndex = 6;
this.detailCount.Enabled = false;
this.detailCount.Minimum = 1M;
this.detailCount.Maximum = 999M;
this.detailCount.Value = 1M;
this.detailCount.Width = 60;
this.detailCount.AccessibleName = "详情图检测张数";
this.detailUnit.Name = "detailUnit";
this.detailUnit.Location = new Point(294, 72);
this.detailUnit.TabIndex = 7;
this.detailUnit.AutoSize = true;
this.detailUnit.Text = "张";
this.sku.Name = "sku";
this.sku.Location = new Point(106, 112);
this.sku.TabIndex = 8;
this.sku.AutoSize = true;
this.sku.Text = "检测 SKU 图片";
this.keywordsGroup.Name = "keywordsGroup";
this.keywordsGroup.Location = new Point(20, 183);
this.keywordsGroup.TabIndex = 1;
this.keywordsGroup.Size = new Size(760, 143);
this.keywordsGroup.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
this.keywordsGroup.Text = "检测关键词";
this.keywordsGroup.Controls.Add(this.keywords);
this.keywordsGroup.Controls.Add(this.keywordsHint);
this.keywords.Name = "keywords";
this.keywords.Location = new Point(16, 27);
this.keywords.TabIndex = 0;
this.keywords.Size = new Size(728, 68);
this.keywords.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
this.keywords.Multiline = true;
this.keywords.AcceptsReturn = true;
this.keywords.ScrollBars = ScrollBars.Vertical;
this.keywords.AccessibleName = "检测关键词";
this.keywordsHint.Name = "keywordsHint";
this.keywordsHint.Location = new Point(16, 105);
this.keywordsHint.TabIndex = 1;
this.keywordsHint.AutoSize = true;
this.keywordsHint.ForeColor = SystemColors.GrayText;
this.keywordsHint.Text = "多个关键词可用逗号、分号、空格或换行分隔。";
this.btnSaveDetection.Name = "btnSaveDetection";
this.btnSaveDetection.Location = new Point(20, 341);
this.btnSaveDetection.TabIndex = 2;
this.btnSaveDetection.Size = new Size(96, 32);
this.btnSaveDetection.Text = "保存条件";
this.btnSaveDetection.BackColor = Color.FromArgb(63, 126, 255);
this.btnSaveDetection.ForeColor = Color.White;
this.btnSaveDetection.FlatStyle = FlatStyle.Flat;
this.btnSaveDetection.UseVisualStyleBackColor = false;
this.btnSaveDetection.Cursor = Cursors.Hand;
this.btnSaveDetection.FlatAppearance.BorderSize = 0;
this.btnSaveDetection.Click += new System.EventHandler(this.SaveDetectionClick);
this.AutoScaleMode = AutoScaleMode.None;
this.AutoScroll = true;
this.AutoScrollMinSize = new Size(365, 390);
this.BackColor = Color.White;
this.ClientSize = new Size(800, 450);
this.Font = new Font("微软雅黑", 9F);
this.Controls.Add(this.imagesGroup);
this.Controls.Add(this.keywordsGroup);
this.Controls.Add(this.btnSaveDetection);
this.Name = "SystemGoodsComplianceForm";
this.Text = "商品 AI 检测";
this.imagesGroup.ResumeLayout(false);
this.imagesGroup.PerformLayout();
this.keywordsGroup.ResumeLayout(false);
this.keywordsGroup.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.mainCount)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.detailCount)).EndInit();
this.ResumeLayout(false);
}
}
}
@@ -0,0 +1,64 @@
using System;
using System.Windows.Forms;
using Work.Services;
using AllBase.Helper;
using TemuKJD.BaseForms;
namespace TemuKJD.KJDForms.SystemForms
{
public partial class SystemGoodsComplianceForm : BaseForm
{
public SystemGoodsComplianceForm()
{
InitializeComponent();
VisibleChanged += (sender, e) => { if (Visible) LoadSettings(); };
LoadSettings();
}
private void LoadSettings()
{
var options = GlobalConfig.GlobalSettings.GoodsCompliance ?? new ComplianceOptions();
main.SelectedIndex = options.MainCount.HasValue ? 1 : 0;
detail.SelectedIndex = options.DetailCount == null ? 2 : options.DetailCount == 0 ? 0 : 1;
mainCount.Value = Math.Min(mainCount.Maximum, Math.Max(1, options.MainCount ?? 1));
detailCount.Value = Math.Min(detailCount.Maximum, Math.Max(1, options.DetailCount ?? 1));
sku.Checked = options.IncludeSku;
keywords.Text = options.Keywords;
}
private void ImageRangeChanged(object sender, EventArgs e)
{
mainCount.Enabled = main.SelectedIndex == 1;
detailCount.Enabled = detail.SelectedIndex == 1;
}
private void SaveDetectionClick(object sender, EventArgs e)
{
if (GoodsComplianceService.Keywords(keywords.Text).Length == 0)
{
MessageBox.Show(this, "请输入检测关键词。");
keywords.Focus();
return;
}
var settings = GlobalConfig.GlobalSettings;
var previous = settings.GoodsCompliance;
settings.GoodsCompliance = new ComplianceOptions
{
MainCount = main.SelectedIndex == 0 ? (int?)null : (int)mainCount.Value,
DetailCount = detail.SelectedIndex == 2 ? (int?)null : detail.SelectedIndex == 0 ? 0 : (int)detailCount.Value,
IncludeSku = sku.Checked,
Keywords = keywords.Text.Trim()
};
try { StartUp.SaveGlobalSettings(); }
catch (Exception ex)
{
settings.GoodsCompliance = previous;
MessageBox.Show(this, "保存检测条件失败:" + ex.Message);
return;
}
MessageBox.Show(this, "已保存 AI 检测条件。");
}
}
}