测试数据库服务接口文件, 店铺活动报名功能

This commit is contained in:
wule committed 2025-08-06 19:09:59 +08:00
1 parent 85ed4137d2
commit 7556b63d10
18 files changed
+687 -158

No files matched your search

+2
View File
@@ -190,10 +190,12 @@
<Compile Include="Model\Param\DyProductManage\QualificationConfig.cs" />
<Compile Include="Model\Param\DyProductManage\ViolateRuleParam.cs" />
<Compile Include="Model\Param\SalesManage\PromotionAddParam.cs" />
<Compile Include="Model\Param\SalesManage\TemuActivityParam.cs" />
<Compile Include="Model\Param\ShopManage\DouShopSettingParam.cs" />
<Compile Include="Model\Param\TemuProductManage\TemuProductWords.cs" />
<Compile Include="Model\Param\TemuProductManage\TemuSizeSpecParam.cs" />
<Compile Include="Model\Result\TemuActivityInfo.cs" />
<Compile Include="Model\Result\TemuActivityMatchProductInfo.cs" />
<Compile Include="Model\Result\TemuDBProductSelect.cs" />
<Compile Include="Model\Result\TemuPriceAdjustInfo.cs" />
<Compile Include="Model\Result\TemuProductInfo.cs" />
+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary>
/// 版本ID
/// </summary>
public static int VersionCount = 500;
public static int VersionCount = 501;
//public static int VersionCount = 500;
/// <summary>
@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Param.SalesManage
{
public class ActSkuListItem
{
/// <summary>
///
/// </summary>
public long? skuId { get; set; }
/// <summary>
///
/// </summary>
public int? activityPrice { get; set; }
}
public class ActSkcListItem
{
/// <summary>
///
/// </summary>
public long? skcId { get; set; }
/// <summary>
///
/// </summary>
public List<ActSkuListItem> skuList { get; set; }
}
public class ActProductListItem
{
/// <summary>
///
/// </summary>
public long? productId { get; set; }
/// <summary>
///
/// </summary>
public int? activityStock { get; set; }
/// <summary>
///
/// </summary>
public List<ActSkcListItem> skcList { get; set; }
}
public class TemuActivityParam
{
/// <summary>
///
/// </summary>
public int? activityType { get; set; }
/// <summary>
///
/// </summary>
public long? activityThematicId { get; set; }
/// <summary>
///
/// </summary>
public List<ActProductListItem> productList { get; set; }
}
}
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Result
{
public class TemuActivityMatchProductInfo
{
public string pictureUrl { get; set; }
public long? productId { get; set; }
public int? targetActivityStock { get; set; }
public int? suggestActivityStock { get; set; }
public string productName { get; set; }
public List<TemuActivitySkcInfo> skcList { get; set; }
}
public class TemuActivitySkcInfo
{
public long skcId { get; set; }
public List<TemuActivitySkuInfo> skuList { get; set; }
public string extCode { get; set; }
}
public class TemuActivitySkuInfo
{
public int? dailyPrice { get; set; }
public string extCode { get; set; }
public int? suggestActivityPrice { get; set; }
public long? skuId { get; set; }
public string currenty { get; set; }
public Dictionary<object, object> properties { get; set; }
}
}
+16 -3
View File
@@ -394,11 +394,18 @@ namespace KJD_Web.BLL
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
long l_draft_id = draft_id.ParseToLong();
long l_table_id = l_draft_id % 128;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
// 使用事务一次提交多个sql操作
//sql += "set @@autocommit=0;\r\n";
sql += "START TRANSACTION;\r\n";
if (!string.IsNullOrEmpty(up_spu_id) && !string.IsNullOrEmpty(draft_id))
sql += "insert into kjd.spu_map (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');";
sql += "insert into kjd_map.spu_map_" + l_table_id +
" (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');\r\n";
sql += "update kjd.product_select set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
@@ -408,8 +415,14 @@ namespace KJD_Web.BLL
sql += " add_times=add_times+1,";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";";
sql += " where id=" + id + ";\r\n";
var rst = mySql.ExecuteNonQuery(sql);
string errMsg = mySql.Message;
if (string.IsNullOrEmpty(errMsg))
sql = "COMMIT;";
else
sql = "ROLLBACK;";
mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
@@ -417,7 +430,7 @@ namespace KJD_Web.BLL
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
@@ -357,11 +357,18 @@ namespace KJD_Web.BLL
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
long l_draft_id = draft_id.ParseToLong();
long l_table_id = l_draft_id % 128;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
// 使用事务一次提交多个sql操作
//sql += "set @@autocommit=0;\r\n";
sql += "START TRANSACTION;\r\n";
if (!string.IsNullOrEmpty(up_spu_id) && !string.IsNullOrEmpty(draft_id))
sql += "insert into kjd.spu_map (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');";
sql += "insert into kjd_map.spu_map_" + l_table_id +
" (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');\r\n";
sql += "update kjd.third_product_select set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
@@ -371,8 +378,14 @@ namespace KJD_Web.BLL
sql += " add_times=add_times+1,";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";";
sql += " where id=" + id + ";\r\n";
var rst = mySql.ExecuteNonQuery(sql);
string errMsg = mySql.Message;
if (string.IsNullOrEmpty(errMsg))
sql = "COMMIT;";
else
sql = "ROLLBACK;";
mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
@@ -380,7 +393,7 @@ namespace KJD_Web.BLL
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
@@ -0,0 +1,60 @@
using KJD_Web.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.BLL
{
public class ToolManage
{
//mysql workbench 存储过程,可以使用分隔符重定义
// string 存储过程1 = @"
//DELIMITER $
//DROP PROCEDURE IF EXISTS add_spu_map;
//CREATE PROCEDURE add_spu_map()
//BEGIN
//insert into kjd_map.spu_map_0 (draft_id,from_spu_id,shop_id) values(9122600878,727585921,'3049342434562');
//update kjd.third_product_select set draft_id='9122600878', status='已上传', add_times=add_times+1, mdy_time='2025-08-06 11:54:50' where id=6532;
//END $
//DELIMITER ;
//CALL add_spu_map();";
//腾讯云服务器存储过程,不能使用分隔符重定义
// string 存储过程2 = @"
//DROP PROCEDURE IF EXISTS add_spu_map;
//CREATE PROCEDURE add_spu_map()
//BEGIN
//insert into kjd_map.spu_map_1 (draft_id,from_spu_id,shop_id) values(9122600878,727585921,'3049342434562');
//update kjd.third_product_select set draft_id='9122600878', status='已上传', add_times=add_times+1, mdy_time='2025-08-06 11:54:50' where id=6532;
//END ;
//CALL add_spu_map();";
public void CreateTable()
{
// string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
// MysqlUtils mySql = new MysqlUtils(conn);
// string sql = "";
// string sql1 = "";
// for (int i = 0; i < 69; i++)
// {
// //sql = @"drop table if exists kjd_map.spu_map_" + i + ";\r\n";
// sql = @"CREATE TABLE IF NOT EXISTS kjd_map.spu_map_" + i + @" (
// `id` int NOT NULL AUTO_INCREMENT,
// `draft_id` bigint NOT NULL COMMENT '草稿箱/商品Id',
// `from_spu_id` bigint NOT NULL COMMENT '母店来源商品Id',
// `shop_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '上传的店铺',
// PRIMARY KEY (`id`)
//) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '上传商品与母店商品spu映射关系';";
// sql += @"
//ALTER TABLE
// kjd_map.spu_map_" + i + @"
//ADD
// COLUMN `add_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP";
// var rst = mySql.ExecuteNonQuery(sql);
// }
// mySql.Close();
}
}
}
@@ -1,5 +1,5 @@
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -46,6 +46,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="MySql.Data">
<HintPath>..\Dll\MySql.Data.dll</HintPath>
@@ -70,17 +73,13 @@
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />
<Content Include="ProductThirdService.asmx" />
<Content Include="ProductService.asmx" />
<Content Include="ShopService.asmx" />
<Content Include="UpdateService.asmx" />
<Content Include="ToolService.asmx" />
<Content Include="UserService.asmx" />
<Content Include="Web.config" />
</ItemGroup>
@@ -88,6 +87,7 @@
<Compile Include="BLL\ProductThirdManage.cs" />
<Compile Include="BLL\ProductManage.cs" />
<Compile Include="BLL\ShopManage.cs" />
<Compile Include="BLL\ToolManage.cs" />
<Compile Include="BLL\UpadteManage.cs" />
<Compile Include="BLL\UserManage.cs" />
<Compile Include="Global.asax.cs">
@@ -116,6 +116,10 @@
<DependentUpon>UpdateService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="ToolService.asmx.cs">
<DependentUpon>ToolService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="UserService.asmx.cs">
<DependentUpon>UserService.asmx</DependentUpon>
<SubType>Component</SubType>
@@ -174,7 +178,7 @@
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="ToolService.asmx.cs" Class="KJD_Web.ToolService" %>
@@ -0,0 +1,64 @@
using KJD_Web.BLL;
using KJD_Web.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Services;
namespace KJD_Web
{
/// <summary>
/// UserService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
// [System.Web.Script.Services.ScriptService]
public class ToolService : System.Web.Services.WebService
{
[WebMethod]
public string hello_world()
{
return "Hello World";
}
private string GetRequestJsonString()
{
Context.Response.ContentType = "text/html;charset=utf-8";
Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流
{
// 还原数据流
byte[] b = new byte[s.Length];
s.Read(b, 0, (int)s.Length);
string jsonText = Encoding.UTF8.GetString(b); // JSON字符串
if (string.IsNullOrEmpty(jsonText))
{
var qs = HttpContext.Current.Request.QueryString;
if (qs != null && qs.Keys.Count > 0)
{
jsonText = "{";
foreach (var key in qs.Keys)
{
jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";";
}
jsonText = jsonText.TrimEnd(';') + "}";
}
}
return jsonText;
}
}
[WebMethod]
public void create_table()
{
//return;
new ToolManage().CreateTable();
}
}
}
+24 -18
View File
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ConnKJD" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-hl51pkfr.sql.tencentcdb.com';Port=27660;User Id='kjd';Password='Temukjd0625';Charset=utf8mb4;" />
<add name="UpdateVersion" connectionString="100"/>
<add name="UpdateExe" connectionString="http://1.13.195.131:9000/Download/Update.exe"/>
<add name="UpdateFiles" connectionString="http://1.13.195.131:9000/Download/Update.zip"/>
<add name="UpdateExeChk" connectionString="2CDEA1FB"/>
<add name="ConnKJD" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-hl51pkfr.sql.tencentcdb.com';Port=27660;User Id='kjd';Password='Temukjd0625';Charset=utf8mb4;"/>
<add name="UpdateVersion" connectionString="100"/>
<add name="UpdateExe" connectionString="http://1.13.195.131:9000/Download/Update.exe"/>
<add name="UpdateFiles" connectionString="http://1.13.195.131:9000/Download/Update.zip"/>
<add name="UpdateExeChk" connectionString="2CDEA1FB"/>
</connectionStrings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
@@ -20,29 +20,35 @@
</system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<webServices>
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
<add name="Documentation" />
<add name="HttpGet"/>
<add name="HttpPost"/>
<add name="Documentation"/>
</protocols>
</webServices>
<pages controlRenderingCompatibilityVersion="4.0" />
<pages controlRenderingCompatibilityVersion="4.0"/>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="9.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="9.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<directoryBrowse enabled="true" />
<staticContent>
<mimeMap fileExtension=".asmx" mimeType="application/octet-stream" />
</staticContent>
<directoryBrowse enabled="true"/>
<staticContent>
<mimeMap fileExtension=".asmx" mimeType="application/octet-stream"/>
</staticContent>
</system.webServer>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers>
</system.codedom>
</configuration>
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net452" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net46" requireReinstallation="true" />
</packages>
@@ -152,7 +152,7 @@ namespace TemuKJD.KJDForms.ProductForms
switch (columnName)
{
case "colSelect":
if (row.Cells["colCanUse"].Value.ParseToBool())
if (row.Cells["colCanUse"].Value.ParseToBool() || row.Cells["colSelect"].Value.ParseToBool())
{
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
@@ -528,7 +528,7 @@ namespace TemuKJD.KJDForms.ProductForms
switch (columnName)
{
case "colSelect":
if (row.Cells["colCanUse"].Value.ParseToBool())
if (row.Cells["colCanUse"].Value.ParseToBool() || row.Cells["colSelect"].Value.ParseToBool())
{
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
@@ -75,17 +75,12 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgvActivity = new TemuKJD.UserComponent.DataGridViewEx();
this.colCheckActivity = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colActivityId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSignUpTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colDiscount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.colCheckProduct = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSubmitActivityId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSubmitActivityName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPic = new System.Windows.Forms.DataGridViewImageColumn();
this.colProdName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSpuId = new System.Windows.Forms.DataGridViewLinkColumn();
@@ -97,6 +92,13 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colInventory = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.colCheckActivity = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colActivityId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSignUpTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colDiscount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colActivityMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -249,6 +251,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.panelEx1.TabIndex = 668;
this.panelEx1.Text = "停止当前操作";
this.panelEx1.Click += new System.EventHandler(this.btnStop_Click);
//
// btnClear
//
@@ -691,6 +694,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.dgvActivity.AllowUserToDeleteRows = false;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvActivity.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvActivity.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvActivity.BackgroundColor = System.Drawing.Color.White;
this.dgvActivity.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
@@ -719,56 +723,6 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.dgvActivity.TabIndex = 189;
this.dgvActivity.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvActivity_CellContentClick);
//
// colCheckActivity
//
this.colCheckActivity.HeaderText = "选择";
this.colCheckActivity.Name = "colCheckActivity";
this.colCheckActivity.ReadOnly = true;
this.colCheckActivity.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheckActivity.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheckActivity.Width = 30;
//
// colActivityId
//
this.colActivityId.HeaderText = "活动编号";
this.colActivityId.Name = "colActivityId";
this.colActivityId.ReadOnly = true;
this.colActivityId.Visible = false;
//
// colActivityName
//
this.colActivityName.HeaderText = "活动主题";
this.colActivityName.Name = "colActivityName";
this.colActivityName.ReadOnly = true;
this.colActivityName.Width = 280;
//
// colActivityTime
//
this.colActivityTime.HeaderText = "活动时间";
this.colActivityTime.Name = "colActivityTime";
this.colActivityTime.ReadOnly = true;
this.colActivityTime.Width = 320;
//
// colSignUpTime
//
this.colSignUpTime.HeaderText = "报名截止";
this.colSignUpTime.Name = "colSignUpTime";
this.colSignUpTime.ReadOnly = true;
this.colSignUpTime.Width = 110;
//
// colDiscount
//
this.colDiscount.HeaderText = "活动折扣";
this.colDiscount.Name = "colDiscount";
this.colDiscount.ReadOnly = true;
//
// colActivityMsg
//
this.colActivityMsg.HeaderText = "状态";
this.colActivityMsg.Name = "colActivityMsg";
this.colActivityMsg.ReadOnly = true;
this.colActivityMsg.Width = 400;
//
// dgvProduct
//
this.dgvProduct.AllowUserToAddRows = false;
@@ -790,6 +744,8 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colCheckProduct,
this.colSupplierId,
this.colSupplierName,
this.colSubmitActivityId,
this.colSubmitActivityName,
this.colPic,
this.colProdName,
this.colSpuId,
@@ -815,6 +771,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colCheckProduct.ReadOnly = true;
this.colCheckProduct.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheckProduct.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colCheckProduct.Visible = false;
this.colCheckProduct.Width = 30;
//
// colSupplierId
@@ -830,6 +787,20 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colSupplierName.ReadOnly = true;
this.colSupplierName.Width = 110;
//
// colSubmitActivityId
//
this.colSubmitActivityId.HeaderText = "报名活动Id";
this.colSubmitActivityId.Name = "colSubmitActivityId";
this.colSubmitActivityId.ReadOnly = true;
this.colSubmitActivityId.Visible = false;
//
// colSubmitActivityName
//
this.colSubmitActivityName.HeaderText = "报名活动名称";
this.colSubmitActivityName.Name = "colSubmitActivityName";
this.colSubmitActivityName.ReadOnly = true;
this.colSubmitActivityName.Width = 150;
//
// colPic
//
this.colPic.HeaderText = "图片";
@@ -853,6 +824,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colSpuId.ReadOnly = true;
this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSpuId.Width = 90;
//
// coSkcId
//
@@ -862,7 +834,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.coSkcId.ReadOnly = true;
this.coSkcId.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.coSkcId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.coSkcId.Width = 80;
this.coSkcId.Width = 90;
//
// colExtCode
//
@@ -876,7 +848,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.colRecommendPrice.HeaderText = "推荐价格(折扣)";
this.colRecommendPrice.Name = "colRecommendPrice";
this.colRecommendPrice.ReadOnly = true;
this.colRecommendPrice.Width = 70;
this.colRecommendPrice.Width = 90;
//
// colRecommendInventory
//
@@ -916,6 +888,54 @@ namespace TemuKJD.KJDForms.SalesCenterForms
this.statusBar.Size = new System.Drawing.Size(700, 26);
this.statusBar.TabIndex = 2;
//
// colCheckActivity
//
this.colCheckActivity.FillWeight = 15F;
this.colCheckActivity.HeaderText = "选择";
this.colCheckActivity.Name = "colCheckActivity";
this.colCheckActivity.ReadOnly = true;
this.colCheckActivity.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheckActivity.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// colActivityId
//
this.colActivityId.HeaderText = "活动编号";
this.colActivityId.Name = "colActivityId";
this.colActivityId.ReadOnly = true;
this.colActivityId.Visible = false;
//
// colActivityName
//
this.colActivityName.HeaderText = "活动主题";
this.colActivityName.Name = "colActivityName";
this.colActivityName.ReadOnly = true;
//
// colActivityTime
//
this.colActivityTime.HeaderText = "活动时间";
this.colActivityTime.Name = "colActivityTime";
this.colActivityTime.ReadOnly = true;
//
// colSignUpTime
//
this.colSignUpTime.FillWeight = 50F;
this.colSignUpTime.HeaderText = "报名截止";
this.colSignUpTime.Name = "colSignUpTime";
this.colSignUpTime.ReadOnly = true;
//
// colDiscount
//
this.colDiscount.FillWeight = 50F;
this.colDiscount.HeaderText = "活动折扣";
this.colDiscount.Name = "colDiscount";
this.colDiscount.ReadOnly = true;
//
// colActivityMsg
//
this.colActivityMsg.HeaderText = "状态";
this.colActivityMsg.Name = "colActivityMsg";
this.colActivityMsg.ReadOnly = true;
//
// MarketingActivityForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -993,27 +1013,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse;
private System.Windows.Forms.DataGridViewTextBoxColumn colMessage;
private UserComponent.DataGridViewEx dgvProduct;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckProduct;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewImageColumn colPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colProdName;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn coSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrcie;
private System.Windows.Forms.DataGridViewTextBoxColumn colInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private UserComponent.DataGridViewEx dgvActivity;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckActivity;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityId;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityName;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colSignUpTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colDiscount;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityMsg;
private UserComponent.UcCheckBox chkGetDiscount;
private DevComponents.DotNetBar.PanelEx panelEx2;
private UcActivityDiscountCtrl actDiscount85;
@@ -1030,5 +1030,27 @@ namespace TemuKJD.KJDForms.SalesCenterForms
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown numNoSaleDays;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckProduct;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubmitActivityId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSubmitActivityName;
private System.Windows.Forms.DataGridViewImageColumn colPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colProdName;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn coSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendPrice;
private System.Windows.Forms.DataGridViewTextBoxColumn colRecommendInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrcie;
private System.Windows.Forms.DataGridViewTextBoxColumn colInventory;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheckActivity;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityId;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityName;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colSignUpTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colDiscount;
private System.Windows.Forms.DataGridViewTextBoxColumn colActivityMsg;
}
}
@@ -1,5 +1,6 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Param.SalesManage;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
@@ -25,6 +26,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public List<TemuActivityThematicInfo> lstActivityThematic { get; set; } = new List<TemuActivityThematicInfo>();
public List<string> lstShopIdSelect = new List<string>();
public List<string> lstActivityIdSelect = new List<string>();
public List<int> lstDiscount = new List<int>() { 60, 70, 80, 85 };
public Dictionary<string, List<SubOrderInfo>> dicNoSaleProd = new Dictionary<string, List<SubOrderInfo>>();
@@ -158,7 +160,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
switch (columnName)
{
case "colSelect":
if (row.Cells["colCanUse"].Value.ParseToBool())
if (row.Cells["colCanUse"].Value.ParseToBool() || row.Cells["colSelect"].Value.ParseToBool())
{
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
@@ -459,6 +461,9 @@ namespace TemuKJD.KJDForms.SalesCenterForms
i++;
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
if (actInfo == null)
continue;
@@ -512,7 +517,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
tryAgain:
Thread.Sleep(100 + Randomx.GetId(200));
string jsonRst = GetActivityMatch(shop, actInfo.activityThematicId.ParseToLong());
if (jsonRst.Contains("指定的值含有无效的控制字符"))
if (jsonRst.Contains("指定的值含有无效的控制字符") || jsonRst.Contains("login") || jsonRst.Contains("Login"))
{
Invoke(new Action(() =>
{
@@ -531,9 +536,6 @@ namespace TemuKJD.KJDForms.SalesCenterForms
tryCount++;
goto tryAgain;
}
if (jsonRst.Contains("当前操作人数太多,请稍后重试"))
{
}
if (!jsonRst.Contains("\"success\":true"))
{
//isError = true;
@@ -593,7 +595,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
}
}
if(string.IsNullOrEmpty(actInfo.discount))
if(string.IsNullOrEmpty(actInfo.discount) && !cancellationTokenSource.IsCancellationRequested)
{
this.Invoke(new Action(() =>
{
@@ -649,22 +651,21 @@ namespace TemuKJD.KJDForms.SalesCenterForms
cancellationTokenSource = new CancellationTokenSource();
lstShopIdSelect.Clear();
lstShopIdSelect.AddRange(lstShopId);
lstActivityIdSelect.Clear();
lstActivityIdSelect.AddRange(lstActivityId);
#endregion
Task.Run(() =>
{
if (chkNoSaleProd.Checked)
GetNoSaleProd();
SignActivity();
Invoke(new Action(() =>
{
ucGroupBoxEx2.Enabled = true;
ucGroupBoxEx3.Enabled = true;
string sRst = "查询结束!";
string sRst = "已完成活动报名!";
if (cancellationTokenSource.IsCancellationRequested)
sRst = "已取消查询!";
sRst = "已取消活动报名!";
BaseMsgForm.ShowInfo(sRst);
this.statusBar.lblTaskStatus.Text = sRst;
@@ -672,14 +673,112 @@ namespace TemuKJD.KJDForms.SalesCenterForms
},cancellationTokenSource.Token);
}
public void GetNoSaleProd()
/// <summary>
/// 查询店铺未出单商品,返回商品id列表
/// </summary>
public List<string> GetNoSaleProd(string shopId)
{
//int i = 0;
//foreach (var shopId in lstShopIdSelect)
//{
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在查询无销量商品...";
this.statusBar.pgbTaskProgress.Maximum = lstShopIdSelect.Count;
//this.statusBar.UpdateProgressBar(i + 1);
//i++;
}));
if (cancellationTokenSource.IsCancellationRequested)
return new List<string>();
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
return new List<string>();
var shopRow = this.dgvShop.Rows.Cast<DataGridViewRow>()
.FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow == null)
return new List<string>();
if (!CheckLogin(shop))
return new List<string>();
Invoke(new Action(() =>
{
shopRow.Cells["colMessage"].Value = "正在查询无销量商品";
}));
this.dicNoSaleProd[shop.ShopId] = new List<SubOrderInfo>();
int page = 0;
int totalPage = 1;
while (page < totalPage)
{
page++;
string jsonRst = GetNoSaleProd(shop, numNoSaleDays.Value.ParseToInt(), page);
if (!jsonRst.Contains("\"success\":true"))
{
string sErr = BaseRegex.GetStringJson(ref jsonRst, "errorMsg");
if (string.IsNullOrEmpty(sErr))
sErr = BaseRegex.GetStringJson(ref jsonRst, "err_msg");
if (string.IsNullOrEmpty(sErr))
sErr = jsonRst;
Invoke(new Action(() =>
{
shopRow.Cells["colMessage"].Value = sErr;
}));
break;
}
var jArr = new JArray();
try
{
var jObj = JObject.Parse(jsonRst);
jArr = jObj["result"]["subOrderList"] as JArray;
if (jArr == null)
jArr = new JArray();
foreach (var item in jArr)
{
string sItem = item.ToString();
SubOrderInfo sInfo = JsonHelper.DeserializeJsonToObject<SubOrderInfo>(sItem); // 反序列化得到类
if (sInfo != null)
{
this.dicNoSaleProd[shop.ShopId].Add(sInfo);
}
}
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
int total = BaseRegex.GetStringJson(ref jsonRst, "total").ParseToInt();
totalPage = Math.Ceiling(total / 40.0).ParseToInt();
}
//}
try
{
return this.dicNoSaleProd[shop.ShopId].Select(p => p.productId.ParseToString()).ToList();
}
catch
{
return new List<string>();
}
}
public void SignActivity()
{
int i = 0;
foreach (var shopId in lstShopIdSelect)
{
List<string> noSaleProdIdLst = new List<string>();
if (chkNoSaleProd.Checked)
noSaleProdIdLst.AddRange(GetNoSaleProd(shopId));
this.Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在查询无销量商品...";
this.statusBar.lblTaskStatus.Text = "正在报名活动商品...";
this.statusBar.pgbTaskProgress.Maximum = lstShopIdSelect.Count;
this.statusBar.UpdateProgressBar(i + 1);
i++;
@@ -695,17 +794,42 @@ namespace TemuKJD.KJDForms.SalesCenterForms
.FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId);
if (shopRow == null)
continue;
if (!CheckLogin(shop))
continue;
this.dicNoSaleProd[shop.ShopId] = new List<SubOrderInfo>();
int page = 0;
int totalPage = 1;
while (page < totalPage)
foreach (var activityId in lstActivityIdSelect)
{
page++;
string jsonRst = GetNoSaleProd(shop, numNoSaleDays.Value.ParseToInt(), page);
var activity = lstActivityThematic.FirstOrDefault(a => a.activityThematicId.ParseToString() == activityId);
if (activity == null)
continue;
var actRow = this.dgvActivity.Rows.Cast<DataGridViewRow>()
.FirstOrDefault(r => r.Cells["colActivityId"].Value.ParseToLong() == activity.activityThematicId);
if (actRow == null)
continue;
int tryCount = 0;
tryAgain:
Thread.Sleep(100 + Randomx.GetId(200));
var jsonRst = GetActivityMatch(shop, activity.activityThematicId, string.Join(",", noSaleProdIdLst));
if (jsonRst.Contains("指定的值含有无效的控制字符") || jsonRst.Contains("login") || jsonRst.Contains("Login"))
{
Invoke(new Action(() =>
{
var shopRows = this.dgvShop.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName);
foreach (var r in shopRows)
{
r.Cells["colMessage"].Value = "店铺掉线";
r.Cells["colLoginStatus"].Value = "国际版未登录";
r.Cells["colCanUse"].Value = false;
}
}));
continue;
}
if (jsonRst.Contains("当前操作人数太多,请稍后重试") && tryCount < 5)
{
tryCount++;
goto tryAgain;
}
if (!jsonRst.Contains("\"success\":true"))
{
@@ -716,48 +840,134 @@ namespace TemuKJD.KJDForms.SalesCenterForms
sErr = jsonRst;
Invoke(new Action(() =>
{
actRow.Cells["colActivityMsg"].Value = sErr;
shopRow.Cells["colMessage"].Value = sErr;
}));
break;
continue;
}
var jArr = new JArray();
try
{
var jObj = JObject.Parse(jsonRst);
jArr = jObj["result"]["subOrderList"] as JArray;
jArr = jObj["result"]?["matchList"] as JArray;
if (jArr == null)
jArr = new JArray();
}
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
foreach (var item in jArr)
if (jArr.Count() == 0)
{
continue;
}
try
{
string str = JsonHelper.SerializeObject(jArr);
var prodLst = JsonHelper.DeserializeJsonToList<TemuActivityMatchProductInfo>(str);
var prodSubmitRows = new List<DataGridViewRow>();
TemuActivityParam activityParam = new TemuActivityParam();
activityParam.activityType = 13;
activityParam.activityThematicId = activity.activityThematicId;
activityParam.productList = new List<ActProductListItem>();
foreach (var prod in prodLst)
{
string sItem = item.ToString();
SubOrderInfo sInfo = JsonHelper.DeserializeJsonToObject<SubOrderInfo>(sItem); // 反序列化得到类
if (sInfo != null)
int discount = this.GetNearDiscount(activity.discount.ParseToInt());
var discountCtrl = this.actDiscount60;
if (discount == 70)
discountCtrl = this.actDiscount70;
if (discount == 80)
discountCtrl = this.actDiscount80;
if (discount == 85)
discountCtrl = this.actDiscount85;
// 如果是默认库存或者库存小于推荐值,使用推荐库存
int inventory = discountCtrl.Inventory;
if (inventory < prod.suggestActivityStock || discountCtrl.IsDefaultInventory)
inventory = prod.suggestActivityStock.ParseToInt();
Invoke(new Action(() =>
{
this.dicNoSaleProd[shop.ShopId].Add(sInfo);
int rowId = dgvProduct.Rows.Add(
true,
shop.ShopId,
shop.ShopAccount,
activity.activityThematicId,
activity.activityThematicName,
null,//prod.pictureUrl,
prod.productName,
prod.productId,
prod.skcList.FirstOrDefault()?.skcId,
prod.skcList.FirstOrDefault()?.extCode,
activity.discount.Trim('0') + "折",
prod.suggestActivityStock,
activity.discount.Trim('0') + "折",
inventory
);
dgvProduct.Rows[rowId].Height = 30;
prodSubmitRows.Add(dgvProduct.Rows[rowId]);
}));
ActProductListItem activityProditem = new ActProductListItem();
activityProditem.productId = prod.productId;
activityProditem.activityStock = inventory;
activityProditem.skcList = new List<ActSkcListItem>();
ActSkcListItem actSkcListItem = new ActSkcListItem();
actSkcListItem.skcId = prod.skcList.FirstOrDefault()?.skcId;
actSkcListItem.skuList = new List<ActSkuListItem>();
foreach (var skuInfo in prod.skcList.FirstOrDefault()?.skuList)
{
actSkcListItem.skuList.Add(new ActSkuListItem
{
activityPrice = skuInfo.suggestActivityPrice,
skuId = skuInfo.skuId,
});
}
activityProditem.skcList.Add(actSkcListItem);
activityParam.productList.Add(activityProditem);
}
string data = JsonHelper.SerializeObject(activityParam);
string submitRst = "";
submitRst = SubmitActivity(shop, activityParam.activityThematicId, data);
if (!submitRst.Contains("\"success\":true"))
{
string sSubmitErr = BaseRegex.GetStringJson(ref submitRst, "errorMsg");
if (string.IsNullOrEmpty(sSubmitErr))
sSubmitErr = BaseRegex.GetStringJson(ref submitRst, "err_msg");
if (string.IsNullOrEmpty(sSubmitErr))
sSubmitErr = jsonRst;
Invoke(new Action(() =>
{
foreach(var submitRow in prodSubmitRows)
{
submitRow.Cells["colMsg"].Value = sSubmitErr;
}
}));
continue;
}
Invoke(new Action(() =>
{
foreach (var submitRow in prodSubmitRows)
{
submitRow.Cells["colMsg"].Value = "提交活动成功";
}
}));
// 如果提交成功且还有更多商品可报名,继续重复报名(已报名商品不会出现在搜索结果列表)
if (submitRst.Contains("\"success\":true") && jsonRst.Contains("\"hasMore\":true"))
{
tryCount = 0;
goto tryAgain;
}
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
int total = BaseRegex.GetStringJson(ref jsonRst, "total").ParseToInt();
totalPage = Math.Ceiling(total / 40.0).ParseToInt();
catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); }
}
}
}
public void SignActivity()
{
foreach (var shopId in lstShopIdSelect)
{
}
}
public bool CheckLogin(ShopLoginInfo shop)
{
if (shop.LoginStatus2 != "国际版在线")
@@ -783,6 +993,12 @@ namespace TemuKJD.KJDForms.SalesCenterForms
return true;
}
private void btnStop_Click(object sender, EventArgs e)
{
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
}
/// <summary>
/// 获取活动列表
/// </summary>
@@ -801,12 +1017,35 @@ namespace TemuKJD.KJDForms.SalesCenterForms
/// 获取符合店铺的活动
/// </summary>
/// <param name="shop"></param>
/// <param name="thematicId"></param>
/// <param name="spuIds">多个用逗号隔开</param>
/// <returns></returns>
private string GetActivityMatch(ShopLoginInfo shop, long? thematicId)
private string GetActivityMatch(ShopLoginInfo shop, long? thematicId, string spuIds="")
{
string url = "https://agentseller.temu.com/api/kiana/gamblers/marketing/enroll/scroll/match";
string body;
body = @"{""activityType"":13,""activityThematicId"":" + thematicId + @",""rowCount"":50}";
if (!string.IsNullOrWhiteSpace(spuIds))
{
body = @"{""activityType"":13,""activityThematicId"":" + thematicId +
@",""rowCount"":50,""productIds"":[" + spuIds + @"],""productSkcExtCodes"":[]}";
}
string refere = "https://agentseller.temu.com/activity/marketing-activity/detail-new?type=13&thematicId=" + thematicId;
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
/// <summary>
/// 提交活动报名
/// </summary>
/// <param name="shop"></param>
/// <param name="thematicId"></param>
/// <param name="_body"></param>
/// <returns></returns>
private string SubmitActivity(ShopLoginInfo shop, long? thematicId, string _body)
{
string url = "https://agentseller.temu.com/api/kiana/gamblers/marketing/enroll/submit";
string body;
body = _body;
string refere = "https://agentseller.temu.com/activity/marketing-activity/detail-new?type=13&thematicId=" + thematicId;
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
@@ -165,6 +165,12 @@
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSubmitActivityId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSubmitActivityName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPic.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -147,7 +147,7 @@ namespace TemuKJD.KJDForms.SalesCenterForms
switch (columnName)
{
case "colSelect":
if (row.Cells["colCanUse"].Value.ParseToBool())
if (row.Cells["colCanUse"].Value.ParseToBool() || row.Cells["colSelect"].Value.ParseToBool())
{
row.Cells["colSelect"].Value = !row.Cells["colSelect"].Value.ParseToBool();
if (dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value.ParseToBool())