This commit is contained in:
chfei committed 2026-09-15 16:08:14 +08:00
1 parent 085f275620
commit 256a0c24f9
11 files changed
+198 -147

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Framework.Enums;
/// <summary>
/// 商铺状态
/// </summary>
public enum ShopStatus
{
}
+44
View File
@@ -0,0 +1,44 @@
using Store.Framework.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Framework.Inerterfaces;
public interface IShop
{
/// <summary>
/// 商铺Id
/// </summary>
public string ShopId { get; set; }
/// <summary>
/// 商铺名
/// </summary>
public string ShopName { get; set; }
/// <summary>
/// 登录密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// Cookie信息
/// </summary>
public Cookies Cookie { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 商铺提示信息
/// </summary>
public string Msg { get; set; }
/// <summary>
/// 是否登录成功
/// </summary>
public bool IsLoggedIn { get; set; }
}
+36 -39
View File
@@ -1,4 +1,5 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Store.Framework.Inerterfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -7,48 +8,44 @@ using System.Threading.Tasks;
namespace Store.Framework.Models namespace Store.Framework.Models
{ {
/// <summary> /// <summary>
/// 商铺信息 /// 商铺信息
/// </summary> /// </summary>
public abstract class ShopBase public abstract class ShopBase : IShop
{ {
[JsonProperty("id")] public int Id { get; set; }
public string Id { get; set; } /// <summary>
/// 商铺Id
/// </summary>
public string ShopId { get; set; }
/// <summary>
/// 商铺名
/// </summary>
public string ShopName { get; set; }
/// <summary>
/// 登录密码
/// </summary>
[JsonProperty("shop_account")] public string Password { get; set; }
public string Name { get; set; }
[JsonProperty("login_pass")] /// <summary>
public string Password { get; set; } /// Cookie信息
/// </summary>
public Cookies Cookie { get; set; }
/// <summary> /// <summary>
/// Cookie信息 /// 分组名称
/// </summary> /// </summary>
[JsonProperty("cookie")] public string GroupName { get; set; }
public Cookies Cookie { get; set; }
/// <summary> /// <summary>
/// 分组名称 /// 商铺提示信息
/// </summary> /// </summary>
[JsonProperty("group_name")] public string Msg { get; set; }
public string GroupName { get; set; } /// <summary>
/// 是否登录成功
/// </summary>
public bool IsLoggedIn { get; set; }
/// <summary> }
/// 商铺提示信息
/// </summary>
[JsonProperty("login_status")]
public string Msg { get; set; }
}
/// <summary>
/// 商铺信息
/// </summary>
/// <typeparam name="TStatus">状态码</typeparam>
public abstract class ShopBase<TStatus> : ShopBase
{
/// <summary>
/// 状态
/// </summary>
public TStatus Status { get; set; }
}
} }
+1 -1
View File
@@ -107,7 +107,7 @@ namespace Store.Client.Services
foreach (Match match in matches) foreach (Match match in matches)
{ {
string key = match.Groups["key"].Value; string key = match.Groups["key"].Value;
Shop shop = shops.FirstOrDefault(s => s.Id == key || s.Name == key); Shop shop = shops.FirstOrDefault(s => s.Id == key || s.ShopName == key);
if (shop == null) if (shop == null)
continue; continue;
+4 -3
View File
@@ -1,4 +1,5 @@
using Store.Framework.Models; using Store.Framework.Inerterfaces;
using Store.Framework.Models;
using Store.Product.Models.Product; using Store.Product.Models.Product;
using Store.Product.Models.PublishParameters; using Store.Product.Models.PublishParameters;
using Store.Product.Models.PublishParameters.Wx; using Store.Product.Models.PublishParameters.Wx;
@@ -19,7 +20,7 @@ public class PublishContextBase
/// <summary> /// <summary>
/// 商铺 /// 商铺
/// </summary> /// </summary>
public Shop Shop { get; set; } public IShop Shop { get; set; }
/// <summary> /// <summary>
/// 商铺名称 /// 商铺名称
/// </summary> /// </summary>
@@ -31,7 +32,7 @@ public class PublishContextBase
{ {
return ""; return "";
} }
return Shop.Name; return Shop.ShopName;
} }
} }
@@ -7,6 +7,7 @@ using Newtonsoft.Json.Linq;
using Store.Product.Models.PublishParameters; using Store.Product.Models.PublishParameters;
using Store.Product.Models.PublishParameters.Wx; using Store.Product.Models.PublishParameters.Wx;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -227,7 +228,7 @@ public class WXPublishParameters: PublishParameters
/// <summary> /// <summary>
/// 待裂变标题文本,使用换行分隔。 /// 待裂变标题文本,使用换行分隔。
/// </summary> /// </summary>
public string FissionTitles { get; set; } = ""; public Queue<string> FissionTitles { get; set; } = new Queue<string>();
/// <summary> /// <summary>
/// 是否删除标题开头的特殊字符。 /// 是否删除标题开头的特殊字符。
/// </summary> /// </summary>
@@ -38,17 +38,13 @@ public sealed class FissionTitleStep : WxProductPublishStepBase
} }
protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken) protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken)
{ {
var titles = context.Parameters.FissionTitles.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); if (context.Parameters.FissionTitles.Count == 0)
if (titles.Count == 0)
{ {
throw new Exception("裂变标题数量不足,将暂停上传"); throw new Exception("裂变标题数量不足,将暂停上传");
} }
context.Product.Title = titles[0]; context.Product.Title = context.Parameters.FissionTitles.Dequeue();
context.Parameters.IsFissionTitle = true; context.Parameters.IsFissionTitle = true;
titles.RemoveAt(0);
context.Parameters.FissionTitles = string.Join("\r\n", titles);
context.Progress.Report("标题裂变成功,更改为:" + context.Product.Title); context.Progress.Report("标题裂变成功,更改为:" + context.Product.Title);
return Task.CompletedTask; return Task.CompletedTask;
} }
} }
@@ -25,8 +25,7 @@ using Work;
namespace Store.Product.Publish.Steps.Wx; namespace Store.Product.Publish.Steps.Wx;
/// <summary> /// <summary>
/// 由 WXDBProdUploadForm.UploadProduct 的“初始化上传参数与店铺登录校验”区段迁移。 /// 初始化上传参数与店铺登录校验
/// TODO(迁移): 原区段中的 TEMUKJD/WXUpload/窗体服务引用需按 Store.Product 运行时适配逐项核对。
/// </summary> /// </summary>
public sealed class InitializeUploadProductStep : WxProductPublishStepBase public sealed class InitializeUploadProductStep : WxProductPublishStepBase
{ {
@@ -34,7 +33,7 @@ public sealed class InitializeUploadProductStep : WxProductPublishStepBase
protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken) protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken)
{ {
if (context.Parameters.Shop == null || string.IsNullOrEmpty(context.Parameters.Shop.ShopId) || context.Parameters.Shop.LoginStatus != "登录成功") if (context.ShopName == null || string.IsNullOrEmpty(context.Shop.ShopId) || context.Shop.IsLoggedIn == false)
{ {
throw new Exception("店铺为空或未登录!"); throw new Exception("店铺为空或未登录!");
} }
-1
View File
@@ -65,7 +65,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AllBase\AllBase.csproj" /> <ProjectReference Include="..\AllBase\AllBase.csproj" />
<ProjectReference Include="..\Store.Product\Store.Product.csproj" />
<ProjectReference Include="..\Work\Work.csproj" /> <ProjectReference Include="..\Work\Work.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -36,8 +36,8 @@ using TemuKJD.UserControls;
using TemuKJD.WXForms.ShopForms; using TemuKJD.WXForms.ShopForms;
using Work; using Work;
using Work.BLL.Tools; using Work.BLL.Tools;
using Store.Product.Models.PublishParameters; //using Store.Product.Models.PublishParameters;
using Store.Product.Publish.Steps; //using Store.Product.Publish.Steps;
using Work.Services; using Work.Services;
using static System.Net.Mime.MediaTypeNames; using static System.Net.Mime.MediaTypeNames;
@@ -52,7 +52,7 @@ namespace TemuKJD.WXForms.ProductForms
public CancellationTokenSource cancellationTokenSource { get; set; } = null; public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public bool IsWxNotUseSoftwareDefaultAddressOnce { get; set; } = false; public bool IsWxNotUseSoftwareDefaultAddressOnce { get; set; } = false;
public WXPublishParameters PublishParameters { get; set; } = new WXPublishParameters(); //public WXPublishParameters PublishParameters { get; set; } = new WXPublishParameters();
ConcurrentList<AddPriceRule> lstAddPriceRule = new ConcurrentList<AddPriceRule>(); ConcurrentList<AddPriceRule> lstAddPriceRule = new ConcurrentList<AddPriceRule>();
@@ -1064,97 +1064,97 @@ namespace TemuKJD.WXForms.ProductForms
void AddProductArr(List<string> shopIdLst) void AddProductArr(List<string> shopIdLst)
{ {
PublishParameters = new WXPublishParameters //PublishParameters = new WXPublishParameters
{ //{
// 复用基类已有参数。 // // 复用基类已有参数。
TitlePrefix = txtTitleHeadWord.Text.Trim(), // TitlePrefix = txtTitleHeadWord.Text.Trim(),
StorageType = chkUpDraft.Checked ? ProductStorage.InStock : ProductStorage.OnSale, // StorageType = chkUpDraft.Checked ? ProductStorage.InStock : ProductStorage.OnSale,
IsFilterPrice = new SwitchParams<Tuple<int, int>>( // IsFilterPrice = new SwitchParams<Tuple<int, int>>(
!string.IsNullOrWhiteSpace(txtMinPrice.Text) || !string.IsNullOrWhiteSpace(txtMaxPrice.Text), // !string.IsNullOrWhiteSpace(txtMinPrice.Text) || !string.IsNullOrWhiteSpace(txtMaxPrice.Text),
new Tuple<int, int>( // new Tuple<int, int>(
string.IsNullOrWhiteSpace(txtMinPrice.Text) ? 0 : txtMinPrice.Text.Trim().ParseToInt(), // string.IsNullOrWhiteSpace(txtMinPrice.Text) ? 0 : txtMinPrice.Text.Trim().ParseToInt(),
string.IsNullOrWhiteSpace(txtMaxPrice.Text) ? int.MaxValue : txtMaxPrice.Text.Trim().ParseToInt())), // string.IsNullOrWhiteSpace(txtMaxPrice.Text) ? int.MaxValue : txtMaxPrice.Text.Trim().ParseToInt())),
IsFilterCustomTitleKeywors = chkSkipReplaceText.Checked, // IsFilterCustomTitleKeywors = chkSkipReplaceText.Checked,
IsRemoveCustomTitleKeywors = !chkSkipReplaceText.Checked && !string.IsNullOrWhiteSpace(txtReplaceText.Text), // IsRemoveCustomTitleKeywors = !chkSkipReplaceText.Checked && !string.IsNullOrWhiteSpace(txtReplaceText.Text),
// 原 WXUploadRule 对应参数。 // // 原 WXUploadRule 对应参数。
PreSaleDays = txtPreDays.Text.Trim().ParseToInt(), // PreSaleDays = txtPreDays.Text.Trim().ParseToInt(),
FilterWords = txtReplaceText.Text.Trim(), // FilterWords = txtReplaceText.Text.Trim(),
IsSkipHasFilterWordsProd = chkSkipReplaceText.Checked, // IsSkipHasFilterWordsProd = chkSkipReplaceText.Checked,
SkuMinPrice = string.IsNullOrWhiteSpace(txtMinPrice.Text) ? 0 : txtMinPrice.Text.Trim().ParseToInt(), // SkuMinPrice = string.IsNullOrWhiteSpace(txtMinPrice.Text) ? 0 : txtMinPrice.Text.Trim().ParseToInt(),
SkuMaxPrice = string.IsNullOrWhiteSpace(txtMaxPrice.Text) ? int.MaxValue : txtMaxPrice.Text.Trim().ParseToInt(), // SkuMaxPrice = string.IsNullOrWhiteSpace(txtMaxPrice.Text) ? int.MaxValue : txtMaxPrice.Text.Trim().ParseToInt(),
WaitSeconds = txtWaitSeconds.Text.Trim().ParseToInt(), // WaitSeconds = txtWaitSeconds.Text.Trim().ParseToInt(),
OnlyHighestPriceSku = chkHighestPriceSku.Checked, // OnlyHighestPriceSku = chkHighestPriceSku.Checked,
OnlyLowestPriceSku = chkLowestPriceSku.Checked, // OnlyLowestPriceSku = chkLowestPriceSku.Checked,
SameSpecSamePriceUp = chkSameSpecPriceUp.Checked, // SameSpecSamePriceUp = chkSameSpecPriceUp.Checked,
SameSpecSamePriceDown = chkSameSpecPriceDown.Checked, // SameSpecSamePriceDown = chkSameSpecPriceDown.Checked,
SkipUploaded = chkSkipUploaded.Checked, // SkipUploaded = chkSkipUploaded.Checked,
SkipExisting = chkSkipUploaded.Checked, // SkipExisting = chkSkipUploaded.Checked,
UpDraft = chkUpDraft.Checked, // UpDraft = chkUpDraft.Checked,
IsPreSale = chkPreSale.Checked, // IsPreSale = chkPreSale.Checked,
TitleHeadWords = txtTitleHeadWord.Text.Trim(), // TitleHeadWords = txtTitleHeadWord.Text.Trim(),
IsSaveBound = chkSaveBound.Checked, // IsSaveBound = chkSaveBound.Checked,
FilterBoundMinSave = txtFilterBoundMin.Text.Trim().ParseToInt(), // FilterBoundMinSave = txtFilterBoundMin.Text.Trim().ParseToInt(),
FilterBoundMaxSave = txtFilterBoundMax.Text.Trim().ParseToInt(), // FilterBoundMaxSave = txtFilterBoundMax.Text.Trim().ParseToInt(),
IsAiShortTitle = chkAiShortTitle.Checked, // IsAiShortTitle = chkAiShortTitle.Checked,
IsUseWXComplateProd = chkUseWXComplateProd.Checked, // IsUseWXComplateProd = chkUseWXComplateProd.Checked,
IsUseShanghaiReturnOrderAddress = chkUseShanghaiReturnOrderAddress.Checked, // IsUseShanghaiReturnOrderAddress = chkUseShanghaiReturnOrderAddress.Checked,
// UploadProduct 内直接读取的窗体参数。 // // UploadProduct 内直接读取的窗体参数。
IsFissionTitle = chkFissionGoodsName.Checked, // IsFissionTitle = chkFissionGoodsName.Checked,
FissionTitles = txtFissionTitle.Text, // FissionTitles = txtFissionTitle.Text,
IsRemoveSpecialChar = chkRemoveSpecialChar.Checked, // IsRemoveSpecialChar = chkRemoveSpecialChar.Checked,
IsCommissionUpload = chkCommission.Checked, // IsCommissionUpload = chkCommission.Checked,
IsCommissionIncrease = cmbCommissionAddOrReduce.Text == "增加", // IsCommissionIncrease = cmbCommissionAddOrReduce.Text == "增加",
CommissionMinPercent = txtMinUpCommission.Text.Trim().ParseToInt(), // CommissionMinPercent = txtMinUpCommission.Text.Trim().ParseToInt(),
CommissionMaxPercent = txtMaxUpCommission.Text.Trim().ParseToInt(), // CommissionMaxPercent = txtMaxUpCommission.Text.Trim().ParseToInt(),
CommissionChangePercent = txtCommissionChangeValue.Text.Trim().ParseToInt(), // CommissionChangePercent = txtCommissionChangeValue.Text.Trim().ParseToInt(),
IsUseRecommendation = chkUseRecommand.Checked, // IsUseRecommendation = chkUseRecommand.Checked,
IsImageRandomBlock = chkImgRandomBlock.Checked, // IsImageRandomBlock = chkImgRandomBlock.Checked,
IsRandomMainImageOrder = chkRandomMainImgOrder.Checked, // IsRandomMainImageOrder = chkRandomMainImgOrder.Checked,
IsRandomDetailImageOrder = chkRandomDetailImgOrder.Checked, // IsRandomDetailImageOrder = chkRandomDetailImgOrder.Checked,
IsFissionRandomPriceChange = chkFissionRandomPriceChange.Checked, // IsFissionRandomPriceChange = chkFissionRandomPriceChange.Checked,
FissionRandomPriceChangeValue = txtFissionRandomPriceChange.Text.Trim().ParseToDecimal(), // FissionRandomPriceChangeValue = txtFissionRandomPriceChange.Text.Trim().ParseToDecimal(),
SpecialBrandName = cmbSpBrandName.Text.Trim(), // SpecialBrandName = cmbSpBrandName.Text.Trim(),
IsAiImage = chkAiImage.Checked, // IsAiImage = chkAiImage.Checked,
AiImageCount = txtAiImgCount.Text.Trim().ParseToInt(), // AiImageCount = txtAiImgCount.Text.Trim().ParseToInt(),
IsDefaultBestBefore = chkDefaultBestBefore.Checked, // IsDefaultBestBefore = chkDefaultBestBefore.Checked,
DefaultBestBeforeDays = txtDefaultBestBefore.Text.Trim().ParseToInt(), // DefaultBestBeforeDays = txtDefaultBestBefore.Text.Trim().ParseToInt(),
IsRandomImageBorder = chkRandomImgBorder.Checked, // IsRandomImageBorder = chkRandomImgBorder.Checked,
MainBorderImageCount = txtMainBorderImgCount.Text.Trim().ParseToInt(), // MainBorderImageCount = txtMainBorderImgCount.Text.Trim().ParseToInt(),
DetailBorderImageCount = txtDetailBorderImgCount.Text.Trim().ParseToInt(), // DetailBorderImageCount = txtDetailBorderImgCount.Text.Trim().ParseToInt(),
IsFreightInsurance = chkFreightInsurance.Checked, // IsFreightInsurance = chkFreightInsurance.Checked,
IsTestNoAuditUpload = chkTestNoAuditUpload.Checked, // IsTestNoAuditUpload = chkTestNoAuditUpload.Checked,
IsCheckSubmitSuccess = chkIsSubmitSuccess.Checked, // IsCheckSubmitSuccess = chkIsSubmitSuccess.Checked,
UseSoftwareDefaultAddress = GlobalConfig.GlobalSettings.IsWxUseSoftwareDefaultAddress, // UseSoftwareDefaultAddress = GlobalConfig.GlobalSettings.IsWxUseSoftwareDefaultAddress,
IgnoreSoftwareDefaultAddressOnce = IsWxNotUseSoftwareDefaultAddressOnce, // IgnoreSoftwareDefaultAddressOnce = IsWxNotUseSoftwareDefaultAddressOnce,
// 加价规则与商品价格/SKU/图片参数一起迁移。 // // 加价规则与商品价格/SKU/图片参数一起迁移。
DefaultAddPriceRule = new WXAddPriceRule // DefaultAddPriceRule = new WXAddPriceRule
{ // {
MoreThanPrice = defaultAddPriceRule.MoreThanPrice, // MoreThanPrice = defaultAddPriceRule.MoreThanPrice,
LessThanPrice = defaultAddPriceRule.LessThanPrice, // LessThanPrice = defaultAddPriceRule.LessThanPrice,
AddPriceTimes = defaultAddPriceRule.AddPriceTimes, // AddPriceTimes = defaultAddPriceRule.AddPriceTimes,
AddMorePrice = defaultAddPriceRule.AddMorePrice, // AddMorePrice = defaultAddPriceRule.AddMorePrice,
SinglePriceAdd = defaultAddPriceRule.SinglePriceAdd, // SinglePriceAdd = defaultAddPriceRule.SinglePriceAdd,
AddMorePriceFirst = defaultAddPriceRule.AddMorePriceFirst, // AddMorePriceFirst = defaultAddPriceRule.AddMorePriceFirst,
StockNum = defaultAddPriceRule.StockNum, // StockNum = defaultAddPriceRule.StockNum,
IsStepAddPrice = defaultAddPriceRule.IsStepAddPrice, // IsStepAddPrice = defaultAddPriceRule.IsStepAddPrice,
ShippingPriceTimes = defaultAddPriceRule.ShippingPriceTimes // ShippingPriceTimes = defaultAddPriceRule.ShippingPriceTimes
}, // },
AddPriceRules = lstAddPriceRule.Select(rule => new WXAddPriceRule // AddPriceRules = lstAddPriceRule.Select(rule => new WXAddPriceRule
{ // {
MoreThanPrice = rule.MoreThanPrice, // MoreThanPrice = rule.MoreThanPrice,
LessThanPrice = rule.LessThanPrice, // LessThanPrice = rule.LessThanPrice,
AddPriceTimes = rule.AddPriceTimes, // AddPriceTimes = rule.AddPriceTimes,
AddMorePrice = rule.AddMorePrice, // AddMorePrice = rule.AddMorePrice,
SinglePriceAdd = rule.SinglePriceAdd, // SinglePriceAdd = rule.SinglePriceAdd,
AddMorePriceFirst = rule.AddMorePriceFirst, // AddMorePriceFirst = rule.AddMorePriceFirst,
StockNum = rule.StockNum, // StockNum = rule.StockNum,
IsStepAddPrice = rule.IsStepAddPrice, // IsStepAddPrice = rule.IsStepAddPrice,
ShippingPriceTimes = rule.ShippingPriceTimes // ShippingPriceTimes = rule.ShippingPriceTimes
}).ToList() // }).ToList()
}; //};
Invoke(new Action(() => Invoke(new Action(() =>
{ {
@@ -1327,7 +1327,6 @@ namespace TemuKJD.WXForms.ProductForms
{ {
this.pbLoading.Visible = false; this.pbLoading.Visible = false;
})); }));
GlobalConfig.ShopLoginList
Task.Run(() => Task.Run(() =>
{ {
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
+1 -1
View File
@@ -112,7 +112,7 @@ public class Tests
{ {
Shop = new Shop Shop = new Shop
{ {
Name = "乐乐人小店", ShopName = "乐乐人小店",
Cookie = new Cookies("biz_token=b_000001a0_80071145_44612ea2_a87897a5_12c2c339; biz_ticket=; biz_magic=09bcc3e825c8826c562d62ca3442e35e8eb4ce13b73e4097661f11c9bd90f46e; biz_rand=CAESIO762C8Iu/hxVBpyNsXZiqDGlOsa5U3WBKBd3PvU0p6d; device_id=7b7080668b28f2aadba6d7f208ca35833c4ce75fe4c107eca6a5e5785fccc8ad") Cookie = new Cookies("biz_token=b_000001a0_80071145_44612ea2_a87897a5_12c2c339; biz_ticket=; biz_magic=09bcc3e825c8826c562d62ca3442e35e8eb4ce13b73e4097661f11c9bd90f46e; biz_rand=CAESIO762C8Iu/hxVBpyNsXZiqDGlOsa5U3WBKBd3PvU0p6d; device_id=7b7080668b28f2aadba6d7f208ca35833c4ce75fe4c107eca6a5e5785fccc8ad")
}, },
Product = new WxProductUploadProduct { Title = "原商品标题" }, Product = new WxProductUploadProduct { Title = "原商品标题" },