限时限量购功能
This commit is contained in:
1 parent
0210b76c45
commit
5fa6a7e2c1
12 files changed
+2195
-7
No files matched your search
@@ -187,7 +187,11 @@
|
||||
<Compile Include="Model\Param\DyProductManage\ViolateParam.cs" />
|
||||
<Compile Include="Model\Param\DyProductManage\QualificationConfig.cs" />
|
||||
<Compile Include="Model\Param\DyProductManage\ViolateRuleParam.cs" />
|
||||
<Compile Include="Model\Param\PDDCouponParam\PDDActivityMarketingParam.cs" />
|
||||
<Compile Include="Model\Param\PDDCouponParam\PDDCouponParam.cs" />
|
||||
<Compile Include="Model\Result\PDDResult\PDDCouponResult\PDDActivityToolGoodsListInfo.cs" />
|
||||
<Compile Include="Model\Result\PDDResult\PDDCouponResult\PDDActivityToolSkuDiscountListInfo.cs" />
|
||||
<Compile Include="Model\Result\PDDResult\PDDCouponResult\PDDActivityToolGoodsSkuListInfo.cs" />
|
||||
<Compile Include="Model\Result\PDDResult\PDDCouponResult\PDDCouponGoodsListInfo.cs" />
|
||||
<Compile Include="Model\Param\PDDProdParam\PDDActivityPriceCheckParam.cs" />
|
||||
<Compile Include="Model\Param\PDDProdParam\PDDActivitySubmitParam.cs" />
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 637;
|
||||
public static int VersionCount = 638;
|
||||
//public static int VersionCount = 613;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Param.PDDCouponParam
|
||||
{
|
||||
public class PDDActivityMarketingParam
|
||||
{
|
||||
public int? call_source { get; set; }
|
||||
public List<batch_stage_activity_info> batch_stage_activities { get; set; }
|
||||
public bool? default_channel { get; set; } = true;
|
||||
}
|
||||
|
||||
public class batch_stage_activity_info
|
||||
{
|
||||
public List<stage_activity_info> stage_activities { get; set; }
|
||||
}
|
||||
|
||||
public class stage_activity_info
|
||||
{
|
||||
public bool? goods_unified_activity { get; set; } // true,
|
||||
public string activity_name { get; set; } // "限量促销1",
|
||||
public int? activity_type { get; set; } // 3,
|
||||
public bool? check_low_price { get; set; } // true,
|
||||
public long? goods_id { get; set; } // 820143666861,
|
||||
public string tool_full_channel { get; set; } // "10921_77271__normal",
|
||||
public string channel_recognize_code { get; set; } // "b21rZ2V5aGwtNDkyMzc5NjkzLTE3NjA5Mzk3NDE0MTY=",
|
||||
public bool? auto_create_after_finished { get; set; } = false; // false,
|
||||
public marketing_tool_detail_option_info marketing_tool_detail_option { get; set; } = new marketing_tool_detail_option_info();
|
||||
public List<activity_sku_price> price_list { get; set; }
|
||||
public int? pattern { get; set; }
|
||||
public long? start_time { get; set; } // 1760889600,
|
||||
public long? end_time { get; set; } // 1761494399
|
||||
}
|
||||
public class activity_sku_price
|
||||
{
|
||||
public int? user_activity_limit { get; set; } // 0
|
||||
public List<sku_price_dto> sku_price_dtos { get; set; }
|
||||
public int? quantity { get; set; } // 1782
|
||||
}
|
||||
|
||||
public class sku_price_dto
|
||||
{
|
||||
public long? sku_id { get; set; } // 1788445374246
|
||||
public int? activity_price { get; set; } // 6612
|
||||
}
|
||||
|
||||
public class marketing_tool_detail_option_info
|
||||
{
|
||||
public bool? price_insurance { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Result.PDDResult.PDDCouponResult
|
||||
{
|
||||
public class PDDActivityToolGoodsListInfo
|
||||
{
|
||||
public int? total { get; set; } = 1;
|
||||
public int? remaining_create_num { get; set; } = 1;
|
||||
public List<PDDActivityGoodsInfo> goods_list { get; set; } = new List<PDDActivityGoodsInfo>();
|
||||
}
|
||||
|
||||
public class PDDActivityGoodsInfo
|
||||
{
|
||||
public long? goods_id { get; set; } // 820141079905,
|
||||
public string goods_name { get; set; } // "Simwood简木男装2021秋季新款纯棉衬衣休闲百搭牛津纺长袖衬衫男",
|
||||
public int? quantity { get; set; } // 594,
|
||||
public string image_url { get; set; } // "",
|
||||
public int? cat_id { get; set; } // 423,
|
||||
public int? cat_id1{ get; set; } // 239,
|
||||
public int? cat_id2{ get; set; } // 245,
|
||||
public int? cat_id3{ get; set; } // 423,
|
||||
public int? cat_id4 { get; set; } // 0,
|
||||
public List<int?> sku_group_price { get; set; } // [ 40660, 42260 ],
|
||||
public string hd_thumb_url { get; set; } // "https://img.pddpic.com/gaudit-image/2025-09-17/fb8dc75ffcf88199a244aca6add28e1b.jpeg",
|
||||
public string thumb_url { get; set; } // "https://img.pddpic.com/gaudit-image/2025-09-17/3d4669220263f41cb69c2903f9ade36e.jpeg",
|
||||
public bool? new_goods { get; set; } // false,
|
||||
public List<new_flow_equity_option_vo_info> new_flow_equity_option_volist {get;set;}
|
||||
public bool? valid { get; set; } // true
|
||||
public bool? optional { get; set; } // true
|
||||
|
||||
// 自定义参数
|
||||
public string shopId { get; set; }
|
||||
public string shopName { get; set; }
|
||||
}
|
||||
public class new_flow_equity_option_vo_info
|
||||
{
|
||||
public int? type { get; set; } // 5
|
||||
public bool? selected { get; set; } // true
|
||||
}
|
||||
|
||||
public class PDDCreateActivityToolResult
|
||||
{
|
||||
public List<PDDCreateActivityToolFailInfo> fail_list { get; set; }
|
||||
public List<long?> success_goods_id_list { get; set; }
|
||||
}
|
||||
|
||||
public class PDDCreateActivityToolFailInfo
|
||||
{
|
||||
public long goods_id { get; set; } // 820156693761,
|
||||
public string goods_name { get; set; } // "Simwood简木男装2021秋季新款纯棉衬衣休闲百搭牛津纺长袖衬衫男",
|
||||
public string mage_url { get; set; } // "https://img.pddpic.com/gaudit-image/2025-09-17/61a216c8e22bf14a313b04a97172ff54.jpeg",
|
||||
public string fail_reason { get; set; } // "规格Id:1787512685498,规格 折后价不符合规则; 规格Id:1787512685497,规格 折后价不符合规则; 规格Id:1787512685496,价格过高,未达门槛; 规格Id:1787512685495,价格过高,未达门槛; ",
|
||||
public long? error_code { get; set; } // 1000000,
|
||||
public List<object> low_price_promotion_info_volist { get; set; } // [ ]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Result.PDDResult.PDDCouponResult
|
||||
{
|
||||
public class PDDActivityToolGoodsSkuListInfo
|
||||
{
|
||||
public long? goods_id { get; set; }
|
||||
public List<valid_sku_vo_info> valid_sku_volist { get; set; }
|
||||
public List<valid_sku_vo_info> in_valid_sku_volist { get; set; }
|
||||
}
|
||||
|
||||
public class valid_sku_vo_info
|
||||
{
|
||||
public long? goods_id { get; set; } // 820277345858,
|
||||
public long? sku_id { get; set; } // 1787597162211,
|
||||
public string sku_name { get; set; } // "均码;丝绒裤子",
|
||||
public int? quantity { get; set; } // 99,
|
||||
public string thumb_url { get; set; } // "https://t00img.yangkeduo.com/openapi/images/2021-01-06/66404c25d56ad46d9bfb3d060c154f7f.jpeg",
|
||||
public int? sku_group_price { get; set; } // 18963,
|
||||
public int? valid_status { get; set; } // 0,
|
||||
public string invalid_reason { get; set; } // "规格 有效"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Model.Result.PDDResult.PDDCouponResult
|
||||
{
|
||||
public class PDDActivityToolSkuDiscountListInfo
|
||||
{
|
||||
public List<marketing_tool_discount> marketing_tool_discounts { get; set; }
|
||||
public int? batch_max_discount { get; set; } // 874,
|
||||
public int? batch_max_discount_tenth { get; set; } // 87,
|
||||
public int? batch_min_discount { get; set; } // 100,
|
||||
public int? batch_min_discount_tenth { get; set; } // 10,
|
||||
public int? batch_max_reduced_amount { get; set; } // 6840,
|
||||
public int? batch_min_reduced_amount { get; set; } // 17067,
|
||||
public int? batch_max_activity_price { get; set; } // 6660,
|
||||
public int? batch_min_activity_price { get; set; } // 2036
|
||||
|
||||
}
|
||||
|
||||
public class marketing_tool_discount
|
||||
{
|
||||
public long? goods_id { get; set; } // 820277345858,
|
||||
public int? discount { get; set; } // 960,
|
||||
public int? discount_tenth { get; set; } // 96,
|
||||
public int? min_discount { get; set; } // 100,
|
||||
public int? min_discount_tenth { get; set; } // 10,
|
||||
public int? suggest_discount { get; set; } // 949,
|
||||
public int? suggest_discount_tenth { get; set; } // 94,
|
||||
public int? max_activity_price { get; set; } // 18215,
|
||||
public int? min_activity_price { get; set; } // 2036,
|
||||
public int? suggest_activity_price { get; set; } // 18014,
|
||||
public int? max_reduced_amount { get; set; } // 17067,
|
||||
public int? min_reduced_amount { get; set; } // 748,
|
||||
public int? suggest_reduced_amount { get; set; } // 1019,
|
||||
public int? min_quantity { get; set; } // 1,
|
||||
public int? max_quantity { get; set; } // 2147483647,
|
||||
public List<backward_stage_activity_suggested_info_> backward_stage_activity_suggested_info { get; set; }
|
||||
public List<sku_discount_info> sku_discounts { get; set; }
|
||||
public List<goods_new_flow_equity_option_vo_info> goods_new_flow_equity_option_volist { get; set; }
|
||||
public List<goods_wide_new_flow_equity_option_vo_info> goods_wide_new_flow_equity_option_volist { get; set; }
|
||||
}
|
||||
|
||||
public class goods_new_flow_equity_option_vo_info
|
||||
{
|
||||
public int? type { get; set; } // 5
|
||||
public bool? selected { get; set; } // true
|
||||
}
|
||||
|
||||
public class goods_wide_new_flow_equity_option_vo_info
|
||||
{
|
||||
public int? type { get; set; } // 5
|
||||
public bool? selected { get; set; } // true
|
||||
}
|
||||
|
||||
public class sku_discount_info
|
||||
{
|
||||
public long? sku_id { get; set; } // 1787597162211,
|
||||
public int? discount { get; set; } // 960,
|
||||
/// <summary>
|
||||
/// 折扣后最高值 96代表9.6折
|
||||
/// </summary>
|
||||
public int? discount_tenth { get; set; } // 96,
|
||||
public int? min_discount { get; set; } // 100,
|
||||
/// <summary>
|
||||
/// 折扣后最低值 10代表1折
|
||||
/// </summary>
|
||||
public int? min_discount_tenth { get; set; } // 10,
|
||||
public int? min_discounted_price { get; set; } // 1896,
|
||||
public int? max_discounted_price { get; set; } // 18215,
|
||||
public int? suggested_activity_price { get; set; } // 18014,
|
||||
public int? suggested_activity_discount { get; set; } // 949,
|
||||
public int? suggested_activity_discount_tenth { get; set; } // 94,
|
||||
/// <summary>
|
||||
/// 最少降价金额
|
||||
/// </summary>
|
||||
public int? min_reduced_amount { get; set; } // 748,
|
||||
/// <summary>
|
||||
/// 最多降价金额
|
||||
/// </summary>
|
||||
public int? max_reduced_amount { get; set; } // 17067,
|
||||
public int? suggested_reduced_amount { get; set; } // 949,
|
||||
|
||||
public List<backward_stage_activity_suggested_info_> backward_stage_activity_suggested_info { get; set; }
|
||||
}
|
||||
|
||||
public class backward_stage_activity_suggested_info_
|
||||
{
|
||||
public int? activity_price { get; set; } // 18014,
|
||||
public int? activity_discount { get; set; } // 949,
|
||||
public int? activity_discount_tenth { get; set; } // 94,
|
||||
public int? reduced_amount { get; set; } // 1019
|
||||
|
||||
}
|
||||
}
|
||||
@@ -465,6 +465,12 @@
|
||||
<Compile Include="PDDForms\ProductForms\CouponForms\PDDProdCouponShangPinLiJianForm.Designer.cs">
|
||||
<DependentUpon>PDDProdCouponShangPinLiJianForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PDDForms\ProductForms\CouponForms\PDDProdActivityToolXianShiXianLiangForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PDDForms\ProductForms\CouponForms\PDDProdActivityToolXianShiXianLiangForm.Designer.cs">
|
||||
<DependentUpon>PDDProdActivityToolXianShiXianLiangForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PDDForms\ProductForms\PDDProductForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -960,6 +966,9 @@
|
||||
<EmbeddedResource Include="PDDForms\ProductForms\CouponForms\PDDProdCouponShangPinLiJianForm.resx">
|
||||
<DependentUpon>PDDProdCouponShangPinLiJianForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PDDForms\ProductForms\CouponForms\PDDProdActivityToolXianShiXianLiangForm.resx">
|
||||
<DependentUpon>PDDProdActivityToolXianShiXianLiangForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PDDForms\ProductForms\PDDProductForm.resx">
|
||||
<DependentUpon>PDDProductForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Generated
+1015
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,721 @@
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.Param.PDDCouponParam;
|
||||
using AllBase.Model.Result;
|
||||
using AllBase.Model.Result.PDDResult.PDDCouponResult;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BaseForms;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.Extension;
|
||||
using TemuKJD.PDDForms.ShopForms;
|
||||
using TemuKJD.ToolForms;
|
||||
|
||||
namespace TemuKJD.PDDForms.ProductForms.CouponForms
|
||||
{
|
||||
public partial class PDDProdActivityToolXianShiXianLiangForm : BaseForm
|
||||
{
|
||||
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
|
||||
|
||||
bool isInit = false;
|
||||
Dictionary<ShopLoginInfo, int> dicShopGetCount = new Dictionary<ShopLoginInfo, int>();
|
||||
PDDActivityToolGoodsListInfo pddActivityToolGoods = new PDDActivityToolGoodsListInfo();
|
||||
|
||||
public PDDProdActivityToolXianShiXianLiangForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void PDDProdActivityToolXianShiXianLiangForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
//this.dtpCoupon1StartTime.MinDate = DateTime.Now.Date.AddDays(1).AddHours(19);
|
||||
|
||||
this.dgvShop.AddSelectorColumn("colSelect");
|
||||
this.dgvProduct.AddSelectorColumn("colCheck");
|
||||
dgvProduct.AddImgColumn("colImg", "colImgUrl");
|
||||
}
|
||||
|
||||
private void PDDProdActivityToolXianShiXianLiangForm_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible == true)
|
||||
{
|
||||
RefreshShop();
|
||||
isInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRefreshShop_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshShop();
|
||||
}
|
||||
private void RefreshShop()
|
||||
{
|
||||
// 店铺Id
|
||||
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
// 获取被删除的店铺
|
||||
List<DataGridViewRow> dgvRowList = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
|
||||
=> !GlobalConfig.ShopLoginList.Any(s => s.ShopId == row.Cells["colShopId"]?.Value?.ToString())).ToList();
|
||||
// 更新被删除的店铺列表
|
||||
foreach (var row in dgvRowList)
|
||||
{
|
||||
dgvShop.Rows.Remove(row);
|
||||
}
|
||||
// 绑定其他店铺(含新导入的店铺)
|
||||
foreach (ShopLoginInfo shopEntity in GlobalConfig.ShopLoginList)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(shopEntity.ShopId))
|
||||
BindShop(shopEntity, selectIds);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindShop(ShopLoginInfo shopEntity, List<string> selectShopId = null)
|
||||
{
|
||||
if (shopEntity == null)
|
||||
return;
|
||||
if (selectShopId == null)
|
||||
selectShopId = new List<string>();
|
||||
|
||||
bool canUse = shopEntity.LoginStatus == "登录成功";
|
||||
//canUse = true; // 内部库不需要校验登录状态
|
||||
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId);
|
||||
if (row == null)
|
||||
{
|
||||
this.dgvShop.Rows.Add(
|
||||
!isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse),
|
||||
shopEntity.LoginName,
|
||||
shopEntity.ShopId,
|
||||
shopEntity.ShopAccount,
|
||||
shopEntity.Notes,
|
||||
"选择商品",
|
||||
canUse ? "在线" : "掉线",
|
||||
canUse,
|
||||
shopEntity.AddProductRemaining,
|
||||
string.Empty
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.Cells["colSelect"].Value = !isInit || (selectShopId.Contains(shopEntity.ShopId) && canUse);
|
||||
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
|
||||
row.Cells["colShopName"].Value = shopEntity.ShopAccount;
|
||||
row.Cells["colShopNotes"].Value = shopEntity.Notes;
|
||||
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
|
||||
row.Cells["colLoginStatus"].Style.ForeColor = canUse ? Color.Green : Color.Red;
|
||||
row.Cells["colCanUse"].Value = canUse;
|
||||
row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining;
|
||||
}
|
||||
}
|
||||
|
||||
private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText;
|
||||
string columnName = dgvShop.Columns[e.ColumnIndex].Name;
|
||||
string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString();
|
||||
string shopAccount = dgvShop.Rows[e.RowIndex].Cells["colShopName"].Value.ToString();
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId.ToString());
|
||||
var row = dgvShop.Rows[e.RowIndex];
|
||||
switch (columnName)
|
||||
{
|
||||
case "colSelect":
|
||||
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
|
||||
break;
|
||||
case "colLoginStatus":
|
||||
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
PDDShopLoginForm shopLoginForm = new PDDShopLoginForm(shop);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.login;
|
||||
shopLoginForm.ShowDialog();
|
||||
RefreshShop();
|
||||
}
|
||||
else
|
||||
{
|
||||
shopLoginForm.openType = EnumOpenType.manage;
|
||||
shopLoginForm.WindowState = FormWindowState.Maximized;
|
||||
shopLoginForm.Show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//3 限量促销 12 限时促销
|
||||
public string get_xianshixianliang_goods(ShopLoginInfo shop, long startTime, long endTime, int query_activity_type = 3, int page = 1, int pageSize = 20)
|
||||
{
|
||||
var anti = shop.AntiContents.LastOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
string url = "https://mms.pinduoduo.com/libra-backend/mms/activity/marketing/goods/search";
|
||||
string body = "{\"page_no\":" + page + ",\"page_size\":" + pageSize + ",\"is_valid\":true,\"only_new_goods\":false,\"query_activity_type\":" +
|
||||
query_activity_type + "}";
|
||||
|
||||
string refere = "https://mms.pinduoduo.com/tool/promotion/create?tool_full_channel=10921_77271";
|
||||
|
||||
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
|
||||
{
|
||||
shop.AntiContents.Remove(anti);
|
||||
anti = shop.AntiContents.FirstOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public string get_xianshixianliang_goods_skus(ShopLoginInfo shop, List<long> goodsIdLst, long startTime, long endTime, int page = 1, int pageSize = 20)
|
||||
{
|
||||
var anti = shop.AntiContents.LastOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
string url = "https://mms.pinduoduo.com/libra-backend/mms/activity/marketing/batch/sku/search";
|
||||
string body = @"{""search_marketing_tool_sku_request_list"":[";
|
||||
foreach (var goodsId in goodsIdLst)
|
||||
{
|
||||
body += "{\"goods_id\":" + goodsId + "},";
|
||||
}
|
||||
body = body.TrimEnd(',');
|
||||
body += "]}";
|
||||
|
||||
|
||||
string refere = "https://mms.pinduoduo.com/tool/promotion/create?tool_full_channel=10921_77271";
|
||||
|
||||
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
|
||||
{
|
||||
shop.AntiContents.Remove(anti);
|
||||
anti = shop.AntiContents.FirstOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public string create_xianshixianliang_goods(ShopLoginInfo shop, PDDActivityMarketingParam activityParam)
|
||||
{
|
||||
var anti = shop.AntiContents.LastOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
string url = "https://mms.pinduoduo.com/libra-backend/mms/activity/marketing/stage/batchCreate";
|
||||
string body = JsonHelper.SerializeObject(activityParam);
|
||||
|
||||
string refere = "https://mms.pinduoduo.com/tool/promotion/create?tool_full_channel=10921_77271";
|
||||
|
||||
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
for (int i = 0; i < 5 && (result.Contains("网络繁忙,请不要频繁操作") || result.Contains("您的店铺操作过于频繁,请稍后操作")); i++)
|
||||
{
|
||||
shop.AntiContents.Remove(anti);
|
||||
anti = shop.AntiContents.FirstOrDefault().ParseToString();
|
||||
if (shop.AntiContents.Count > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
|
||||
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void btnCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>()
|
||||
.Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true && row.Cells["colLoginStatus"]?.Value.ParseToString() == "在线")
|
||||
.Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
|
||||
if (lstShopId.Count == 0)
|
||||
{
|
||||
BaseMsgForm.ShowInfo("请选择登录的店铺!");
|
||||
return;
|
||||
}
|
||||
pddActivityToolGoods.goods_list.Clear();
|
||||
pddActivityToolGoods.remaining_create_num = 1;
|
||||
pddActivityToolGoods.total = 1;
|
||||
|
||||
dgvProduct.Rows.Clear();
|
||||
|
||||
var dgvRows = this.dgvShop.Rows.Cast<DataGridViewRow>();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString()));
|
||||
foreach (var row in dgvRows)
|
||||
{
|
||||
row.Cells["colMessage"].Value = "";
|
||||
}
|
||||
|
||||
|
||||
if (PDDShopLoginForm.shopLoginInstance != null && PDDShopLoginForm.shopLoginInstance.IsDisposed != true)
|
||||
PDDShopLoginForm.shopLoginInstance.Dispose();
|
||||
ucGroupBoxEx2.Enabled = false;
|
||||
cancellationTokenSource = new CancellationTokenSource();
|
||||
Task.Run(() =>
|
||||
{
|
||||
var lstShopIdTemp = new List<string>();
|
||||
lstShopIdTemp.AddRange(lstShopId);
|
||||
int i = 0;
|
||||
|
||||
foreach (var shopId in lstShopIdTemp)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
this.statusBar.lblTaskStatus.Text = "正在查询...";
|
||||
this.statusBar.pgbTaskProgress.Maximum = lstShopIdTemp.Count;
|
||||
this.statusBar.UpdateProgressBar(i + 1);
|
||||
i++;
|
||||
}));
|
||||
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
|
||||
if (shop == null)
|
||||
continue;
|
||||
|
||||
#region 检测登录
|
||||
if (shop.LoginStatus == "登录成功")
|
||||
{
|
||||
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
}
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colMessage"].Value = "店铺掉线";
|
||||
row.Cells["colLoginStatus"].Value = "掉线";
|
||||
row.Cells["colCanUse"].Value = false;
|
||||
}
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colMessage"].Value = "正在查询";
|
||||
}
|
||||
}));
|
||||
|
||||
int page = 0;
|
||||
int pageSize = 20; // 优惠券最大20
|
||||
int totalPage = 1;
|
||||
bool isError = false;
|
||||
string errMsg = "";
|
||||
while (page < totalPage)
|
||||
{
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
page++;
|
||||
|
||||
int tryCount = 0;
|
||||
tryAgain:
|
||||
|
||||
GetToken(shop);
|
||||
|
||||
if (page > 1)
|
||||
Thread.Sleep(Randomx.GetId(3000, 7000));
|
||||
|
||||
long startStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value);
|
||||
long endStamp = BaseClass.DateTimeToTimestampSeconds(dtpCoupon1StartTime.Value.Date.AddDays(numCoupon1KeepDays.Value.ParseToInt())) - 1;
|
||||
string jsonStr = get_xianshixianliang_goods(shop, startStamp, endStamp, chkQuantity.Checked ? 3 : 12, page, pageSize);
|
||||
jsonStr = GetHtml.Unicode2String(jsonStr);
|
||||
if (jsonStr.Contains("繁忙") && tryCount < 5)
|
||||
{
|
||||
tryCount++;
|
||||
Thread.Sleep(Randomx.GetId(5000, 10000));
|
||||
goto tryAgain;
|
||||
}
|
||||
if (!jsonStr.Contains("\"success\":true"))
|
||||
{
|
||||
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
break;
|
||||
|
||||
isError = true;
|
||||
string sErr = BaseRegex.GetStringJson(ref jsonStr, "error_msg");
|
||||
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
|
||||
errMsg += sErr + " ";
|
||||
page++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (jsonStr.Contains("\"success\":true"))
|
||||
{
|
||||
PDDActivityToolGoodsListInfo pddActivityToolGoodsTmp = new PDDActivityToolGoodsListInfo();
|
||||
try
|
||||
{
|
||||
var jObj = JObject.Parse(jsonStr);
|
||||
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
|
||||
pddActivityToolGoodsTmp = JsonHelper.DeserializeJsonToObject<PDDActivityToolGoodsListInfo>(rstStr);
|
||||
this.pddActivityToolGoods.remaining_create_num = pddActivityToolGoodsTmp.remaining_create_num;
|
||||
this.pddActivityToolGoods.total = pddActivityToolGoodsTmp.total;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError(ex.Message);
|
||||
}
|
||||
foreach (var pInfo in pddActivityToolGoodsTmp.goods_list)
|
||||
{
|
||||
pInfo.shopId = shop.ShopId;
|
||||
pInfo.shopName = shop.ShopAccount;
|
||||
if (pInfo != null && !pddActivityToolGoods.goods_list.Any(a => a.goods_id == pInfo.goods_id))
|
||||
{
|
||||
this.pddActivityToolGoods.goods_list.Add(pInfo);
|
||||
string url = pInfo.thumb_url;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
int rowId = this.dgvProduct.Rows.Add(
|
||||
/*pInfo.is_filtered !=*/ true,
|
||||
shop.ShopId,
|
||||
shop.ShopAccount,
|
||||
url.Replace("https", "http"),
|
||||
DataGridViewExtension.defaultBitmap, // 列表图片,public static Bitmap defaultBitmap = new Bitmap(1,1);
|
||||
pInfo.goods_id,
|
||||
pInfo.goods_name,
|
||||
string.Join("~", pInfo.sku_group_price.Select(s => s / 100m)),
|
||||
pInfo.quantity,
|
||||
"", //收藏
|
||||
"", //总销量
|
||||
"", //30日销量
|
||||
/*pInfo.is_filtered == true ? "不可设置:" + pInfo.filtered_reason :*/ "可设置",
|
||||
"" // 操作结果,状态
|
||||
);
|
||||
|
||||
dgvProduct.Rows[rowId].Height = 60;
|
||||
}));
|
||||
}
|
||||
}
|
||||
int discountVal = 0;
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
discountVal = (numReducedAmount.Value * 100).ParseToInt();
|
||||
}));
|
||||
|
||||
var jsonSkusStr = get_xianshixianliang_goods_skus(shop, pddActivityToolGoodsTmp.goods_list.Select(g => g.goods_id.ParseToLong()).ToList(),
|
||||
startStamp, endStamp, page, pageSize);
|
||||
jsonSkusStr = GetHtml.Unicode2String(jsonSkusStr);
|
||||
if (!jsonSkusStr.Contains("\"success\":true"))
|
||||
{
|
||||
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
|
||||
if (shop.LoginStatus != "登录成功")
|
||||
break;
|
||||
|
||||
isError = true;
|
||||
string sErr = BaseRegex.GetStringJson(ref jsonSkusStr, "error_msg");
|
||||
if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr))
|
||||
errMsg += sErr + " ";
|
||||
page++;
|
||||
continue;
|
||||
}
|
||||
List<PDDActivityToolGoodsSkuListInfo> pddActivityToolGoodsSkuListTmp = new List<PDDActivityToolGoodsSkuListInfo>();
|
||||
try
|
||||
{
|
||||
var jObj = JObject.Parse(jsonSkusStr);
|
||||
var rstStr = JsonHelper.SerializeObject(jObj["result"]["search_marketing_tool_sku_result_list"]);
|
||||
pddActivityToolGoodsSkuListTmp = JsonHelper.DeserializeJsonToList<PDDActivityToolGoodsSkuListInfo>(rstStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
//foreach (var pInfo in pddActivityToolGoodsTmp.goods_list)
|
||||
//{
|
||||
// if (pInfo.coupon_value_limit.FirstOrDefault() > discountVal || pInfo.coupon_value_limit.LastOrDefault() < discountVal)
|
||||
// {
|
||||
// var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id);
|
||||
// if (row != null)
|
||||
// {
|
||||
// row.Cells["colOpResult"].Value = "优惠券金额不在可设置范围内!";
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//var createLst = pddActivityToolGoodsTmp.goods_list.Where(g => g.coupon_value_limit.FirstOrDefault() <= discountVal &&
|
||||
// g.coupon_value_limit.LastOrDefault() >= discountVal).Where(g => g.is_filtered == false).ToList();
|
||||
|
||||
var createLst = pddActivityToolGoodsTmp.goods_list;
|
||||
PDDActivityMarketingParam actParam = new PDDActivityMarketingParam();
|
||||
actParam.call_source = 1;
|
||||
actParam.default_channel = true;
|
||||
actParam.batch_stage_activities = new List<batch_stage_activity_info>();
|
||||
foreach (var goodsSkus in pddActivityToolGoodsSkuListTmp)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
batch_stage_activity_info batchStageActParam = new batch_stage_activity_info();
|
||||
actParam.batch_stage_activities.Add(batchStageActParam);
|
||||
batchStageActParam.stage_activities = new List<stage_activity_info>();
|
||||
stage_activity_info stageActParam = new stage_activity_info()
|
||||
{
|
||||
goods_unified_activity = true,
|
||||
activity_name = txtCoupon1Name.Text,
|
||||
activity_type = chkQuantity.Checked ? 3 : 12,
|
||||
check_low_price = true,
|
||||
goods_id = goodsSkus.goods_id,
|
||||
tool_full_channel = "10921_77271__normal",
|
||||
channel_recognize_code = "b21rZ2V5aGwtNDkyMzc5NjkzLTE3NjA5DNA3OTc4MTY=",
|
||||
auto_create_after_finished = false,
|
||||
marketing_tool_detail_option = new marketing_tool_detail_option_info { price_insurance = false, },
|
||||
};
|
||||
batchStageActParam.stage_activities.Add(stageActParam);
|
||||
if (chkQuantity.Checked)
|
||||
stageActParam.pattern = 11;
|
||||
else
|
||||
{
|
||||
stageActParam.start_time = startStamp;
|
||||
stageActParam.end_time = endStamp;
|
||||
}
|
||||
stageActParam.price_list = new List<activity_sku_price>();
|
||||
activity_sku_price skuPriceParam = new activity_sku_price();
|
||||
stageActParam.price_list.Add(skuPriceParam);
|
||||
skuPriceParam.user_activity_limit = 0;
|
||||
skuPriceParam.quantity = null; // 限时购不设置库存
|
||||
if (chkQuantity.Checked) // 如果是限量购,设置具体库存参加活动
|
||||
skuPriceParam.quantity = Math.Min(goodsSkus.valid_sku_volist.Sum(s=>s.quantity).ParseToInt(), numQuantity.Value.ParseToInt());
|
||||
|
||||
skuPriceParam.sku_price_dtos = new List<sku_price_dto>();
|
||||
foreach (var skuPriceInfo in goodsSkus.valid_sku_volist)
|
||||
{
|
||||
skuPriceParam.sku_price_dtos.Add(new sku_price_dto()
|
||||
{
|
||||
sku_id = skuPriceInfo.sku_id,
|
||||
activity_price = chkDiscountTenth.Checked ? (skuPriceInfo.sku_group_price * numDiscountTenth.Value * 0.1m).ParseToInt() :
|
||||
(skuPriceInfo.sku_group_price - numReducedAmount.Value * 100).ParseToInt(),
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (actParam.batch_stage_activities.Count > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
////设置限量购
|
||||
//PDDCouponParam creatCouponParam = new PDDCouponParam();
|
||||
//creatCouponParam.ignore_low_price = false;
|
||||
//creatCouponParam.source_type = 1242;
|
||||
//creatCouponParam.tool_full_channel = "12110_76109_010921_77272";
|
||||
//creatCouponParam.create_request_list = new List<create_request>();
|
||||
//foreach (var pInfo in createLst)
|
||||
//{
|
||||
// Invoke(new Action(() =>
|
||||
// {
|
||||
// creatCouponParam.create_request_list.Add(new create_request
|
||||
// {
|
||||
// batch_desc = txtCoupon1Name.Text,
|
||||
// batch_end_time = endStamp,
|
||||
// batch_start_time = startStamp,
|
||||
// discount = (numCouponValue.Value * 100).ParseToInt(),
|
||||
// duration = 7, // 固定填7
|
||||
// goods_id = pInfo.id,
|
||||
// init_quantity = pInfo.quantity,
|
||||
// period_type = 0,
|
||||
// status = 2, // 固定填2
|
||||
// user_limit = cmbCoupon1TicketNum.Text.Replace("张", "").ParseToInt(),
|
||||
// });
|
||||
// }));
|
||||
//}
|
||||
var creatRst = create_xianshixianliang_goods(shop, actParam);
|
||||
creatRst = GetHtml.Unicode2String(creatRst);
|
||||
if (!creatRst.Contains("\"success\":true"))
|
||||
{
|
||||
var error = BaseRegex.GetStringJson(ref creatRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(error))
|
||||
error = creatRst;
|
||||
foreach (var pInfo in actParam.batch_stage_activities)
|
||||
{
|
||||
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(
|
||||
r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.stage_activities?.FirstOrDefault()?.goods_id);
|
||||
if (row != null)
|
||||
{
|
||||
row.Cells["colOpResult"].Value = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var jObj = JObject.Parse(creatRst);
|
||||
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
|
||||
var pDDCreateActivityResult = JsonHelper.DeserializeJsonToObject<PDDCreateActivityToolResult>(rstStr);
|
||||
|
||||
foreach (var pInfo in createLst)
|
||||
{
|
||||
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.goods_id);
|
||||
if (row != null)
|
||||
{
|
||||
var createErr = pDDCreateActivityResult.fail_list.FirstOrDefault(er => er.goods_id == pInfo.goods_id);
|
||||
if (createErr != null)
|
||||
row.Cells["colOpResult"].Value = createErr.fail_reason;
|
||||
else
|
||||
row.Cells["colOpResult"].Value = "设置成功!";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
|
||||
}
|
||||
}
|
||||
|
||||
int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt();
|
||||
totalPage = Math.Ceiling(1m * total / pageSize).ParseToInt();
|
||||
}
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
var rows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId);
|
||||
|
||||
if (!isError)
|
||||
{
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colMessage"].Value = "已设置";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var row in rows)
|
||||
{
|
||||
row.Cells["colMessage"].Value = "设置失败 " + errMsg;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
ucGroupBoxEx2.Enabled = true;
|
||||
string sRst = "设置结束!";
|
||||
if (cancellationTokenSource.IsCancellationRequested)
|
||||
sRst = "已取消设置!";
|
||||
|
||||
BaseMsgForm.ShowInfo(sRst);
|
||||
this.statusBar.lblTaskStatus.Text = sRst;
|
||||
}));
|
||||
}, cancellationTokenSource.Token);
|
||||
}
|
||||
public void GetToken(ShopLoginInfo shop)
|
||||
{
|
||||
if (!dicShopGetCount.Keys.Contains(shop))
|
||||
dicShopGetCount[shop] = 100;
|
||||
else
|
||||
dicShopGetCount[shop]++;
|
||||
if (dicShopGetCount[shop] > 5)
|
||||
{
|
||||
dicShopGetCount[shop] = 0;
|
||||
|
||||
while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.panel1.SendToBack();
|
||||
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
|
||||
loginForm.TopLevel = false;
|
||||
loginForm.openType = EnumOpenType.manage;
|
||||
loginForm.WindowState = FormWindowState.Maximized;
|
||||
loginForm.InitUrl = "https://mms.pinduoduo.com/tool/surprise-coupon/create/";
|
||||
loginForm.Dock = DockStyle.Fill;
|
||||
this.panel1.Controls.Add(loginForm);
|
||||
loginForm.Show();
|
||||
}));
|
||||
int sleepTime = Randomx.GetId(2000, 3000);
|
||||
Thread.Sleep(sleepTime);
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (PDDShopLoginForm.shopLoginInstance != null)
|
||||
PDDShopLoginForm.shopLoginInstance.Dispose();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cancellationTokenSource != null && !cancellationTokenSource.IsCancellationRequested)
|
||||
cancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
private void dgvProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvProduct.Columns[e.ColumnIndex].HeaderText;
|
||||
switch (headerText)
|
||||
{
|
||||
case "删除":
|
||||
//if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
||||
// return;
|
||||
//var rst = DeleteProduct(dbId);
|
||||
//if (rst)
|
||||
//{
|
||||
// SearchDbProdSelect(this.ucSplitPage1.CurrentPage);
|
||||
//}
|
||||
break;
|
||||
case "图片":
|
||||
{
|
||||
ShowImgForm imgFrom = new ShowImgForm(dgvProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString());
|
||||
imgFrom.ShowDialog();
|
||||
}
|
||||
break;
|
||||
case "":
|
||||
dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void chkQuantity_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
chkTime.Checked = !chkQuantity.Checked;
|
||||
lblQuantity.Visible = numQuantity.Visible = chkQuantity.Checked;
|
||||
if (chkQuantity.Checked)
|
||||
{
|
||||
txtCoupon1Name.Text = txtCoupon1Name.Text.Replace("限时优惠", "限量优惠");
|
||||
}
|
||||
else
|
||||
{
|
||||
txtCoupon1Name.Text = txtCoupon1Name.Text.Replace("限量优惠", "限时优惠");
|
||||
}
|
||||
}
|
||||
|
||||
private void chkTime_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
chkQuantity.Checked = !chkTime.Checked;
|
||||
pnlTime.Visible = chkTime.Checked;
|
||||
}
|
||||
|
||||
private void chkDiscountTenth_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
chkReducedAmount.Checked = !chkDiscountTenth.Checked;
|
||||
}
|
||||
|
||||
private void chkReducedAmount_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
chkDiscountTenth.Checked = !chkReducedAmount.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShopLoginName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShopId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colShopNotes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colSelectProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colLoginStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colCanUse.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colRemaining.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colMessage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colCheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colSupplierId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colSpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colProductName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colFavorites.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colSales.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colSalesThirtyDays.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colIsCanSet.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colOpResult.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -16,6 +16,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
|
||||
public Lazy<PDDProdCouponJingXiForm> prodCouponJingXiForm = new Lazy<PDDProdCouponJingXiForm>();
|
||||
public Lazy<PDDProdCouponShangPinLiJianForm> prodCouponShangPinLiJianForm = new Lazy<PDDProdCouponShangPinLiJianForm>();
|
||||
public Lazy<PDDProdCouponLingQuanZhongXinForm> prodCouponLingQuanZhongXinForm = new Lazy<PDDProdCouponLingQuanZhongXinForm>();
|
||||
public Lazy<PDDProdActivityToolXianShiXianLiangForm> prodActivityToolXianShiXianLiangForm = new Lazy<PDDProdActivityToolXianShiXianLiangForm>();
|
||||
|
||||
public PDDProdCouponForm()
|
||||
{
|
||||
@@ -27,7 +28,8 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
|
||||
this.ucTabControl1.TabPages.Clear();
|
||||
this.ucTabControl1.TabPages.Add("惊喜券");
|
||||
this.ucTabControl1.TabPages.Add("商品立减券");
|
||||
this.ucTabControl1.TabPages.Add("领券中心券");
|
||||
this.ucTabControl1.TabPages.Add("领券中心券");
|
||||
this.ucTabControl1.TabPages.Add("限时限量购");
|
||||
this.ucTabControl1.SelectedIndex = 0;
|
||||
ucTabControl1_SelectedIndexChanged(null, null);
|
||||
}
|
||||
@@ -48,6 +50,9 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
|
||||
case "领券中心券":
|
||||
SetForm(prodCouponLingQuanZhongXinForm.Value);
|
||||
break;
|
||||
case "限时限量购":
|
||||
SetForm(prodActivityToolXianShiXianLiangForm.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -389,16 +389,23 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
|
||||
// 筛选下不符合条件的直接不去设置了
|
||||
createLst = pddCouponGoodsTmp.goods_list.Where(g => g.coupon_value_limit.FirstOrDefault() <= discountVal &&
|
||||
g.coupon_value_limit.LastOrDefault() >= discountVal).Where(g => g.is_filtered == false).ToList();
|
||||
if (createLst.Count > 0)
|
||||
|
||||
while (createLst.Count > 0)
|
||||
{
|
||||
Thread.Sleep(Randomx.GetId(500, 1500));
|
||||
var createLstTmp = createLst.Take(5).ToList();
|
||||
foreach (var item in createLstTmp)
|
||||
{
|
||||
createLst.Remove(item);
|
||||
}
|
||||
|
||||
Thread.Sleep(Randomx.GetId(1000, 2000));
|
||||
//设置商品立减券
|
||||
PDDCouponParam creatCouponParam = new PDDCouponParam();
|
||||
creatCouponParam.ignore_low_price = null;
|
||||
creatCouponParam.source_type = 221;
|
||||
//creatCouponParam.tool_full_channel = "12110_76109_010921_57020_";
|
||||
creatCouponParam.create_request_list = new List<create_request>();
|
||||
foreach (var pInfo in createLst)
|
||||
foreach (var pInfo in createLstTmp)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -424,7 +431,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
|
||||
var error = BaseRegex.GetStringJson(ref creatRst, "error_msg");
|
||||
if (string.IsNullOrEmpty(error))
|
||||
error = creatRst;
|
||||
foreach (var pInfo in createLst)
|
||||
foreach (var pInfo in createLstTmp)
|
||||
{
|
||||
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id);
|
||||
if (row != null)
|
||||
@@ -441,7 +448,7 @@ namespace TemuKJD.PDDForms.ProductForms.CouponForms
|
||||
var rstStr = JsonHelper.SerializeObject(jObj["result"]);
|
||||
var pDDCreateCouponResultV2 = JsonHelper.DeserializeJsonToObject<PDDCreateCouponResultV2>(rstStr);
|
||||
|
||||
foreach (var pInfo in createLst)
|
||||
foreach (var pInfo in createLstTmp)
|
||||
{
|
||||
var row = dgvProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["colSpuId"].Value.ParseToLong() == pInfo.id);
|
||||
if (row != null)
|
||||
|
||||
Reference in new issue
Block a user