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