Browse Source

完善初始化页

master
shanji 1 year ago
parent
commit
71832d83d4
  1. 55
      QYMessageCenter.Client/APIServices/BaseApiService.cs
  2. 106
      QYMessageCenter.Client/APIServices/MdsApiService.cs
  3. 28
      QYMessageCenter.Client/APIServices/ShopService.cs
  4. 9
      QYMessageCenter.Client/App.xaml
  5. 70
      QYMessageCenter.Client/App.xaml.cs
  6. 10
      QYMessageCenter.Client/AssemblyInfo.cs
  7. 20
      QYMessageCenter.Client/GlobalContext.cs
  8. 49
      QYMessageCenter.Client/Helpers/MemoryHelper.cs
  9. 13
      QYMessageCenter.Client/MainWindow.xaml
  10. 96
      QYMessageCenter.Client/MainWindow.xaml.cs
  11. 15
      QYMessageCenter.Client/Models/Enums.cs
  12. 22
      QYMessageCenter.Client/Models/MappingProfile.cs
  13. 33
      QYMessageCenter.Client/Models/Shop/Department.cs
  14. 20
      QYMessageCenter.Client/Models/Shop/PurchaseAccount.cs
  15. 21
      QYMessageCenter.Client/Models/Shop/PurchaseAccountResponse.cs
  16. 129
      QYMessageCenter.Client/Models/Shop/Shop.cs
  17. 22
      QYMessageCenter.Client/Models/User/MDSUserResponse.cs
  18. 31
      QYMessageCenter.Client/Models/User/User.cs
  19. 29
      QYMessageCenter.Client/QYMessageCenter.Client.csproj
  20. 53
      QYMessageCenter.Client/static/index.html
  21. 2
      QYMessageCenter.Model/DB/QYNotification.cs
  22. 22
      QYMessageCenter.sln
  23. 36
      QYMessageCenter/QYMessageCenter.API.csproj

55
QYMessageCenter.Client/APIServices/BaseApiService.cs

@ -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);
}
}
}
}

106
QYMessageCenter.Client/APIServices/MdsApiService.cs

@ -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;
}
}
}

28
QYMessageCenter.Client/APIServices/ShopService.cs

@ -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);
}
}
}

9
QYMessageCenter.Client/App.xaml

@ -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>

70
QYMessageCenter.Client/App.xaml.cs

@ -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);
}
}
}
}

10
QYMessageCenter.Client/AssemblyInfo.cs

@ -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)
)]

20
QYMessageCenter.Client/GlobalContext.cs

@ -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);
}
}
}

49
QYMessageCenter.Client/Helpers/MemoryHelper.cs

@ -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;
}
}
}
}

13
QYMessageCenter.Client/MainWindow.xaml

@ -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>

96
QYMessageCenter.Client/MainWindow.xaml.cs

@ -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);
}
}
}
}

15
QYMessageCenter.Client/Models/Enums.cs

@ -0,0 +1,15 @@
namespace QYMessageCenter.Client.Models
{
/// <summary>
/// 电商平台
/// </summary>
public enum Platform
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 10
}
}

22
QYMessageCenter.Client/Models/MappingProfile.cs

@ -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>();
}
}
}

33
QYMessageCenter.Client/Models/Shop/Department.cs

@ -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; }
}
}

20
QYMessageCenter.Client/Models/Shop/PurchaseAccount.cs

@ -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();
}
}
}

21
QYMessageCenter.Client/Models/Shop/PurchaseAccountResponse.cs

@ -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; }
}
}

129
QYMessageCenter.Client/Models/Shop/Shop.cs

@ -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; }
}
}

22
QYMessageCenter.Client/Models/User/MDSUserResponse.cs

@ -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; }
}
}

31
QYMessageCenter.Client/Models/User/User.cs

@ -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; }
}
}

29
QYMessageCenter.Client/QYMessageCenter.Client.csproj

@ -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>

53
QYMessageCenter.Client/static/index.html

@ -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>

2
QYMessageCenter.Model/DB/QYNotification.cs

@ -37,7 +37,7 @@ namespace QYMessageCenter.Model.DB
/// <summary>
/// 消息内容
/// </summary>
[Column(StringLength = 500)]
[Column(StringLength = 2800)]
public string Content { get; set; }
[Column(DbType = "datetime")]

22
QYMessageCenter.sln

@ -5,11 +5,17 @@ VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QYMessageCenter", "QYMessageCenter\QYMessageCenter.csproj", "{2EA5C5B7-A4AD-4841-9CBD-3D1039ED1355}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QYMessageCenter.Business", "QYMessageCenter.Business\QYMessageCenter.Business.csproj", "{17CB9C4E-4008-4E5A-98B2-40B666922CE1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QYMessageCenter.Business", "QYMessageCenter.Business\QYMessageCenter.Business.csproj", "{17CB9C4E-4008-4E5A-98B2-40B666922CE1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QYMessageCenter.Model", "QYMessageCenter.Model\QYMessageCenter.Model.csproj", "{91F9B6F7-EB22-42AE-80A9-0FF427B055A6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QYMessageCenter.Model", "QYMessageCenter.Model\QYMessageCenter.Model.csproj", "{91F9B6F7-EB22-42AE-80A9-0FF427B055A6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QYMessageCenter.Common", "QYMessageCenter.Common\QYMessageCenter.Common.csproj", "{3414DE6F-7D25-4A09-892E-3A359101EB44}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QYMessageCenter.Common", "QYMessageCenter.Common\QYMessageCenter.Common.csproj", "{3414DE6F-7D25-4A09-892E-3A359101EB44}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{F23D8876-9ED2-4EC1-9856-0E6AC3E58072}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{DFE55D4D-6A43-4158-AB78-7B36D0DB351B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QYMessageCenter.Client", "QYMessageCenter.Client\QYMessageCenter.Client.csproj", "{D5998DAB-6517-42EB-A604-BF88C189F1B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -33,10 +39,20 @@ Global
{3414DE6F-7D25-4A09-892E-3A359101EB44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3414DE6F-7D25-4A09-892E-3A359101EB44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3414DE6F-7D25-4A09-892E-3A359101EB44}.Release|Any CPU.Build.0 = Release|Any CPU
{D5998DAB-6517-42EB-A604-BF88C189F1B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5998DAB-6517-42EB-A604-BF88C189F1B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5998DAB-6517-42EB-A604-BF88C189F1B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5998DAB-6517-42EB-A604-BF88C189F1B4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2EA5C5B7-A4AD-4841-9CBD-3D1039ED1355} = {F23D8876-9ED2-4EC1-9856-0E6AC3E58072}
{17CB9C4E-4008-4E5A-98B2-40B666922CE1} = {F23D8876-9ED2-4EC1-9856-0E6AC3E58072}
{91F9B6F7-EB22-42AE-80A9-0FF427B055A6} = {F23D8876-9ED2-4EC1-9856-0E6AC3E58072}
{D5998DAB-6517-42EB-A604-BF88C189F1B4} = {DFE55D4D-6A43-4158-AB78-7B36D0DB351B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F8628884-5171-4D3A-9A40-9C788CBA7EEB}
EndGlobalSection

36
QYMessageCenter/QYMessageCenter.API.csproj

@ -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…
Cancel
Save