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;
|
||||
@@ -35,73 +35,75 @@ public sealed class SubmitProductDraftStep : WxProductPublishStepBase
|
||||
protected override Task ExecuteProvider(WXPublishContext context, CancellationToken cancellationToken)
|
||||
{
|
||||
// 直接使用微信回采情趣商品品牌
|
||||
if (BaseClass.UserAuthority.ParseToString().Contains("微信回采") && chkUseWXComplateProd.Checked &&
|
||||
upProdParam.product.info.category.FirstOrDefault()?.name == "成人用品" && upProdParam.product.info.category[1].name != "情趣内衣")
|
||||
if (BaseClass.UserAuthority.ParseToString().Contains("微信回采") && context.Parameters.IsUseWXComplateProd &&
|
||||
context.Parameters.ProductParameter.product.info.category.FirstOrDefault()?.name == "成人用品" && context.Parameters.ProductParameter.product.info.category[1].name != "情趣内衣")
|
||||
{
|
||||
if (DefaultAdultBrandId.ParseToLong() > 0)
|
||||
upProdParam.product.info.brandId = DefaultAdultBrandId.ParseToLong();
|
||||
if (context.Parameters.DefaultAdultBrandId.ParseToLong() > 0)
|
||||
context.Parameters.ProductParameter.product.info.brandId = context.Parameters.DefaultAdultBrandId.ParseToLong();
|
||||
}
|
||||
// 情趣内衣等类目禁止设置运费险
|
||||
//if (upProdParam.product.info.category[1].name == "情趣内衣" ||
|
||||
// upProdParam.product.info.category[1].name == "水果")
|
||||
if (chkFreightInsurance.Checked)
|
||||
if (context.Parameters.IsFreightInsurance)
|
||||
{
|
||||
upProdParam.product.info.extraService.freightInsurance = 1;
|
||||
context.Parameters.ProductParameter.product.info.extraService.freightInsurance = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
upProdParam.product.info.extraService.freightInsurance = 0;
|
||||
context.Parameters.ProductParameter.product.info.extraService.freightInsurance = 0;
|
||||
}
|
||||
// 假1赔3
|
||||
if (upProdParam.product.info.category[0].name == "珠宝首饰" || upProdParam.product.info.category[1].name == "时尚饰品")
|
||||
if (context.Parameters.ProductParameter.product.info.category[0].name == "珠宝首饰" || context.Parameters.ProductParameter.product.info.category[1].name == "时尚饰品")
|
||||
{
|
||||
upProdParam.product.info.extraService.fakeOnePayFour = 1;
|
||||
context.Parameters.ProductParameter.product.info.extraService.fakeOnePayFour = 1;
|
||||
}
|
||||
// 坏损包退 damageGuarantee
|
||||
if (upProdParam.product.info.category[0].name == "生鲜" || upProdParam.product.info.category[0].name == "酒类" ||
|
||||
upProdParam.product.info.category[0].name == "食品饮料" || upProdParam.product.info.category[0].name == "保健食品/膳食营养补充食品" ||
|
||||
(upProdParam.product.info.category[0].name == "农资园艺" && upProdParam.product.info.category[1].name == "花卉绿植"))
|
||||
if (context.Parameters.ProductParameter.product.info.category[0].name == "生鲜" || context.Parameters.ProductParameter.product.info.category[0].name == "酒类" ||
|
||||
context.Parameters.ProductParameter.product.info.category[0].name == "食品饮料" || context.Parameters.ProductParameter.product.info.category[0].name == "保健食品/膳食营养补充食品" ||
|
||||
(context.Parameters.ProductParameter.product.info.category[0].name == "农资园艺" && context.Parameters.ProductParameter.product.info.category[1].name == "花卉绿植"))
|
||||
{
|
||||
upProdParam.product.info.extraService.damageGuarantee = 1;
|
||||
context.Parameters.ProductParameter.product.info.extraService.damageGuarantee = 1;
|
||||
}
|
||||
// 生鲜不支持换货,关闭
|
||||
if (upProdParam.product.info.category[0].name == "生鲜")
|
||||
if (context.Parameters.ProductParameter.product.info.category[0].name == "生鲜")
|
||||
{
|
||||
upProdParam.product.info.extraService.exchangeSupport = 0;
|
||||
context.Parameters.ProductParameter.product.info.extraService.exchangeSupport = 0;
|
||||
}
|
||||
|
||||
if (cell != null)
|
||||
if (context.Progress != null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
cell.Value = "正在提交商品";
|
||||
context.Progress.Report("正在提交商品");
|
||||
}));
|
||||
}
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
|
||||
uploadDraftRst = WXUpload.uploadProductDraft(shop, upProdParam);
|
||||
if (!uploadDraftRst.Contains("\"code\":0") && !uploadDraftRst.Contains("\"success\":true"))
|
||||
context.Parameters.UploadDraftRst = WXUpload.uploadProductDraft(context.Parameters.Shop, context.Parameters.ProductParameter);
|
||||
if (!context.Parameters.UploadDraftRst.Contains("\"code\":0") && !context.Parameters.UploadDraftRst.Contains("\"success\":true"))
|
||||
{
|
||||
var uploadDraftRst = context.Parameters.UploadDraftRst;
|
||||
var error = BaseRegex.GetStringJson(ref uploadDraftRst, "msg");
|
||||
if (string.IsNullOrEmpty(error))
|
||||
{
|
||||
if (uploadDraftRst.Contains("\"errcode\":9401043"))
|
||||
if (context.Parameters.UploadDraftRst.Contains("\"errcode\":9401043"))
|
||||
error = "sku价格异常,请检查加价比例";
|
||||
else
|
||||
error = uploadDraftRst;
|
||||
error = context.Parameters.UploadDraftRst;
|
||||
}
|
||||
var draftId = BaseRegex.GetStringJson(ref uploadDraftRst, "productId").ParseToLong();
|
||||
throw new Exception("草稿保存失败 " + GetHtml.UrlEncodeUtf8(error));
|
||||
}
|
||||
if (cell != null)
|
||||
if (context.Progress != null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
var timeSpan = DateTime.Now - startTime;
|
||||
var timeSpan = DateTime.Now - context.Parameters.StartTime;
|
||||
var duration = timeSpan.TotalSeconds;
|
||||
cell.Value = "商品已保存草稿,正在提交上架" + " " + duration.ParseToInt() + "秒";
|
||||
context.Progress.Report("商品已保存草稿,正在提交上架" + " " + duration.ParseToInt() + "秒");
|
||||
}));
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user