Browse Source

10030

yijia
shanji 2 years ago
parent
commit
fc235ad6ad
  1. 58
      BBWYB.Client/APIServices/PurchaseProductAPIService.cs
  2. 23
      BBWYB.Client/GlobalContext.cs
  3. BIN
      BBWYB.Client/Resources/Images/bbwylogo.ico
  4. 2
      BBWYB.Client/ViewModels/MainViewModel.cs

58
BBWYB.Client/APIServices/PurchaseProductAPIService.cs

@ -25,6 +25,10 @@ namespace BBWYB.Client.APIServices
private IDictionary<string, string> _1688ProductDetailRequestHeader;
private List<int> _1688ColorPropertyFieldIdList;
private List<string> locationIdList;
private List<string> priceIdList;
public PurchaseProductAPIService(RestApiService restApiService, IMemoryCache memoryCache)
{
this.restApiService = restApiService;
@ -38,6 +42,10 @@ namespace BBWYB.Client.APIServices
{ "Accept-Language","zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"}
};
purchaseProductCacheTimeSpan = TimeSpan.FromDays(1);
_1688ColorPropertyFieldIdList = new List<int>() { 3216, 1627207, 1234, 3151, 7853, 446, 374, 404, 100019516, 3114, 2068 };
locationIdList = new List<string>() { "1081181309101", "16347413030323", "13772573013156" };
priceIdList = new List<string>() { "1081181309582", "1081181309582", "16347413030316", "13772573013151" };
}
public (Purchaser purchaser, IList<PurchaseSchemeProductSku> purchaseSchemeProductSkus)? GetProductInfo(Platform platform, string productId, string skuId, string purchaseProductId, PurchaseOrderMode priceMode, PurchaseProductAPIMode apiMode)
@ -186,31 +194,47 @@ namespace BBWYB.Client.APIServices
var jsonStr = match.Groups[2].Value;
var jobject = JObject.Parse(jsonStr);
var location = "";
for (var i = 0; i < locationIdList.Count(); i++)
{
if (jobject["data"][locationIdList[i]] != null)
{
location = jobject["data"][locationIdList[i]]["data"]["location"].ToString();
break;
}
}
//16347413030323
var purchaser = new Purchaser()
{
Id = jobject["globalData"]["tempModel"]["sellerUserId"].ToString(),
Id2 = jobject["globalData"]["tempModel"]["sellerLoginId"]?.ToString(),
Name = jobject["globalData"]["tempModel"]["companyName"].ToString(),
Location = jobject["data"]["1081181309101"] != null ?
jobject["data"]["1081181309101"]["data"]["location"].ToString() :
jobject["data"]["16347413030323"]["data"]["location"].ToString()
Location = location,
Platform = platform
};
var colorsProperty = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value<int>("fid") == 3216 ||
j.Value<int>("fid") == 1627207 ||
j.Value<int>("fid") == 1234 ||
j.Value<int>("fid") == 3151)["value"]
.Children()
.Select(j => new
{
name = j.Value<string>("name"),
imageUrl = j.Value<string>("imageUrl")
}).ToList();
var firstPrice = jobject["data"]["1081181309582"] != null ?
jobject["data"]["1081181309582"]["data"]["priceModel"]["currentPrices"][0].Value<decimal>("price") :
jobject["data"]["16347413030316"]["data"]["priceModel"]["currentPrices"][0].Value<decimal>("price");
var fidJToken = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => _1688ColorPropertyFieldIdList.Contains(j.Value<int>("fid")));
if (fidJToken == null)
fidJToken = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault(j => j.Value<string>("prop").Contains("颜色"));
if (fidJToken == null && jobject["globalData"]["skuModel"]["skuProps"].Children().Count() == 1)
fidJToken = jobject["globalData"]["skuModel"]["skuProps"].FirstOrDefault();
var colorsProperty = fidJToken["value"].Children()
.Select(j => new
{
name = j.Value<string>("name"),
imageUrl = j.Value<string>("imageUrl")
}).ToList();
var firstPrice = 0.0M;
for (var i = 0; i < priceIdList.Count(); i++)
{
if (jobject["data"][priceIdList[i]] != null)
{
firstPrice = jobject["data"][priceIdList[i]]["data"]["priceModel"]["currentPrices"][0].Value<decimal>("price");
break;
}
}
var purchaseSchemeProductSkus = new List<PurchaseSchemeProductSku>();

23
BBWYB.Client/GlobalContext.cs

@ -1,4 +1,5 @@
using BBWYB.Client.APIServices;
using BBWYB.Client.Helpers;
using BBWYB.Client.Models;
using BBWYB.Client.ViewModels;
using BBWYB.Client.Views.PackPurchaseTaska;
@ -7,6 +8,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Windows;
@ -20,7 +22,7 @@ namespace BBWYB.Client
{
public GlobalContext()
{
BBWYBApiVersion = "10029";
BBWYBApiVersion = "10030";
}
private User user;
@ -57,6 +59,25 @@ namespace BBWYB.Client
return BBWYBApiVersion;
}
public void CallALiWangWang(string sellerLoginId)
{
var url = $"aliim:sendmsg?siteid=cnalichn&portalId=&gid=&itemsId=&touid=cnalichn{sellerLoginId}&status=1";
try
{
//Process.Start("explorer.exe", url);
ShellExecuteHelper.ShellExecute(IntPtr.Zero, "open", url, string.Empty, string.Empty, ShellExecuteHelper.ShowCommands.SW_SHOWNORMAL);
}
catch (Exception ex)
{
try
{
Clipboard.SetText(url);
}
catch { }
MessageBox.Show($"{ex.Message}\r\n唤醒旺旺失败,唤醒链接已复制到剪切板,请手动打开浏览器唤醒", "提示");
}
}
/// <summary>
/// 对web版提供的修改打包任务方法
/// </summary>

BIN
BBWYB.Client/Resources/Images/bbwylogo.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 915 B

After

Width:  |  Height:  |  Size: 66 KiB

2
BBWYB.Client/ViewModels/MainViewModel.cs

@ -1,13 +1,11 @@
using BBWYB.Client.APIServices;
using BBWYB.Client.Models;
using BBWYB.Client.Views;
using BBWYB.Client.Views.SelectShop;
using BBWYB.Client.Views.WebB;
using BBWYB.Common.Extensions;
using BBWYB.Common.Models;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

Loading…
Cancel
Save