Browse Source

订单管家推送接口

qianyi
shanji 3 years ago
parent
commit
096ec3a5b1
  1. 6
      BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs
  2. 6
      BBWY.Client/Models/Shop/Shop.cs
  3. 3
      BBWY.Client/ViewModels/MainViewModel.cs
  4. 56
      BBWY.Server.Business/Vender/VenderBusiness.cs
  5. 18
      BBWY.Server.Model/Db/Mds/Shops.cs
  6. 8
      BBWY.Server.Model/Dto/Response/Vender/ShopResponse.cs
  7. 8
      BBWY.Server.Model/Enums.cs
  8. 11
      BBWY.Test/Program.cs

6
BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs

@ -20,6 +20,12 @@ namespace BBWY.Client.Models
public string AppToken { get; set; } public string AppToken { get; set; }
public string AppKey2 { get; set; }
public string AppSecret2 { get; set; }
public string AppToken2 { get; set; }
public IList<PurchaseAccountResponse> PurchaseList { get; set; } public IList<PurchaseAccountResponse> PurchaseList { get; set; }
public string ManagePwd { get; set; } public string ManagePwd { get; set; }

6
BBWY.Client/Models/Shop/Shop.cs

@ -29,6 +29,12 @@ namespace BBWY.Client.Models
public string AppToken { get; set; } public string AppToken { get; set; }
public string AppKey2 { get; set; }
public string AppSecret2 { get; set; }
public string AppToken2 { get; set; }
public string ShopName { get => shopName; set { Set(ref shopName, value); } } public string ShopName { get => shopName; set { Set(ref shopName, value); } }
public IList<PurchaseAccount> PurchaseAccountList { get; set; } public IList<PurchaseAccount> PurchaseAccountList { get; set; }

3
BBWY.Client/ViewModels/MainViewModel.cs

@ -250,6 +250,9 @@ namespace BBWY.Client.ViewModels
shop.SiNanPolicyLevel = s2.SiNanPolicyLevel; shop.SiNanPolicyLevel = s2.SiNanPolicyLevel;
shop.SiNanDingDingKey = s2.SiNanDingDingKey; shop.SiNanDingDingKey = s2.SiNanDingDingKey;
shop.SiNanDingDingWebHook = s2.SiNanDingDingWebHook; shop.SiNanDingDingWebHook = s2.SiNanDingDingWebHook;
shop.AppKey2 = s2.AppKey2;
shop.AppSecret2 = s2.AppSecret2;
shop.AppToken2 = s2.AppToken2;
} }
} }
} }

56
BBWY.Server.Business/Vender/VenderBusiness.cs

@ -54,22 +54,53 @@ namespace BBWY.Server.Business
public string AcceptJDShopToken(JDShopToken jDShopToken) public string AcceptJDShopToken(JDShopToken jDShopToken)
{ {
string appKey, appSecret;
Enums.AppKeyType appKeyType;
if (jDShopToken.State == "merp_1034059314253266944")
{
//订单Key
appKey = "120EA9EC65AB017567D78CC1139EEEA5";
appSecret = "8a42bc2301e8439b896e99f5475e0a9b";
appKeyType = Enums.AppKeyType.;
}
else if (jDShopToken.State == "merp_1058051655896924160")
{
//商品Key
appKey = "E1AA9247D5583A6D87449CE6AB290185";
appSecret = "e479558ddd9e40f8929cfc00c6cbbc9c";
appKeyType = Enums.AppKeyType.;
}
else
{
throw new BusinessException($"不识别的state {jDShopToken.State}");
}
var venderResponse = GetVenderInfo(new PlatformRequest() var venderResponse = GetVenderInfo(new PlatformRequest()
{ {
AppKey = "120EA9EC65AB017567D78CC1139EEEA5", AppKey = appKey,
AppSecret = "8a42bc2301e8439b896e99f5475e0a9b", AppSecret = appSecret,
AppToken = jDShopToken.AccessToken, AppToken = jDShopToken.AccessToken,
Platform = Enums.Platform. Platform = Enums.Platform.
}); });
_ = restApiService.SendRequest(globalConfig.MdsApi, "/TaskList/Shop/UpdateShop", new //_ = restApiService.SendRequest(globalConfig.MdsApi, "/TaskList/Shop/UpdateShop", new
//{
// venderResponse.ShopName,
// venderResponse.ShopId,
// ShopType = venderResponse.ColType,
// AppToken = jDShopToken.AccessToken,
// venderResponse.VenderId
//}, new Dictionary<string, string>() { { "qy", "qy" } }, HttpMethod.Post);
var shop = freeSqlMultiDBManager.MDSfsql.Select<Shops>().Where(s => s.ShopName == venderResponse.ShopName).ToOne();
if (shop == null)
throw new BusinessException($"未找到店铺 {venderResponse.ShopName}");
if (appKeyType == Enums.AppKeyType.)
{ {
venderResponse.ShopName, //freeSqlMultiDBManager.MDSfsql.Update<Shops>(shop.Id)
venderResponse.ShopId, }
ShopType = venderResponse.ColType,
AppToken = jDShopToken.AccessToken,
venderResponse.VenderId
}, new Dictionary<string, string>() { { "qy", "qy" } }, HttpMethod.Post);
return JsonConvert.SerializeObject(jDShopToken); return JsonConvert.SerializeObject(jDShopToken);
} }
@ -180,6 +211,9 @@ namespace BBWY.Server.Business
s.AppKey, s.AppKey,
s.AppSecret, s.AppSecret,
s.AppToken, s.AppToken,
s.AppKey2,
s.AppSecret2,
s.AppToken2,
s.ManagePwd, s.ManagePwd,
s.PlatformCommissionRatio, s.PlatformCommissionRatio,
s.PlatformId, s.PlatformId,
@ -207,6 +241,9 @@ namespace BBWY.Server.Business
AppKey = string.IsNullOrEmpty(x.AppKey) ? "120EA9EC65AB017567D78CC1139EEEA5" : x.AppKey, AppKey = string.IsNullOrEmpty(x.AppKey) ? "120EA9EC65AB017567D78CC1139EEEA5" : x.AppKey,
AppSecret = string.IsNullOrEmpty(x.AppSecret) ? "8a42bc2301e8439b896e99f5475e0a9b" : x.AppSecret, AppSecret = string.IsNullOrEmpty(x.AppSecret) ? "8a42bc2301e8439b896e99f5475e0a9b" : x.AppSecret,
AppToken = x.AppToken, AppToken = x.AppToken,
AppKey2 = x.AppKey2,
AppSecret2 = x.AppSecret2,
AppToken2 = x.AppToken2,
ManagePwd = x.ManagePwd, ManagePwd = x.ManagePwd,
PlatformId = (Enums.Platform)x.PlatformId, PlatformId = (Enums.Platform)x.PlatformId,
PlatformCommissionRatio = x.PlatformCommissionRatio, PlatformCommissionRatio = x.PlatformCommissionRatio,
@ -236,6 +273,7 @@ namespace BBWY.Server.Business
ShopId = pa.ShopId, ShopId = pa.ShopId,
PurchasePlatformId = (Enums.Platform)int.Parse(pa.PurchasePlatformId) PurchasePlatformId = (Enums.Platform)int.Parse(pa.PurchasePlatformId)
}); });
foreach (var d in departmentList) foreach (var d in departmentList)
{ {
foreach (var s in d.ShopList) foreach (var s in d.ShopList)

18
BBWY.Server.Model/Db/Mds/Shops.cs

@ -32,6 +32,24 @@ namespace BBWY.Server.Model.Db.Mds
public string AppToken { get; set; } public string AppToken { get; set; }
/// <summary>
/// 店铺Key 暂定商品管理Key
/// </summary>
public string AppKey2 { get; set; }
/// <summary>
/// 店铺Secret 暂定商品管理Secret
/// </summary>
public string AppSecret2 { get; set; }
/// <summary>
/// 店铺Token
/// </summary>
public string AppToken2 { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>

8
BBWY.Server.Model/Dto/Response/Vender/ShopResponse.cs

@ -30,12 +30,18 @@ namespace BBWY.Server.Model.Dto
public string AppToken { get; set; } public string AppToken { get; set; }
public string AppKey2 { get; set; }
public string AppSecret2 { get; set; }
public string AppToken2 { get; set; }
public string ManagePwd { get; set; } public string ManagePwd { get; set; }
public decimal? PlatformCommissionRatio { get; set; } public decimal? PlatformCommissionRatio { get; set; }
public IList<PurchaseAccountResponse> PurchaseList { get; set; } public IList<PurchaseAccountResponse> PurchaseList { get; set; }
/// <summary> /// <summary>
/// SKU库存安全周转天数 /// SKU库存安全周转天数
/// </summary> /// </summary>

8
BBWY.Server.Model/Enums.cs

@ -245,5 +245,13 @@
= 1, = 1,
= 2 = 2
} }
/// <summary>
/// AppKey类型 全类型 = 0, 订单管理 = 1, 商品管理 = 2
/// </summary>
public enum AppKeyType
{
= 0, = 1, = 2
}
} }
} }

11
BBWY.Test/Program.cs

@ -1,4 +1,6 @@
using Jd.Api; using Jd.Api;
using Jd.Api.Request;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -35,15 +37,14 @@ namespace BBWY.Test
//}).ToList(); //}).ToList();
//10023500913672 含赠品SPU
//10022515718131 需要进行赠品上架的SPU
IJdClient client = GetJdClient(appkey, appSecret); IJdClient client = GetJdClient(appkey, appSecret);
var test1 = new JDProductAPITest(); var test1 = new JDProductAPITest();
test1.GetPromotionById(client, token); test1.GetPromotionById(client, token);
//test1.ShangJiaTest(client, token);
//test1.修改属性别名(client, token); var venderJDResponse = client.Execute(new SellerVenderInfoGetRequest(), token, DateTime.Now.ToLocalTime());
//test1.QueryTouTu(client,token); Console.WriteLine(JsonConvert.SerializeObject(venderJDResponse));
Console.ReadKey(); Console.ReadKey();
} }
} }

Loading…
Cancel
Save