增加违规记录页面
This commit is contained in:
1 parent
25d5b5d61c
commit
6252901a94
8 files changed
+884
-18
No files matched your search
@@ -1718,7 +1718,8 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
// 开启上货自动剔除时,上传前检测违规状态;仅服务端明确返回违规时禁止上传。
|
||||
if (GlobalConfig.GlobalSettings.AutoExcludeViolationProductsOnUpload)
|
||||
{
|
||||
Invoke(new Action(() => cell.Value = "商品违规检测..."));
|
||||
if (cell != null)
|
||||
Invoke(new Action(() => cell.Value = "商品违规检测..."));
|
||||
try
|
||||
{
|
||||
long goodsId = 0;
|
||||
@@ -1731,7 +1732,21 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
if (status == null)
|
||||
throw new Exception("未返回当前商品的违规状态");
|
||||
if (status.IsViolation)
|
||||
{
|
||||
var shopId = shop.ShopId;
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await CloudGoodsService.RecordShopActionLogs(shopId, status, ViolationLogAction.AutoListingExcluded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine("剔除违规商品日志记录失败:" + ex.Message);
|
||||
}
|
||||
});
|
||||
return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"当前商品违规,禁止上传\"}";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -6329,6 +6344,37 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片宽高均达到指定尺寸时返回 true;尺寸不足或无效输入返回 false。
|
||||
/// </summary>
|
||||
public bool IsBase64ImageSizeValid(string base64Image, int width, int height)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(base64Image) || width <= 0 || height <= 0)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
using (var stream = new MemoryStream(Convert.FromBase64String(base64Image)))
|
||||
using (var image = System.Drawing.Image.FromStream(stream))
|
||||
{
|
||||
return image.Width >= width && image.Height >= height;
|
||||
}
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
catch (OutOfMemoryException)
|
||||
{
|
||||
// GDI+ 对不支持或损坏的图片也可能抛出此异常。
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public string UploadImg(ShopLoginInfo shop, string img_url, DataGridViewCell cell = null, bool randomBlock = false)
|
||||
{
|
||||
string getImgError;
|
||||
|
||||
Reference in new issue
Block a user