Merge branch 'master' of http://git.ts.e57.cn/chfei/KJD
This commit is contained in:
commit
881a317720
30 files changed
+4381
-161
No files matched your search
@@ -44,6 +44,9 @@
|
||||
<Compile Update="InitForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="KJDForms\SystemForms\SystemViolationDetectionForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="PDDForms\AdminForms\RandomComProductForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
+5
-2
@@ -29,8 +29,9 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("解除限制");
|
||||
System.Windows.Forms.TreeNode violationNode = new System.Windows.Forms.TreeNode("违规检测");
|
||||
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("系统设置", new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1});
|
||||
treeNode1, violationNode});
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
@@ -103,6 +104,8 @@
|
||||
this.tv.Name = "tv";
|
||||
treeNode1.Name = "解除限制";
|
||||
treeNode1.Text = "解除限制";
|
||||
violationNode.Name = "违规检测";
|
||||
violationNode.Text = "违规检测";
|
||||
treeNode2.Name = "系统设置";
|
||||
treeNode2.Text = "系统设置";
|
||||
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
@@ -162,4 +165,4 @@
|
||||
private UserComponent.UcTreeView tv;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace TemuKJD.KJDForms.SystemForms
|
||||
public partial class SystemForm : BaseForm
|
||||
{
|
||||
public Lazy<SystemRemoveRestrictionsForm> systemRemoveRestrictionsForm = new Lazy<SystemRemoveRestrictionsForm>();
|
||||
public Lazy<SystemViolationDetectionForm> systemViolationDetectionForm = new Lazy<SystemViolationDetectionForm>();
|
||||
public SystemForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -46,6 +47,9 @@ namespace TemuKJD.KJDForms.SystemForms
|
||||
case "解除限制":
|
||||
SetForm(systemRemoveRestrictionsForm.Value);
|
||||
break;
|
||||
case "违规检测":
|
||||
SetForm(systemViolationDetectionForm.Value);
|
||||
break;
|
||||
//case "商品管理":
|
||||
// SetForm(shopProductForm.Value);
|
||||
// break;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
namespace TemuKJD.KJDForms.SystemForms
|
||||
{
|
||||
partial class SystemViolationDetectionForm
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && components != null)
|
||||
components.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.chkAutoReport = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.chkAutoExcludeOnUpload = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.chkAutoDelist = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.SuspendLayout();
|
||||
// chkAutoReport
|
||||
this.chkAutoReport.AutoSize = true;
|
||||
this.chkAutoReport.Location = new System.Drawing.Point(24, 24);
|
||||
this.chkAutoReport.Name = "chkAutoReport";
|
||||
this.chkAutoReport.TabIndex = 0;
|
||||
this.chkAutoReport.Text = "自动上报违规商品";
|
||||
this.chkAutoReport.UseVisualStyleBackColor = true;
|
||||
// chkAutoExcludeOnUpload
|
||||
this.chkAutoExcludeOnUpload.AutoSize = true;
|
||||
this.chkAutoExcludeOnUpload.Location = new System.Drawing.Point(24, 64);
|
||||
this.chkAutoExcludeOnUpload.Name = "chkAutoExcludeOnUpload";
|
||||
this.chkAutoExcludeOnUpload.TabIndex = 1;
|
||||
this.chkAutoExcludeOnUpload.Text = "上货自动剔除违规商品";
|
||||
this.chkAutoExcludeOnUpload.UseVisualStyleBackColor = true;
|
||||
// chkAutoDelist
|
||||
this.chkAutoDelist.AutoSize = true;
|
||||
this.chkAutoDelist.Location = new System.Drawing.Point(24, 104);
|
||||
this.chkAutoDelist.Name = "chkAutoDelist";
|
||||
this.chkAutoDelist.TabIndex = 2;
|
||||
this.chkAutoDelist.Text = "自动下架违规商品";
|
||||
this.chkAutoDelist.UseVisualStyleBackColor = true;
|
||||
// SystemViolationDetectionForm
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.AutoScroll = true;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.chkAutoReport);
|
||||
this.Controls.Add(this.chkAutoExcludeOnUpload);
|
||||
this.Controls.Add(this.chkAutoDelist);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.Name = "SystemViolationDetectionForm";
|
||||
this.Text = "违规检测";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
private UserComponent.UcCheckBox chkAutoReport;
|
||||
private UserComponent.UcCheckBox chkAutoExcludeOnUpload;
|
||||
private UserComponent.UcCheckBox chkAutoDelist;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using AllBase.Helper;
|
||||
using TemuKJD.BaseForms;
|
||||
|
||||
namespace TemuKJD.KJDForms.SystemForms
|
||||
{
|
||||
public partial class SystemViolationDetectionForm : BaseForm
|
||||
{
|
||||
public SystemViolationDetectionForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var settings = GlobalConfig.GlobalSettings;
|
||||
chkAutoReport.Checked = settings.AutoReportViolationProducts;
|
||||
chkAutoExcludeOnUpload.Checked = settings.AutoExcludeViolationProductsOnUpload;
|
||||
chkAutoDelist.Checked = settings.AutoDelistViolationProducts;
|
||||
|
||||
chkAutoReport.CheckedChanged += Settings_CheckedChanged;
|
||||
chkAutoExcludeOnUpload.CheckedChanged += Settings_CheckedChanged;
|
||||
chkAutoDelist.CheckedChanged += Settings_CheckedChanged;
|
||||
}
|
||||
|
||||
private void Settings_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
var settings = GlobalConfig.GlobalSettings;
|
||||
settings.AutoReportViolationProducts = chkAutoReport.Checked;
|
||||
settings.AutoExcludeViolationProductsOnUpload = chkAutoExcludeOnUpload.Checked;
|
||||
settings.AutoDelistViolationProducts = chkAutoDelist.Checked;
|
||||
StartUp.SaveGlobalSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,168 +12,177 @@ using System.Threading.Tasks;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.WXForms.ProductForms;
|
||||
using Work;
|
||||
using Work.Services;
|
||||
|
||||
namespace TemuKJD.PDDForms.ProductForms
|
||||
{
|
||||
// 微信店铺违规商品抓取
|
||||
public class WXProdViolationManage
|
||||
{
|
||||
public void GetShopProdViolation()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (!Directory.Exists("wxProdViolation"))
|
||||
Directory.CreateDirectory("wxProdViolation");
|
||||
// 微信店铺违规商品抓取
|
||||
public class WXProdViolationManage
|
||||
{
|
||||
public void GetShopProdViolation()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (!Directory.Exists("wxProdViolation"))
|
||||
Directory.CreateDirectory("wxProdViolation");
|
||||
|
||||
while (true)
|
||||
{
|
||||
//break;
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
continue;
|
||||
while (true)
|
||||
{
|
||||
//break;
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
continue;
|
||||
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
// 开启自动下架时,后台检测当前店铺在售商品并下架违规商品。
|
||||
if (GlobalConfig.GlobalSettings.AutoDelistViolationProducts)
|
||||
CloudGoodsService.CheckAndOffShelfViolations(shop);
|
||||
|
||||
WXProdViolationGetInfo info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
|
||||
try
|
||||
{
|
||||
info = NaiBa.Util.Helper.ConfigHelper.LoadConfig<WXProdViolationGetInfo>("wxProdViolation\\" + shop.ShopId);
|
||||
if (info == null)
|
||||
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.MinValue.ToString("yyMMdd") };
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
|
||||
if (info.updateDay == DateTime.Now.ToString("yyMMdd"))
|
||||
{
|
||||
// 今日同步过,跳过,暂时关闭改为每次打开立即读取
|
||||
//continue;
|
||||
}
|
||||
WXProdViolationGetInfo info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
|
||||
try
|
||||
{
|
||||
info = NaiBa.Util.Helper.ConfigHelper.LoadConfig<WXProdViolationGetInfo>("wxProdViolation\\" + shop.ShopId);
|
||||
if (info == null)
|
||||
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.MinValue.ToString("yyMMdd") };
|
||||
|
||||
info.failReason = "";
|
||||
if (info.updateDay == DateTime.Now.ToString("yyMMdd"))
|
||||
{
|
||||
// 今日同步过,跳过,暂时关闭改为每次打开立即读取
|
||||
//continue;
|
||||
}
|
||||
|
||||
var result = getShopiolationProd(shop);
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
if (!result.Contains("\"code\":0"))
|
||||
{
|
||||
WXForms.ShopForms.WXShopListForm.CheckShopLogin(shop);
|
||||
info.failReason = "";
|
||||
|
||||
info.failReason = "读取失败";
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
|
||||
continue;
|
||||
}
|
||||
var result = getShopiolationProd(shop);
|
||||
// 开启自动上报时,后台解析店铺处罚记录并上报违规商品。
|
||||
if (GlobalConfig.GlobalSettings.AutoReportViolationProducts)
|
||||
CloudGoodsService.ReportViolationsFromJson(result, shop);
|
||||
|
||||
JObject recordObj = JsonHelper.JObjectParse(result)["record"] as JObject;
|
||||
JArray jArr = JsonHelper.JObjectParse(result)["record"]["items"] as JArray;
|
||||
if (recordObj != null && jArr == null)
|
||||
{
|
||||
jArr = new JArray();
|
||||
}
|
||||
foreach(var jObj in jArr)
|
||||
{
|
||||
string sVioInfo = JsonHelper.SerializeObject(jObj);
|
||||
var punishUuid = BaseRegex.GetStringJson(ref sVioInfo, "punishUuid");
|
||||
var punishReason = BaseRegex.GetStringJson(ref sVioInfo, "punishReason");
|
||||
var punishTime = BaseClass.StampToDateTime(BaseRegex.GetIntJson(ref sVioInfo, "punishTime"));
|
||||
var productId = BaseRegex.GetStringJson(ref sVioInfo, "productId");
|
||||
var productDesc = BaseRegex.GetStringJson(ref sVioInfo, "productDesc");
|
||||
//相似同款低质商品 不当使用他人权利
|
||||
if (!punishReason.Contains("发布违禁信息") && !punishReason.Contains("材质夸大宣传") && !punishReason.Contains("相似同款低质商品") &&
|
||||
!punishReason.Contains("价格违规") && !punishReason.Contains("售假") && !punishReason.Contains("品牌资质问题") &&
|
||||
!punishReason.Contains("不当使用他人权利") && !punishReason.Contains("用户反馈虚假宣传"))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(productDesc) && !string.IsNullOrWhiteSpace(productId))
|
||||
{
|
||||
var url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&wx_safe_status=违规商品";
|
||||
data += "¬es=" + GetHtml.UrlEncodeUtf8(("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason + "-" + punishTime.ToString("yy/MM/dd HH:mm")).Trim());
|
||||
data += "&product_name=" + productDesc;
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
info.failReason = "更新商品状态失败";
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
if (!result.Contains("\"code\":0"))
|
||||
{
|
||||
WXForms.ShopForms.WXShopListForm.CheckShopLogin(shop);
|
||||
|
||||
if(html.Contains("商品不存在"))
|
||||
{
|
||||
var getProdRst = WXUpload.searchProductWithTitle(shop, GetHtml.UrlEncodeUtf8(productDesc));
|
||||
var spuCode = BaseRegex.GetStringJson(ref getProdRst, "spuCode");
|
||||
var secrec_spu_id = "";
|
||||
var spu_id = "";
|
||||
if (string.IsNullOrEmpty(spuCode) || spuCode.Length < 10)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (spuCode.StartsWith("EC1") && spuCode.EndsWith("A"))
|
||||
{
|
||||
spu_id = spuCode.Substring(3, spuCode.Length - 4);
|
||||
}
|
||||
else if (spuCode.StartsWith("P1-"))
|
||||
{
|
||||
spu_id = spuCode.Substring(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
secrec_spu_id = spuCode;
|
||||
}
|
||||
info.failReason = "读取失败";
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
|
||||
continue;
|
||||
}
|
||||
|
||||
url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
|
||||
data = UserLogin.GetSignaturex();
|
||||
data += "&wx_safe_status=违规商品";
|
||||
data += "¬es=" + ("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason).Trim();
|
||||
data += "&secret_spu_id=" + secrec_spu_id;
|
||||
data += "&spu_id=" + spu_id;
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
info.failReason = "更新商品状态失败";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JObject recordObj = JsonHelper.JObjectParse(result)["record"] as JObject;
|
||||
JArray jArr = JsonHelper.JObjectParse(result)["record"]["items"] as JArray;
|
||||
if (recordObj != null && jArr == null)
|
||||
{
|
||||
jArr = new JArray();
|
||||
}
|
||||
foreach (var jObj in jArr)
|
||||
{
|
||||
string sVioInfo = JsonHelper.SerializeObject(jObj);
|
||||
var punishUuid = BaseRegex.GetStringJson(ref sVioInfo, "punishUuid");
|
||||
var punishReason = BaseRegex.GetStringJson(ref sVioInfo, "punishReason");
|
||||
var punishTime = BaseClass.StampToDateTime(BaseRegex.GetIntJson(ref sVioInfo, "punishTime"));
|
||||
var productId = BaseRegex.GetStringJson(ref sVioInfo, "productId");
|
||||
var productDesc = BaseRegex.GetStringJson(ref sVioInfo, "productDesc");
|
||||
//相似同款低质商品 不当使用他人权利
|
||||
if (!punishReason.Contains("发布违禁信息") && !punishReason.Contains("材质夸大宣传") && !punishReason.Contains("相似同款低质商品") &&
|
||||
!punishReason.Contains("价格违规") && !punishReason.Contains("售假") && !punishReason.Contains("品牌资质问题") &&
|
||||
!punishReason.Contains("不当使用他人权利") && !punishReason.Contains("用户反馈虚假宣传"))
|
||||
continue;
|
||||
if (!string.IsNullOrWhiteSpace(productDesc) && !string.IsNullOrWhiteSpace(productId))
|
||||
{
|
||||
var url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&wx_safe_status=违规商品";
|
||||
data += "¬es=" + GetHtml.UrlEncodeUtf8(("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason + "-" + punishTime.ToString("yy/MM/dd HH:mm")).Trim());
|
||||
data += "&product_name=" + productDesc;
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
info.failReason = "更新商品状态失败";
|
||||
break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.failReason))
|
||||
info.updateDay = DateTime.Now.ToString("yyMMdd");
|
||||
if (html.Contains("商品不存在"))
|
||||
{
|
||||
var getProdRst = WXUpload.searchProductWithTitle(shop, GetHtml.UrlEncodeUtf8(productDesc));
|
||||
var spuCode = BaseRegex.GetStringJson(ref getProdRst, "spuCode");
|
||||
var secrec_spu_id = "";
|
||||
var spu_id = "";
|
||||
if (string.IsNullOrEmpty(spuCode) || spuCode.Length < 10)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (spuCode.StartsWith("EC1") && spuCode.EndsWith("A"))
|
||||
{
|
||||
spu_id = spuCode.Substring(3, spuCode.Length - 4);
|
||||
}
|
||||
else if (spuCode.StartsWith("P1-"))
|
||||
{
|
||||
spu_id = spuCode.Substring(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
secrec_spu_id = spuCode;
|
||||
}
|
||||
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (info == null)
|
||||
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
|
||||
info.failReason = ex.Message;
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
// 休眠两个小时
|
||||
Thread.Sleep(1000 * 60 * 60 * 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
|
||||
data = UserLogin.GetSignaturex();
|
||||
data += "&wx_safe_status=违规商品";
|
||||
data += "¬es=" + ("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason).Trim();
|
||||
data += "&secret_spu_id=" + secrec_spu_id;
|
||||
data += "&spu_id=" + spu_id;
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
info.failReason = "更新商品状态失败";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string getShopiolationProd(ShopLoginInfo shop)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeviolationsec/violation/cgi/get?token=&lang=zh_CN&violationType=finder&shopId=";
|
||||
string referer = "https://store.weixin.qq.com/shop/violation/home";
|
||||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(info.failReason))
|
||||
info.updateDay = DateTime.Now.ToString("yyMMdd");
|
||||
|
||||
public class WXProdViolationGetInfo
|
||||
{
|
||||
public string shopId { get; set; }
|
||||
public string updateDay { get; set; } // yyMMdd
|
||||
public string failReason { get; set; } // "", "掉线"...
|
||||
}
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (info == null)
|
||||
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
|
||||
info.failReason = ex.Message;
|
||||
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
// 休眠两个小时
|
||||
Thread.Sleep(1000 * 60 * 60 * 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static string getShopiolationProd(ShopLoginInfo shop)
|
||||
{
|
||||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeviolationsec/violation/cgi/get?token=&lang=zh_CN&violationType=finder&shopId=";
|
||||
string referer = "https://store.weixin.qq.com/shop/violation/home";
|
||||
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class WXProdViolationGetInfo
|
||||
{
|
||||
public string shopId { get; set; }
|
||||
public string updateDay { get; set; } // yyMMdd
|
||||
public string failReason { get; set; } // "", "掉线"...
|
||||
}
|
||||
}
|
||||
@@ -675,7 +675,7 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
|
||||
item.Cells["colSelect"].Value = wxUploadRule.SelectedShopIds.Contains(shopId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
isInit = true;
|
||||
}
|
||||
@@ -1715,6 +1715,32 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}));
|
||||
}
|
||||
|
||||
// 开启上货自动剔除时,上传前检测违规状态;仅服务端明确返回违规时禁止上传。
|
||||
if (GlobalConfig.GlobalSettings.AutoExcludeViolationProductsOnUpload)
|
||||
{
|
||||
Invoke(new Action(() => cell.Value = "商品违规检测..."));
|
||||
try
|
||||
{
|
||||
long goodsId = 0;
|
||||
if ((!long.TryParse(dbProd.spu_id, out goodsId) || goodsId <= 0) &&
|
||||
(!long.TryParse(dbProd.skc_id, out goodsId) || goodsId <= 0))
|
||||
throw new Exception("商品ID无效");
|
||||
|
||||
var statuses = CloudGoodsService.GetViolationStatus(new List<long> { goodsId });
|
||||
var status = statuses.FirstOrDefault(item => item.GoodsId == goodsId);
|
||||
if (status == null)
|
||||
throw new Exception("未返回当前商品的违规状态");
|
||||
if (status.IsViolation)
|
||||
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"当前商品违规,禁止上传\"}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("商品违规检测失败,继续上传:" + ex.Message);
|
||||
if (cell != null)
|
||||
Invoke(new Action(() => cell.Value = "商品违规检测失败,继续上传"));
|
||||
}
|
||||
}
|
||||
|
||||
#region 裂变标题
|
||||
if (BaseClass.UserAuthority.Contains("裂变调试") && chkFissionGoodsName.Checked)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user