gx
This commit is contained in:
1 parent
0a3e5af6a9
commit
c2dcedd238
59 files changed
+2053
-1274
No files matched your search
@@ -1,77 +1,21 @@
|
||||
using AllBase;
|
||||
using AllBase.Extension;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Config;
|
||||
using AllBase.Model.DBModel;
|
||||
using AllBase.Model.Param.WXParam;
|
||||
using AllBase.Model.Result;
|
||||
using AllBase.Model.Result.PDDResult;
|
||||
using AllBase.Model.Result.WXResult;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Store.Product.Models.PublishParameters.Wx;
|
||||
using Store.Product.Publish;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
using System;
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// 由 WXDBProdUploadForm.UploadProduct 的“上传商品视频”区段迁移。
|
||||
/// TODO(迁移): 原区段中的 TEMUKJD/WXUpload/窗体服务引用需按 Store.Product 运行时适配逐项核对。
|
||||
/// 商品视频上传步骤。原实现依赖 TEMUKJD 视频上传服务,迁移到独立 DLL 前明确终止。
|
||||
/// </summary>
|
||||
public sealed class UploadVideoStep : WxProductPublishStepBase
|
||||
{
|
||||
public override string Description => "上传商品视频";
|
||||
|
||||
protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken)
|
||||
protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
if (prodInfo.detail.galleries.Any(a => a.type == 6))
|
||||
{
|
||||
List<gallery_item> videos = prodInfo.detail.galleries.Where(a => a.type == 6).ToList();
|
||||
//下载视频保存
|
||||
foreach (var item in videos)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "开始下载视频";
|
||||
}));
|
||||
byte[] files;
|
||||
bool d_ret = GetHtml.DownloadFile(item.url, out files);
|
||||
if (d_ret == false)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "视频下载失败";
|
||||
}));
|
||||
throw new Exception("视频下载失败");
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "开始上传视频";
|
||||
}));
|
||||
var uploader = new WXVideoUploader();
|
||||
var video = uploader.Upload(shop, selectProd.id.ToString(), files);
|
||||
upProdParam.product.info.headVideoInfo.Add(new
|
||||
{
|
||||
videoUrl = video.DownloadUrl,
|
||||
videoHeadImg = video.VideoImgUrl,
|
||||
videoLen = video.VideoDuration,
|
||||
videoSize = 0,
|
||||
videoSource = 0,
|
||||
videoFormat = 0,
|
||||
playableVideoUrl = video.DownloadUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
//prodInfo.detail.galleries.RemoveAll(g => g.type == 6); // 视频暂时移除,以后再视情况加上
|
||||
if (context.Parameters.ProdInfo?.detail?.galleries?.Any(a => a.type == 6) == true)
|
||||
throw new NotSupportedException("商品视频上传服务尚未迁移到 Store.Product。");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user