23 changed files with 887 additions and 4 deletions
@ -0,0 +1,55 @@ |
|||||
|
using Newtonsoft.Json; |
||||
|
using QYMessageCenter.Common.Http; |
||||
|
using QYMessageCenter.Common.Models; |
||||
|
using System.Net.Http; |
||||
|
namespace QYMessageCenter.Client.APIServices |
||||
|
{ |
||||
|
public class BaseApiService |
||||
|
{ |
||||
|
private RestApiService restApiService; |
||||
|
|
||||
|
protected GlobalContext globalContext; |
||||
|
|
||||
|
public BaseApiService(RestApiService restApiService, GlobalContext globalContext) |
||||
|
{ |
||||
|
this.restApiService = restApiService; |
||||
|
this.globalContext = globalContext; |
||||
|
} |
||||
|
|
||||
|
protected ApiResponse<T> SendRequest<T>(string apiHost, |
||||
|
string apiPath, |
||||
|
object param, |
||||
|
IDictionary<string, string> headers, |
||||
|
HttpMethod httpMethod, |
||||
|
string contentType = RestApiService.ContentType_Json, |
||||
|
ParamPosition paramPosition = ParamPosition.Body, |
||||
|
bool enableRandomTimeStamp = false) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
if (headers == null) |
||||
|
headers = new Dictionary<string, string>(); |
||||
|
//if (!headers.ContainsKey("ClientCode"))
|
||||
|
// headers.Add("ClientCode", "BBWYB");
|
||||
|
//if (!headers.ContainsKey("ClientVersion"))
|
||||
|
// headers.Add("ClientVersion", globalContext.BBWYBApiVersion);
|
||||
|
if (!headers.ContainsKey("Authorization") && !string.IsNullOrEmpty(globalContext.UserToken)) |
||||
|
headers.Add("Authorization", $"Bearer {globalContext.UserToken}"); |
||||
|
if (!headers.ContainsKey("qy")) |
||||
|
headers.Add("qy", "qy"); |
||||
|
|
||||
|
var result = restApiService.SendRequest(apiHost, apiPath, param, headers, httpMethod, contentType, paramPosition, enableRandomTimeStamp); |
||||
|
if (result.StatusCode != System.Net.HttpStatusCode.OK && |
||||
|
result.Content.Contains("\"Success\"") && |
||||
|
result.Content.Contains("\"Msg\"") && |
||||
|
result.Content.Contains("\"Data\"")) |
||||
|
throw new BusinessException($"{result.StatusCode} {result.Content}") { Code = (int)result.StatusCode }; |
||||
|
return JsonConvert.DeserializeObject<ApiResponse<T>>(result.Content); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
return ApiResponse<T>.Error((ex is BusinessException) ? (ex as BusinessException).Code : 0, ex.Message); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
using Newtonsoft.Json.Linq; |
||||
|
using QYMessageCenter.Client.Models; |
||||
|
using QYMessageCenter.Common.Http; |
||||
|
using QYMessageCenter.Common.Models; |
||||
|
using System.Net.Http; |
||||
|
|
||||
|
namespace QYMessageCenter.Client.APIServices |
||||
|
{ |
||||
|
public class MdsApiService : BaseApiService, IDenpendency |
||||
|
{ |
||||
|
private string mdsApi = "http://mdsapi.qiyue666.com"; |
||||
|
|
||||
|
public MdsApiService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public ApiResponse<MDSUserResponse> GetUserInfo(string userToken) |
||||
|
{ |
||||
|
return SendRequest<MDSUserResponse>(mdsApi, |
||||
|
"/TaskList/User/GetUserInfo", |
||||
|
null, |
||||
|
new Dictionary<string, string>() |
||||
|
{ |
||||
|
{ "Authorization", $"Bearer {userToken}" } |
||||
|
}, HttpMethod.Get); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ApiResponse<IList<Department>> GetShopDetailList() |
||||
|
{ |
||||
|
var response = new ApiResponse<IList<Department>>(); |
||||
|
var response2 = SendRequest<JArray>(mdsApi, "TaskList/UserDepartment/GetShopDetailList", null, null, HttpMethod.Get); |
||||
|
if (!response.Success) |
||||
|
{ |
||||
|
response.Code = response2.Code; |
||||
|
response.Msg = response2.Msg; |
||||
|
return response; |
||||
|
} |
||||
|
|
||||
|
response.Data = new List<Department>(); |
||||
|
foreach (var jDepartment in response2.Data) |
||||
|
{ |
||||
|
var jayShops = jDepartment.Value<JArray>("ShopList"); |
||||
|
if (jayShops == null || !jayShops.HasValues) |
||||
|
continue; //排除空店部门
|
||||
|
var d = new Department() |
||||
|
{ |
||||
|
Id = jDepartment.Value<string>("Id"), |
||||
|
Name = jDepartment.Value<string>("DepartmentName") |
||||
|
}; |
||||
|
response.Data.Add(d); |
||||
|
foreach (var jShop in jayShops) |
||||
|
{ |
||||
|
var shopId = jShop.Value<long?>("ShopId"); |
||||
|
if (shopId == null || string.IsNullOrEmpty(jShop.Value<string>("AppToken"))) |
||||
|
continue; //排除未授权
|
||||
|
try |
||||
|
{ |
||||
|
var jayAccounts = jShop.Value<JArray>("AccountList"); |
||||
|
if ((jayAccounts == null || !jayAccounts.HasValues) && d.ShopList.Count(s => s.ShopId == shopId) > 0) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
var shop = new Shop() |
||||
|
{ |
||||
|
ShopId = shopId.Value, |
||||
|
AppKey = jShop.Value<string>("AppKey"), |
||||
|
AppSecret = jShop.Value<string>("AppSecret"), |
||||
|
AppToken = jShop.Value<string>("AppToken"), |
||||
|
ManagePwd = jShop.Value<string>("ManagePwd"), |
||||
|
Platform = (Platform)jShop.Value<int>("PlatformId"), |
||||
|
PlatformCommissionRatio = jShop.Value<decimal?>("PlatformCommissionRatio") ?? 0.05M, |
||||
|
ShopName = jShop.Value<string>("ShopName"), |
||||
|
VenderType = jShop.Value<string>("ShopType"), |
||||
|
TeamId = jShop.Value<string>("TeamId") |
||||
|
}; |
||||
|
d.ShopList.Add(shop); |
||||
|
|
||||
|
shop.PurchaseAccountList = new List<PurchaseAccount>(); |
||||
|
foreach (var jPurchaseAccount in jayAccounts) |
||||
|
{ |
||||
|
shop.PurchaseAccountList.Add(new PurchaseAccount() |
||||
|
{ |
||||
|
Id = jPurchaseAccount.Value<long>("Id"), |
||||
|
AccountName = jPurchaseAccount.Value<string>("AccountName"), |
||||
|
AppKey = jPurchaseAccount.Value<string>("AppKey"), |
||||
|
AppSecret = jPurchaseAccount.Value<string>("AppSecret"), |
||||
|
AppToken = jPurchaseAccount.Value<string>("AppToken"), |
||||
|
ShopId = shop.ShopId, |
||||
|
PurchasePlatformId = (Platform)jPurchaseAccount.Value<int>("AppPlatformId") |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
Console.WriteLine(jShop.ToString()); |
||||
|
throw; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return response; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
using QYMessageCenter.Client.Models; |
||||
|
using QYMessageCenter.Common.Http; |
||||
|
using QYMessageCenter.Common.Models; |
||||
|
using System.Net.Http; |
||||
|
|
||||
|
namespace QYMessageCenter.Client.APIServices |
||||
|
{ |
||||
|
public class ShopService : BaseApiService |
||||
|
{ |
||||
|
private string bbwyhost = "http://bbwytest.qiyue666.com"; |
||||
|
|
||||
|
public ShopService(RestApiService restApiService, GlobalContext globalContext) : base(restApiService, globalContext) { } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取部门及下属店铺
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
public ApiResponse<IList<DepartmentResponse>> GetDepartmentList() |
||||
|
{ |
||||
|
return SendRequest<IList<DepartmentResponse>>(bbwyhost, "api/vender/GetDeparmentList", null, |
||||
|
new Dictionary<string, string>() |
||||
|
{ |
||||
|
{ "bbwyTempKey", "21jfhayu27q" } |
||||
|
}, HttpMethod.Get); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
<Application x:Class="QYMessageCenter.Client.App" |
||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:local="clr-namespace:QYMessageCenter.Client" |
||||
|
StartupUri="MainWindow.xaml"> |
||||
|
<Application.Resources> |
||||
|
|
||||
|
</Application.Resources> |
||||
|
</Application> |
@ -0,0 +1,70 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using QYMessageCenter.Client.APIServices; |
||||
|
using QYMessageCenter.Client.Helpers; |
||||
|
using QYMessageCenter.Client.Models; |
||||
|
using QYMessageCenter.Common.Extensions; |
||||
|
using QYMessageCenter.Common.Http; |
||||
|
using System.Configuration; |
||||
|
using System.Data; |
||||
|
using System.Windows; |
||||
|
|
||||
|
namespace QYMessageCenter.Client |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Interaction logic for App.xaml
|
||||
|
/// </summary>
|
||||
|
public partial class App : Application |
||||
|
{ |
||||
|
public IServiceProvider ServiceProvider { get; private set; } |
||||
|
|
||||
|
protected override void OnStartup(StartupEventArgs e) |
||||
|
{ |
||||
|
string userToken = string.Empty; |
||||
|
|
||||
|
#if DEBUG
|
||||
|
//齐越山鸡
|
||||
|
userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNzI2MzAwNjY0fQ.hPSbgJEuTt0MLy_7YkSJX4rRG3drJAfso-5IS8ZlOkY"; |
||||
|
#else
|
||||
|
|
||||
|
var tokenResult = ReadMMF(); |
||||
|
if (tokenResult.isOk) |
||||
|
userToken = tokenResult.content; |
||||
|
else |
||||
|
{ |
||||
|
MessageBox.Show($"读取内存数据失败\r\n{tokenResult.content}", "提示"); |
||||
|
Environment.Exit(0); |
||||
|
} |
||||
|
#endif
|
||||
|
|
||||
|
var gl = new GlobalContext(); |
||||
|
gl.UserToken = userToken; |
||||
|
IServiceCollection serviceCollection = new ServiceCollection(); |
||||
|
serviceCollection.AddHttpClient(); |
||||
|
serviceCollection.AddSingleton<RestApiService>(); |
||||
|
serviceCollection.AddSingleton<MdsApiService>(); |
||||
|
serviceCollection.AddSingleton<ShopService>(); |
||||
|
serviceCollection.AddSingleton(gl); |
||||
|
serviceCollection.AddMapper(new MappingProfile()); |
||||
|
ServiceProvider = serviceCollection.BuildServiceProvider(); |
||||
|
base.OnStartup(e); |
||||
|
} |
||||
|
|
||||
|
public (bool isOk, string content) ReadMMF() |
||||
|
{ |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
var token = MemoryHelper.GetMemoryToken(); |
||||
|
if (string.IsNullOrEmpty(token)) |
||||
|
return (false, "token为空"); |
||||
|
else |
||||
|
return (true, token); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
return (false, ex.Message); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -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,20 @@ |
|||||
|
using Newtonsoft.Json; |
||||
|
using QYMessageCenter.Client.Models; |
||||
|
using System.Runtime.InteropServices; |
||||
|
|
||||
|
namespace QYMessageCenter.Client |
||||
|
{ |
||||
|
[ClassInterface(ClassInterfaceType.AutoDual)] |
||||
|
[ComVisible(true)] |
||||
|
public class GlobalContext |
||||
|
{ |
||||
|
public User User { get; set; } |
||||
|
|
||||
|
public string UserToken { get; set; } |
||||
|
|
||||
|
public string GetUserString() |
||||
|
{ |
||||
|
return JsonConvert.SerializeObject(User); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
using System; |
||||
|
using System.IO; |
||||
|
using System.IO.Pipes; |
||||
|
|
||||
|
namespace QYMessageCenter.Client.Helpers |
||||
|
{ |
||||
|
public class MemoryHelper |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 获取token
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
public static string GetMemoryToken() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
string pipeId = Environment.GetCommandLineArgs()[1]; |
||||
|
//创建输入类型匿名管道
|
||||
|
using (PipeStream pipeClient = new AnonymousPipeClientStream(PipeDirection.In, pipeId)) |
||||
|
{ |
||||
|
using (StreamReader sr = new StreamReader(pipeClient)) |
||||
|
{ |
||||
|
string temp; |
||||
|
|
||||
|
do |
||||
|
{ |
||||
|
temp = sr.ReadLine(); |
||||
|
} |
||||
|
while (!temp.StartsWith("SYNC")); |
||||
|
|
||||
|
|
||||
|
while ((temp = sr.ReadLine()) != null) |
||||
|
{ |
||||
|
return temp; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return string.Empty; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
return string.Empty; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
<Window x:Class="QYMessageCenter.Client.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:QYMessageCenter.Client" |
||||
|
mc:Ignorable="d" |
||||
|
ShowInTaskbar="False" |
||||
|
Title="齐越消息中心" Height="450" Width="800"> |
||||
|
<Grid x:Name="grid"> |
||||
|
<TextBlock Text="正在初始化齐越消息中心" HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="2"/> |
||||
|
</Grid> |
||||
|
</Window> |
@ -0,0 +1,96 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Web.WebView2.Core; |
||||
|
using Microsoft.Web.WebView2.Wpf; |
||||
|
using QYMessageCenter.Client.APIServices; |
||||
|
using QYMessageCenter.Client.Models; |
||||
|
using QYMessageCenter.Common.Extensions; |
||||
|
using System.IO; |
||||
|
using System.Reflection; |
||||
|
using System.Text; |
||||
|
using System.Windows; |
||||
|
using io = System.IO; |
||||
|
namespace QYMessageCenter.Client |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Interaction logic for MainWindow.xaml
|
||||
|
/// </summary>
|
||||
|
public partial class MainWindow : Window |
||||
|
{ |
||||
|
private WebView2 wb2; |
||||
|
private MdsApiService mdsApiService; |
||||
|
private ShopService shopService; |
||||
|
private GlobalContext globalContext; |
||||
|
|
||||
|
public MainWindow() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
|
||||
|
var sp = (App.Current as App).ServiceProvider; |
||||
|
|
||||
|
using (var s = sp.CreateScope()) |
||||
|
{ |
||||
|
this.mdsApiService = s.ServiceProvider.GetRequiredService<MdsApiService>(); |
||||
|
this.shopService = s.ServiceProvider.GetRequiredService<ShopService>(); |
||||
|
this.globalContext = s.ServiceProvider.GetRequiredService<GlobalContext>(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
this.Loaded += MainWindow_Loaded; |
||||
|
} |
||||
|
|
||||
|
private async void MainWindow_Loaded(object sender, RoutedEventArgs e) |
||||
|
{ |
||||
|
wb2 = new WebView2(); |
||||
|
grid.Children.Add(wb2); |
||||
|
var wb2Setting = CoreWebView2Environment.CreateAsync(userDataFolder: io.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "QYMessageCenter.Client")).Result; |
||||
|
wb2.CoreWebView2InitializationCompleted += Wb2_CoreWebView2InitializationCompleted; |
||||
|
await wb2.EnsureCoreWebView2Async(wb2Setting); |
||||
|
//wb2.CoreWebView2.NavigateToString(html);
|
||||
|
} |
||||
|
|
||||
|
private void Wb2_CoreWebView2InitializationCompleted(object? sender, CoreWebView2InitializationCompletedEventArgs e) |
||||
|
{ |
||||
|
Login(); |
||||
|
wb2.CoreWebView2.AddHostObjectToScript("qymsgcenter", this.globalContext); |
||||
|
|
||||
|
var html = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "static", "index.html"), Encoding.UTF8); |
||||
|
wb2.CoreWebView2.NavigateToString(html); |
||||
|
this.Visibility = Visibility.Collapsed; |
||||
|
} |
||||
|
|
||||
|
private void Login() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
var mdsUserResponse = mdsApiService.GetUserInfo(globalContext.UserToken); |
||||
|
if (!mdsUserResponse.Success) |
||||
|
throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}"); |
||||
|
|
||||
|
globalContext.User = mdsUserResponse.Data.Map<User>(); |
||||
|
globalContext.User.Token = globalContext.UserToken; |
||||
|
globalContext.User.SonDepartmentNames = string.Empty; |
||||
|
//if (mdsUserResponse.Data.SonDepartmentList != null && mdsUserResponse.Data.SonDepartmentList.Count > 0)
|
||||
|
// globalContext.User.SonDepartmentNames = string.Join(',', mdsUserResponse.Data.SonDepartmentList.Select(sd => sd.DepartmentName));
|
||||
|
|
||||
|
var response = mdsApiService.GetShopDetailList(); |
||||
|
if (!response.Success) |
||||
|
throw new Exception(response.Msg); |
||||
|
var departmentList = response.Data; |
||||
|
if (departmentList.Count == 0) |
||||
|
throw new Exception("缺少有效的部门数据"); |
||||
|
|
||||
|
globalContext.User.DepartmentList = departmentList; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
|
||||
|
App.Current.Dispatcher.Invoke(() => |
||||
|
{ |
||||
|
MessageBox.Show(ex.Message, "登录失败"); |
||||
|
}); |
||||
|
Environment.Exit(Environment.ExitCode); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 电商平台
|
||||
|
/// </summary>
|
||||
|
public enum Platform |
||||
|
{ |
||||
|
淘宝 = 0, |
||||
|
京东 = 1, |
||||
|
阿里巴巴 = 2, |
||||
|
拼多多 = 3, |
||||
|
微信 = 4, |
||||
|
拳探 = 10 |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
using AutoMapper; |
||||
|
|
||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
public class MappingProfile : Profile |
||||
|
{ |
||||
|
public MappingProfile() |
||||
|
{ |
||||
|
|
||||
|
CreateMap<MDSUserResponse, User>().ForMember(t => t.TeamId, opt => opt.MapFrom(f => f.DepartmentId)) |
||||
|
.ForMember(t => t.TeamName, opt => opt.MapFrom(f => f.DepartmentName)) |
||||
|
.ForMember(t => t.Name, opt => opt.MapFrom(f => f.UserName)); |
||||
|
|
||||
|
CreateMap<ShopResponse, Shop>().ForMember(t => t.VenderType, opt => opt.MapFrom(f => f.ShopType)) |
||||
|
.ForMember(t => t.Platform, opt => opt.MapFrom(f => f.PlatformId)) |
||||
|
.ForMember(t => t.PurchaseAccountList, opt => opt.MapFrom(f => f.PurchaseList)); |
||||
|
|
||||
|
CreateMap<PurchaseAccountResponse, PurchaseAccount>(); |
||||
|
CreateMap<DepartmentResponse, Department>(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
public class Department |
||||
|
{ |
||||
|
|
||||
|
public string Id { get; set; } |
||||
|
|
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public IList<Shop> ShopList { get; set; } |
||||
|
|
||||
|
public Department() |
||||
|
{ |
||||
|
ShopList = new List<Shop>(); |
||||
|
} |
||||
|
|
||||
|
public override string ToString() |
||||
|
{ |
||||
|
return this.Name; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public class DepartmentResponse |
||||
|
{ |
||||
|
public string Id { get; set; } |
||||
|
|
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
public IList<ShopResponse> ShopList { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
public class PurchaseAccount :ICloneable |
||||
|
{ |
||||
|
|
||||
|
public long Id { get; set; } |
||||
|
|
||||
|
public long ShopId { get; set; } |
||||
|
public string AccountName { get; set; } |
||||
|
public Platform PurchasePlatformId { get; set; } |
||||
|
public string AppKey { get; set; } |
||||
|
public string AppSecret { get; set; } |
||||
|
public string AppToken { get; set; } |
||||
|
|
||||
|
public object Clone() |
||||
|
{ |
||||
|
return this.MemberwiseClone(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
using QYMessageCenter.Client.Models; |
||||
|
|
||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
public class PurchaseAccountResponse |
||||
|
{ |
||||
|
public long Id { get; set; } |
||||
|
|
||||
|
public string AccountName { get; set; } |
||||
|
|
||||
|
public long ShopId { get; set; } |
||||
|
|
||||
|
public Platform PurchasePlatformId { get; set; } |
||||
|
|
||||
|
public string AppKey { get; set; } |
||||
|
|
||||
|
public string AppSecret { get; set; } |
||||
|
|
||||
|
public string AppToken { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,129 @@ |
|||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
public class Shop |
||||
|
{ |
||||
|
private string shopName; |
||||
|
/// <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; set; } |
||||
|
|
||||
|
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; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public class ShopResponse |
||||
|
{ |
||||
|
public string Id { get; set; } |
||||
|
|
||||
|
public Platform PlatformId { get; set; } |
||||
|
|
||||
|
public long? ShopId { get; set; } |
||||
|
|
||||
|
public string ShopName { get; set; } |
||||
|
|
||||
|
public string ShopType { 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 IList<PurchaseAccountResponse> PurchaseList { get; set; } |
||||
|
|
||||
|
public string ManagePwd { get; set; } |
||||
|
|
||||
|
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; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
public class MDSUserResponse |
||||
|
{ |
||||
|
public long Id { get; set; } |
||||
|
public string DepartmentName { get; set; } |
||||
|
public string DepartmentId { get; set; } |
||||
|
|
||||
|
public string UserName { get; set; } |
||||
|
|
||||
|
public string UserNick { get; set; } |
||||
|
|
||||
|
public IList<DepartmentResponse2> SonDepartmentList { get; set; } |
||||
|
} |
||||
|
|
||||
|
public class DepartmentResponse2 |
||||
|
{ |
||||
|
public string DepartmentId { get; set; } |
||||
|
|
||||
|
public string DepartmentName { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
namespace QYMessageCenter.Client.Models |
||||
|
{ |
||||
|
public class User |
||||
|
{ |
||||
|
//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; set; } |
||||
|
|
||||
|
public IList<Department> DepartmentList { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 店铺列表
|
||||
|
/// </summary>
|
||||
|
public IList<Shop> ShopList { get; set; } |
||||
|
|
||||
|
public string Token { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<OutputType>WinExe</OutputType> |
||||
|
<TargetFramework>net6.0-windows</TargetFramework> |
||||
|
<Nullable>enable</Nullable> |
||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||
|
<UseWPF>true</UseWPF> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<None Remove="static\index.html" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Content Include="static\index.html"> |
||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||
|
</Content> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2277.86" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\QYMessageCenter.Common\QYMessageCenter.Common.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
@ -0,0 +1,53 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
|
||||
|
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> |
||||
|
<head> |
||||
|
<meta charset="utf-8" /> |
||||
|
<title></title> |
||||
|
<script src="https://cdn.goeasy.io/goeasy-2.11.1.min.js"></script> |
||||
|
</head> |
||||
|
<body> |
||||
|
<script> |
||||
|
|
||||
|
var hostOjbect = window.chrome.webview.hostObjects.sync.qymsgcenter; |
||||
|
var userString = hostOjbect.GetUserString(); |
||||
|
alert(userString); |
||||
|
//let goeasy = GoEasy.getInstance({ |
||||
|
// host: "hangzhou.goeasy.io", //若是新加坡区域:singapore.goeasy.io |
||||
|
// appkey: "BC-652c4236c6ba4083b026e8cfa2e199b1", |
||||
|
// modules: ['pubsub']//根据需要,传入‘pubsub’或'im’,或数组方式同时传入 |
||||
|
//}); |
||||
|
|
||||
|
////建立连接 |
||||
|
//goeasy.connect({ |
||||
|
// onSuccess: function () { //连接成功 |
||||
|
// console.log("GoEasy connect successfully.") //连接成功 |
||||
|
// subscribe(); |
||||
|
// }, |
||||
|
// onFailed: function (error) { //连接失败 |
||||
|
// console.log("Failed to connect GoEasy, code:" + error.code + ",error:" + error.content); |
||||
|
// }, |
||||
|
// onProgress: function (attempts) { //连接或自动重连中 |
||||
|
// console.log("GoEasy is connecting", attempts); |
||||
|
// } |
||||
|
//}); |
||||
|
|
||||
|
//function subscribe() { |
||||
|
// var pubsub = goeasy.pubsub; |
||||
|
// pubsub.subscribe({ |
||||
|
// channel: "my_channel",//替换为您自己的channel |
||||
|
// onMessage: function (message) { |
||||
|
// //收到消息 |
||||
|
// console.log("Channel:" + message.channel + " content:" + message.content); |
||||
|
// }, |
||||
|
// onSuccess: function () { |
||||
|
// console.log("Channel订阅成功。"); |
||||
|
// }, |
||||
|
// onFailed: function (error) { |
||||
|
// console.log("Channel订阅失败, 错误编码:" + error.code + " 错误信息:" + error.content) |
||||
|
// } |
||||
|
// }); |
||||
|
//} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,36 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk.Web"> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net6.0</TargetFramework> |
||||
|
<Nullable>enable</Nullable> |
||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<None Remove="SWDescription.txt" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Content Include="SWDescription.txt"> |
||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||
|
</Content> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="FreeSql" Version="3.2.812" /> |
||||
|
<PackageReference Include="FreeSql.Provider.MySql" Version="3.2.812" /> |
||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.27" /> |
||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.27" /> |
||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> |
||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> |
||||
|
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\QYMessageCenter.Business\QYMessageCenter.Business.csproj" /> |
||||
|
<ProjectReference Include="..\QYMessageCenter.Common\QYMessageCenter.Common.csproj" /> |
||||
|
<ProjectReference Include="..\QYMessageCenter.Model\QYMessageCenter.Model.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
Loading…
Reference in new issue