15 changed files with 439 additions and 1 deletions
@ -0,0 +1,9 @@ |
|||
<Application x:Class="PJZS.App" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:local="clr-namespace:PJZS" |
|||
StartupUri="MainWindow.xaml"> |
|||
<Application.Resources> |
|||
|
|||
</Application.Resources> |
|||
</Application> |
@ -0,0 +1,37 @@ |
|||
using System.Windows; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
/// <summary>
|
|||
/// Interaction logic for App.xaml
|
|||
/// </summary>
|
|||
public partial class App : Application |
|||
{ |
|||
protected override void OnStartup(StartupEventArgs e) |
|||
{ |
|||
var gl = new GlobalContext(); |
|||
string userToken = string.Empty; |
|||
#if DEBUG
|
|||
//齐越山鸡
|
|||
userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; |
|||
#else
|
|||
var uid = e.Args.Count() > 0 ? e.Args.LastOrDefault(args => args.StartsWith("uid:")) : string.Empty; |
|||
if (string.IsNullOrEmpty(uid)) |
|||
{ |
|||
MessageBox.Show("缺少启动参数", "提示"); |
|||
Environment.Exit(0); |
|||
} |
|||
var tokenResult = ReadMMF(uid); |
|||
if (tokenResult.isOk) |
|||
userToken = tokenResult.content; |
|||
else |
|||
{ |
|||
MessageBox.Show($"读取内存数据失败\r\n{tokenResult.content}", "提示"); |
|||
Environment.Exit(0); |
|||
} |
|||
#endif
|
|||
gl.UserToken = userToken; |
|||
base.OnStartup(e); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
using System.Windows; |
|||
|
|||
[assembly: ThemeInfo( |
|||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
|||
//(used if a resource is not found in the page,
|
|||
// or application resource dictionaries)
|
|||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
|||
//(used if a resource is not found in the page,
|
|||
// app, or any theme specific resource dictionaries)
|
|||
)] |
@ -0,0 +1,22 @@ |
|||
namespace PJZS |
|||
{ |
|||
public class GlobalContext : NotifyObject |
|||
{ |
|||
private User user; |
|||
|
|||
public User User { get => user; set { Set(ref user, value); } } |
|||
|
|||
public string UserToken { get; set; } |
|||
|
|||
|
|||
#region APIHost
|
|||
public string BBYWApiHost { get; set; } |
|||
|
|||
public string MDSApiHost { get; set; } |
|||
|
|||
public string JOSApiHost { get; set; } |
|||
|
|||
public string _1688ApiHost { get; set; } |
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
<Window x:Class="PJZS.MainWindow" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:PJZS" |
|||
mc:Ignorable="d" |
|||
Title="MainWindow" Height="450" Width="800"> |
|||
<Grid> |
|||
|
|||
</Grid> |
|||
</Window> |
@ -0,0 +1,28 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Navigation; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
/// <summary>
|
|||
/// Interaction logic for MainWindow.xaml
|
|||
/// </summary>
|
|||
public partial class MainWindow : Window |
|||
{ |
|||
public MainWindow() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace PJZS.Models |
|||
{ |
|||
/// <summary>
|
|||
/// 电商平台
|
|||
/// </summary>
|
|||
public enum Platform |
|||
{ |
|||
淘宝 = 0, |
|||
京东 = 1, |
|||
阿里巴巴 = 2, |
|||
拼多多 = 3, |
|||
微信 = 4 |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
using System.ComponentModel; |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
public class NotifyObject : INotifyPropertyChanged |
|||
{ |
|||
public event PropertyChangedEventHandler PropertyChanged; |
|||
protected void OnPropertyChanged([CallerMemberName]string propertyName = "") |
|||
{ |
|||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|||
} |
|||
|
|||
protected bool Set<T>(ref T oldValue, T newValue, [CallerMemberName]string propertyName = "") |
|||
{ |
|||
if (Equals(oldValue, newValue)) |
|||
return false; |
|||
oldValue = newValue; |
|||
OnPropertyChanged(propertyName); |
|||
return true; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
public class Department : NotifyObject |
|||
{ |
|||
private bool isSelected; |
|||
|
|||
public string Id { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public IList<Shop> ShopList { get; set; } |
|||
public bool IsSelected |
|||
{ |
|||
get => isSelected; |
|||
set |
|||
{ |
|||
if (Set(ref isSelected, value)) |
|||
OnIsSelectedChanged?.Invoke(); |
|||
} |
|||
} |
|||
|
|||
public Department() |
|||
{ |
|||
ShopList = new List<Shop>(); |
|||
} |
|||
|
|||
public Action OnIsSelectedChanged { get; set; } |
|||
|
|||
public override string ToString() |
|||
{ |
|||
return this.Name; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
using PJZS.Models; |
|||
using System; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
public class PurchaseAccount : NotifyObject,ICloneable |
|||
{ |
|||
private string accountName; |
|||
private Platform purchasePlatformId; |
|||
private string appKey; |
|||
private string appSecret; |
|||
private string appToken; |
|||
|
|||
public long Id { get; set; } |
|||
|
|||
public long ShopId { get; set; } |
|||
public string AccountName { get => accountName; set { Set(ref accountName, value); } } |
|||
public Platform PurchasePlatformId { get => purchasePlatformId; set { Set(ref purchasePlatformId, value); } } |
|||
public string AppKey { get => appKey; set { Set(ref appKey, value); } } |
|||
public string AppSecret { get => appSecret; set { Set(ref appSecret, value); } } |
|||
public string AppToken { get => appToken; set { Set(ref appToken, value); } } |
|||
|
|||
public object Clone() |
|||
{ |
|||
return this.MemberwiseClone(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,79 @@ |
|||
using PJZS.Models; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
public class Shop : NotifyObject |
|||
{ |
|||
private bool isSelected; |
|||
private string shopName; |
|||
|
|||
public bool IsSelected { get => isSelected; set { Set(ref isSelected, value); } } |
|||
/// <summary>
|
|||
/// 店铺Id
|
|||
/// </summary>
|
|||
public long ShopId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商家类型
|
|||
/// </summary>
|
|||
public string VenderType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺平台
|
|||
/// </summary>
|
|||
public Platform Platform { get; set; } |
|||
|
|||
public string AppKey { get; set; } |
|||
|
|||
public string AppSecret { 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 IList<PurchaseAccount> PurchaseAccountList { get; set; } |
|||
|
|||
public string ManagePwd { get; set; } |
|||
/// <summary>
|
|||
/// 店铺扣点
|
|||
/// </summary>
|
|||
public decimal? PlatformCommissionRatio { get; set; } |
|||
|
|||
public string TeamId { get; set; } |
|||
|
|||
public string TeamName { get; set; } |
|||
|
|||
public string DingDingWebHook { get; set; } |
|||
|
|||
public string DingDingKey { get; set; } |
|||
|
|||
public int SkuSafeTurnoverDays { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南策略等级
|
|||
/// </summary>
|
|||
public int SiNanPolicyLevel { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南钉钉WebHook地址
|
|||
/// </summary>
|
|||
public string SiNanDingDingWebHook { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 司南钉钉密钥
|
|||
/// </summary>
|
|||
public string SiNanDingDingKey { get; set; } |
|||
|
|||
public override string ToString() |
|||
{ |
|||
return ShopName; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
public class User : NotifyObject |
|||
{ |
|||
//private string name;
|
|||
|
|||
private Shop shop; |
|||
|
|||
public long Id { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string TeamId { get; set; } |
|||
|
|||
public string TeamName { get; set; } |
|||
|
|||
public string SonDepartmentNames { get; set; } |
|||
|
|||
public Shop Shop { get => shop; set { Set(ref shop, value); } } |
|||
|
|||
public IList<Department> DepartmentList { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 店铺列表 (暂时只有刷单组才需要)
|
|||
/// </summary>
|
|||
public IList<Shop> ShopList { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>WinExe</OutputType> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<UseWPF>true</UseWPF> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" /> |
|||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" /> |
|||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" /> |
|||
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" /> |
|||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1150.38" /> |
|||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.37" /> |
|||
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" /> |
|||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\BBWY.Common\BBWY.Common.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Folder Include="Models\APIModel\" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
@ -0,0 +1,69 @@ |
|||
using BBWY.Common.Models; |
|||
using Microsoft.Web.WebView2.Core; |
|||
using Microsoft.Web.WebView2.Wpf; |
|||
using System; |
|||
using io = System.IO; |
|||
|
|||
namespace PJZS |
|||
{ |
|||
public class WebView2Manager : IDenpendency |
|||
{ |
|||
public WebView2 wb2 { get; private set; } |
|||
//public WebView2Manager()
|
|||
//{
|
|||
// Init();
|
|||
//}
|
|||
public void Init() |
|||
{ |
|||
if (wb2 == null) |
|||
{ |
|||
wb2 = new WebView2(); |
|||
var wb2Setting = CoreWebView2Environment.CreateAsync(userDataFolder: io.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WebView2UserData")).Result; |
|||
wb2.EnsureCoreWebView2Async(wb2Setting); |
|||
wb2.CoreWebView2InitializationCompleted += Wb2_CoreWebView2InitializationCompleted; |
|||
wb2.NavigationCompleted += Wb2_NavigationCompleted; |
|||
wb2.WebMessageReceived += Wb2_WebMessageReceived; |
|||
} |
|||
} |
|||
|
|||
public Action<CoreWebView2WebMessageReceivedEventArgs> OnWebMessageReceived; |
|||
public Action<CoreWebView2NavigationCompletedEventArgs> OnNavigationCompleted; |
|||
public Action<CoreWebView2InitializationCompletedEventArgs> CoreWebView2InitializationCompleted; |
|||
public bool IsInitializationCompleted { get ; private set; } |
|||
|
|||
private void Wb2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e) |
|||
{ |
|||
OnWebMessageReceived?.Invoke(e); |
|||
} |
|||
|
|||
private void Wb2_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e) |
|||
{ |
|||
OnNavigationCompleted?.Invoke(e); |
|||
} |
|||
|
|||
private void Wb2_CoreWebView2InitializationCompleted(object sender, CoreWebView2InitializationCompletedEventArgs e) |
|||
{ |
|||
CoreWebView2InitializationCompleted?.Invoke(e); |
|||
IsInitializationCompleted = true; |
|||
} |
|||
|
|||
public void Close() |
|||
{ |
|||
if (wb2 != null && wb2.CoreWebView2 != null) |
|||
{ |
|||
IsInitializationCompleted = false; |
|||
wb2.CoreWebView2InitializationCompleted -= Wb2_CoreWebView2InitializationCompleted; |
|||
wb2.NavigationCompleted -= Wb2_NavigationCompleted; |
|||
wb2.WebMessageReceived -= Wb2_WebMessageReceived; |
|||
var udf = wb2.CoreWebView2.Environment.UserDataFolder; |
|||
wb2.Dispose(); |
|||
wb2 = null; |
|||
try |
|||
{ |
|||
io.Directory.Delete(udf, true); |
|||
} |
|||
catch { } |
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue