gx
This commit is contained in:
1 parent
0a3e5af6a9
commit
c2dcedd238
59 files changed
+2053
-1274
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using AllBase;
|
||||
using AllBase.Extension;
|
||||
using NaiBa.Util.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Config;
|
||||
using AllBase.Model.DBModel;
|
||||
@@ -20,7 +21,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Work;
|
||||
|
||||
namespace Store.Product.Publish.Steps.Wx;
|
||||
@@ -34,14 +34,14 @@ public sealed class FillMainImagesStep : WxProductPublishStepBase
|
||||
|
||||
protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
mainImgCount = (prodInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt();
|
||||
if (mainImgCount > 0 && mainImgCount < 3)
|
||||
context.Parameters.MainImgCount = (context.Parameters.ProdInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt();
|
||||
if (context.Parameters.MainImgCount > 0 && context.Parameters.MainImgCount < 3)
|
||||
{
|
||||
var gallery1 = prodInfo?.detail?.galleries?.Where(g => g.type == 2).FirstOrDefault();
|
||||
var gallery1 = context.Parameters.ProdInfo?.detail?.galleries?.Where(g => g.type == 2).FirstOrDefault();
|
||||
// 先补一张
|
||||
if (gallery1 != null)
|
||||
{
|
||||
prodInfo.detail.galleries.Add(new gallery_item()
|
||||
context.Parameters.ProdInfo.detail.galleries.Add(new gallery_item()
|
||||
{
|
||||
type = 1,
|
||||
url = gallery1.url,
|
||||
@@ -50,12 +50,12 @@ public sealed class FillMainImagesStep : WxProductPublishStepBase
|
||||
});
|
||||
}
|
||||
// 如果补了只有两张再补一张
|
||||
if (mainImgCount == 1 && (prodInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt() > 1)
|
||||
if (context.Parameters.MainImgCount == 1 && (context.Parameters.ProdInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt() > 1)
|
||||
{
|
||||
var gallery2 = prodInfo?.detail?.galleries?[1];
|
||||
var gallery2 = context.Parameters.ProdInfo?.detail?.galleries?[1];
|
||||
if (gallery2 != null)
|
||||
{
|
||||
prodInfo.detail.galleries.Add(new gallery_item()
|
||||
context.Parameters.ProdInfo.detail.galleries.Add(new gallery_item()
|
||||
{
|
||||
type = 1,
|
||||
url = gallery2.url,
|
||||
@@ -65,13 +65,14 @@ public sealed class FillMainImagesStep : WxProductPublishStepBase
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((prodInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt() < 3)
|
||||
if ((context.Parameters.ProdInfo?.detail?.galleries?.Where(g => g.type == 1).Count()).ParseToInt() < 3)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "主图数量少于三张";
|
||||
context.Progress.Report("主图数量少于三张");
|
||||
}));
|
||||
throw new Exception("主图数量少于三张");
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user