shanji 2 years ago
parent
commit
c7353b356f
  1. 3
      BBWY.JDSDK/Request/SellerPromotionAddRequest.cs
  2. 43
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs
  3. 16
      BBWY.Test/JDPromotionAPITest.cs
  4. 11
      BBWY.Test/Program.cs
  5. 24
      BBWY.sln
  6. 15
      Test1/Program.cs
  7. 10
      Test1/Test1.csproj
  8. 4
      Test2/Program.cs
  9. 10
      Test2/Test2.csproj

3
BBWY.JDSDK/Request/SellerPromotionAddRequest.cs

@ -42,6 +42,8 @@ namespace Jd.Api.Request
favorMode
{ get; set; }
public int per_min_num { get; set; }
public override string ApiName
{
get { return "jingdong.seller.promotion.add"; }
@ -66,6 +68,7 @@ namespace Jd.Api.Request
);
parameters.Add("favor_mode", this.favorMode
);
parameters.Add("per_min_num", this.per_min_num);
}
}
}

43
BBWY.Server.Business/PlatformSDK/JDBusiness.cs

@ -1,6 +1,5 @@
using BBWY.Common.Extensions;
using BBWY.Common.Models;
using BBWY.Server.Business.PlatformSDK.DataExtension;
using BBWY.Server.Model;
using BBWY.Server.Model.Dto;
using Jd.ACES;
@ -10,7 +9,6 @@ using Jd.Api.Response;
using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
@ -1093,7 +1091,7 @@ namespace BBWY.Server.Business
req.type = 4; //赠品促销
req.beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
req.endTime = DateTime.Now.AddDays(180).ToString("yyyy-MM-dd HH:mm:ss");
req.per_min_num = 1;
//req.bound = 123;
//req.member = 123;
//req.slogan = "abc";
@ -1192,9 +1190,15 @@ namespace BBWY.Server.Business
public override void DeleteJDPromotionTask(DeleteJDPromotionTaskRequest request)
{
var jdClient = GetJdClient(request.AppKey, request.AppSecret);
var req = new SellerPromotionDeleteRequest();
//var req = new SellerPromotionDeleteRequest();
//req.promoId = request.PromotionId;
//var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime());
var req = new SellerPromotionV2RemoveRequest();
req.requestId = Guid.NewGuid().ToString();
req.promoId = request.PromotionId;
req.promoType = 4;
var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime());
if (res.IsError)
@ -1217,8 +1221,14 @@ namespace BBWY.Server.Business
public override void SuspendJDPromotionTask(SuspendDPromotionTaskRequest request)
{
var jdClient = GetJdClient(request.AppKey, request.AppSecret);
var req = new SellerPromotionSuspendRequest();
//var req = new SellerPromotionSuspendRequest();
//req.promoId = request.PromotionId;
var req = new SellerPromotionV2SuspendRequest();
req.requestId = Guid.NewGuid().ToString();
req.promoId = request.PromotionId;
req.promoType = 4;
var res = jdClient.Execute(req, request.AppToken, DateTime.Now.ToLocalTime());
if (res.IsError)
throw new BusinessException($"暂停JD活动失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}");
@ -1228,15 +1238,22 @@ namespace BBWY.Server.Business
{
var jdClient = GetJdClient(appkey, appSecret);
Thread.Sleep(3000);
var req = new SellerPromotionCheckRequest();
//var req = new SellerPromotionCheckRequest();
//req.promoId = promotionId;
//req.status = 4;
//var res = jdClient.Execute(req, token, DateTime.Now.ToLocalTime());
//if (res.IsError)
//{
// //RollBackWhenStartPromotionError(deleteGiftSkuRequest, request, brandName, haveGiftTemplateSku);
// //throw new BusinessException($"审核活动失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}");
//}
var req = new PopMarketWritePromotionGiftApproveRequest();
req.promoId = promotionId;
req.status = 4;
var res = jdClient.Execute(req, token, DateTime.Now.ToLocalTime());
if (res.IsError)
{
//RollBackWhenStartPromotionError(deleteGiftSkuRequest, request, brandName, haveGiftTemplateSku);
//throw new BusinessException($"审核活动失败-{(string.IsNullOrEmpty(res.ErrorMsg) ? res.ErrMsg : res.ErrorMsg)}");
}
req.requestId = Guid.NewGuid().ToString();
PopMarketWritePromotionGiftApproveResponse response = jdClient.Execute(req, token, DateTime.Now.ToLocalTime());
}
private List<JToken> GetPromotionTaskSku(string appkey, string appSecret, string token, long promotionId)

16
BBWY.Test/JDPromotionAPITest.cs

@ -11,16 +11,16 @@ namespace BBWY.Test
{
public void GetPromotionDetailById(IJdClient client, string token, long promotionId)
{
{
//{
var req = new SellerPromotionV2GetRequest();
req.promoId = promotionId;
req.promoType = 4;
var response = client.Execute(req, token, DateTime.Now.ToLocalTime());
Console.WriteLine(JsonConvert.SerializeObject(response));
// var req = new SellerPromotionV2GetRequest();
// req.promoId = promotionId;
// req.promoType = 4;
// var response = client.Execute(req, token, DateTime.Now.ToLocalTime());
// Console.WriteLine(JsonConvert.SerializeObject(response));
Console.WriteLine();
}
// Console.WriteLine();
//}
{
var pageIndex = 1;
while (true)

11
BBWY.Test/Program.cs

@ -24,7 +24,8 @@ namespace BBWY.Test
////2ace3023200c4ea9aa682bbf8bffee18jztm 布莱特玩具
//var token = "01dc6f6e7fc34dcd99090d690312556cmdfk"; //齐盛
//var token = "9fffa982da23446fb035499ae5622f49odjk"; //腾奇
var token = "c22ff4d37b6c4bbd82cd9e8d0dab42dbziyz"; //森王车品
//var token = "c22ff4d37b6c4bbd82cd9e8d0dab42dbziyz"; //森王车品
var token = "44c19a1c1fbd4641957e6e8985ed1358jmtl"; //森王玩具
//var appkey = "120EA9EC65AB017567D78CC1139EEEA5";
//var appSecret = "8a42bc2301e8439b896e99f5475e0a9b";
@ -42,7 +43,13 @@ namespace BBWY.Test
IJdClient client = GetJdClient(appkey, appSecret);
var p = new JDPromotionAPITest();
p.GetPromotionDetailById(client, token, 5623916808);
p.GetPromotionDetailById(client, token, 30785008559);
p.GetPromotionDetailById(client, token, 30785011567);
p.GetPromotionDetailById(client, token, 30785013875);
p.GetPromotionDetailById(client, token, 30785012730);
p.GetPromotionDetailById(client, token, 5623992600);
p.GetPromotionDetailById(client, token, 5624259295);
//var p = new JDProductAPITest();
//p.GetSkus(client, token);
//{

24
BBWY.sln

@ -40,7 +40,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PJZS", "PJZS\PJZS.csproj",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InDll2", "InDll2\InDll2.csproj", "{1FD36D27-9BED-4E72-B81C-CBC0C4A3120E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BBWY.WebSocket.Server", "BBWY.WebSocket.Server\BBWY.WebSocket.Server.csproj", "{4E08D6A8-5670-4890-B775-2A10017201FD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BBWY.WebSocket.Server", "BBWY.WebSocket.Server\BBWY.WebSocket.Server.csproj", "{4E08D6A8-5670-4890-B775-2A10017201FD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test1", "Test1\Test1.csproj", "{F4B81328-2000-4783-834C-CFB92B1C9D36}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test2", "Test2\Test2.csproj", "{12241ECC-BB66-40AC-85F0-D01537E3DA3B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -162,6 +166,22 @@ Global
{4E08D6A8-5670-4890-B775-2A10017201FD}.Release|Any CPU.Build.0 = Release|Any CPU
{4E08D6A8-5670-4890-B775-2A10017201FD}.Release|x86.ActiveCfg = Release|Any CPU
{4E08D6A8-5670-4890-B775-2A10017201FD}.Release|x86.Build.0 = Release|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Debug|x86.ActiveCfg = Debug|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Debug|x86.Build.0 = Debug|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Release|Any CPU.Build.0 = Release|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Release|x86.ActiveCfg = Release|Any CPU
{F4B81328-2000-4783-834C-CFB92B1C9D36}.Release|x86.Build.0 = Release|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Debug|x86.ActiveCfg = Debug|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Debug|x86.Build.0 = Debug|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Release|Any CPU.Build.0 = Release|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Release|x86.ActiveCfg = Release|Any CPU
{12241ECC-BB66-40AC-85F0-D01537E3DA3B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -180,6 +200,8 @@ Global
{FB4BF1A9-DA81-446F-903C-89D3F905B7B8} = {D097AEA5-A7B1-414D-B82D-F70F177D0D8D}
{1FD36D27-9BED-4E72-B81C-CBC0C4A3120E} = {D097AEA5-A7B1-414D-B82D-F70F177D0D8D}
{4E08D6A8-5670-4890-B775-2A10017201FD} = {B545F3FA-E6A7-4CB1-B92D-801C66357CF5}
{F4B81328-2000-4783-834C-CFB92B1C9D36} = {D097AEA5-A7B1-414D-B82D-F70F177D0D8D}
{12241ECC-BB66-40AC-85F0-D01537E3DA3B} = {D097AEA5-A7B1-414D-B82D-F70F177D0D8D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CC045257-4D86-45FD-A1F0-2715C024F1B5}

15
Test1/Program.cs

@ -0,0 +1,15 @@
// See https://aka.ms/new-console-template for more information
using System.Diagnostics;
using System.Reflection;
using System.Text;
var str = new StringBuilder();
str.Append("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNzA2NjAxNTIyfQ.RCtG71JQ-N1vVt4W-qQhwe5bFOI-T5wDkL74jhNnj1M");
Console.WriteLine("Test1");
var pi = new ProcessStartInfo();
pi.FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Test2.exe");
pi.Arguments = $"{str}";
pi.UseShellExecute = true;
Process.Start(pi);
Console.WriteLine($"{str}");
Console.ReadKey();

10
Test1/Test1.csproj

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

4
Test2/Program.cs

@ -0,0 +1,4 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Test2");
Console.WriteLine(string.Join(string.Empty, args));
Console.ReadKey();

10
Test2/Test2.csproj

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Loading…
Cancel
Save