Skip to content

Commit

Permalink
新增 中台即时通讯服务端模板 ZhonTai.Template.IMServer
Browse files Browse the repository at this point in the history
  • Loading branch information
zhontai committed Dec 16, 2024
1 parent b454786 commit 7c24bdd
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/modules/admin/ZhonTai.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Savorboard.CAP.InMemoryMessageQueue;
using System;
using System.Reflection;
using Savorboard.CAP.InMemoryMessageQueue;
using ZhonTai.Admin.Core;
using ZhonTai.Admin.Core.Configs;
using ZhonTai.Admin.Core.Consts;
Expand Down Expand Up @@ -56,8 +56,8 @@
config.UseInMemoryStorage();
config.UseInMemoryMessageQueue();

//<PackageReference Include="DotNetCore.CAP.MySql" Version="7.1.1" />
//<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="7.1.1" />
//<PackageReference Include="DotNetCore.CAP.MySql" Version="8.3.2" />
//<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="8.3.2" />

//config.UseMySql(dbConfig.ConnectionString);
//config.UseRabbitMQ(mqConfig => {
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/content/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Admin项目模板说明
MyApp接口项目模板说明

*********************************************************

Expand All @@ -25,7 +25,7 @@ dotnet new install ZhonTai.Template
```
安装本地
```
dotnet new install F:\zhontai\Admin.Core\templates\ZhonTai.Template.3.7.1.nupkg
dotnet new install F:\zhontai\Admin.Core\templates\ZhonTai.Template.8.6.0.nupkg
```

### 创建项目
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/content/src/MyApp.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ void OnExecuting(TaskInfo task)
config.UseInMemoryStorage();
config.UseInMemoryMessageQueue();

//<PackageReference Include="DotNetCore.CAP.MySql" Version="8.0.0" />
//<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="8.0.0" />
//<PackageReference Include="DotNetCore.CAP.MySql" Version="8.3.2" />
//<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="8.3.2" />

//config.UseMySql(dbConfig.ConnectionString);
//config.UseRabbitMQ(mqConfig => {
Expand Down
4 changes: 2 additions & 2 deletions templates/admin/templates.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<!-- <license type="file">license\LICENSE</license> -->
<releaseNotes></releaseNotes>
<copyright>Copyright ©2020 zhontai</copyright>
<description>中台Admin模板,前后端分离的权限管理系统。支持多租户、数据权限、动态Api、任务调度、OSS文件上传、滑块拼图验证、国内外主流数据库自由切换和动态高级查询。集成统一认证授权、CAP事件总线、数据验证、分布式缓存、Ip限流、全Api鉴权、单元测试、性能分析、Swagger Api。</description>
<tags>ZhonTai Admin MyApp MVC WebApi Api Swagger</tags>
<description>中台接口模板</description>
<tags>ZhonTai MyApp MVC WebApi Api Swagger</tags>
<icon>logo.png</icon>
<packageTypes>
<packageType name="Template" />
Expand Down
18 changes: 18 additions & 0 deletions templates/im/content/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "xiao xue",
"classifications": [ "ZhonTai", "IM", "MyIMServer", "IMServer" ],
"name": "ZhonTai.Template MyIMServer",
"identity": "MyIMServer",
"shortName": "MyIMServer",
"tags": {
"language": "C#" ,
"type":"project"
},
"sourceName": "MyIMServer",
"preferNameDirectory": true,
"symbols": {
},
"sources": [
]
}
15 changes: 15 additions & 0 deletions templates/im/content/MyIMServer.Host/MyIMServer.Host.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup>
<NoWarn>1701;1702;1591;8632;CS8002;NU1902;NU1903;NU1904;</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FreeIM" Version="2.0.1" />
</ItemGroup>
</Project>
22 changes: 22 additions & 0 deletions templates/im/content/MyIMServer.Host/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Text;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

var app = builder.Build();
var configuration = app.Configuration;

// Configure the HTTP request pipeline.
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Console.OutputEncoding = Encoding.GetEncoding("GB2312");
Console.InputEncoding = Encoding.GetEncoding("GB2312");

app.UseFreeImServer(new ImServerOptions
{
Redis = new FreeRedis.RedisClient(configuration["ImServerOptions:RedisClient"]),
Servers = configuration["ImServerOptions:Servers"]?.Split(";"),
Server = configuration["ImServerOptions:Server"],
});

app.Run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"ImServer": {
"commandName": "Project",
"commandLineArgs": "--urls=http://*:6010"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
14 changes: 14 additions & 0 deletions templates/im/content/MyIMServer.Host/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ImServerOptions": {
"RedisClient": "127.0.0.1:6379,password=,poolsize=10,defaultDatabase=6",
"Servers": "127.0.0.1:6010",
"Server": "127.0.0.1:6010"
}
}
22 changes: 22 additions & 0 deletions templates/im/content/MyIMServer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35514.174 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyIMServer.Host", "MyIMServer.Host\MyIMServer.Host.csproj", "{F9009C41-125A-40F7-8740-BC72280D016E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F9009C41-125A-40F7-8740-BC72280D016E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9009C41-125A-40F7-8740-BC72280D016E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9009C41-125A-40F7-8740-BC72280D016E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9009C41-125A-40F7-8740-BC72280D016E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
39 changes: 39 additions & 0 deletions templates/im/content/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

MyIMServer即时通讯服务端项目模板说明

*********************************************************

### nuget下载地址
```
https://www.nuget.org/downloads
```
> `nuget.exe`放到 `F:\zhontai\Admin.Core\templates` 目录下
### 查看模板列表
```
dotnet new list
```

### 生成nuget包
`F:\zhontai\Admin.Core\templates` 目录下 cmd 执行以下命令生成nuget包
```
nuget pack F:\zhontai\Admin.Core\templates\im\templates.nuspec -NoDefaultExcludes
```
### 安装模板
```
dotnet new install ZhonTai.Template.IMServer
```
安装本地
```
dotnet new install F:\zhontai\Admin.Core\templates\ZhonTai.Template.IMServer.1.0.0.nupkg
```

### 创建项目
```
dotnet new MyIMServer -n MyCompanyName.IMServer
```

### 卸载模板
```
dotnet new uninstall ZhonTai.Template.IMServer
```
21 changes: 21 additions & 0 deletions templates/im/license/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 zhontai

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added templates/im/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions templates/im/templates.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ZhonTai.Template.IMServer</id>
<version>1.0.0</version>
<authors>xiao xue</authors>
<owners>zhon tai</owners>
<projectUrl>https://github.com/zhontai/Admin.Core</projectUrl>
<repository type="repository url" url="https://github.com/zhontai/Admin.Core" />
<license type="expression">MIT</license>
<!-- <license type="file">license\LICENSE</license> -->
<releaseNotes></releaseNotes>
<copyright>Copyright ©2020 zhontai</copyright>
<description>中台即时通讯服务端模板</description>
<tags>ZhonTai IM IMServer MyIMServer</tags>
<icon>logo.png</icon>
<packageTypes>
<packageType name="Template" />
</packageTypes>
</metadata>
<files>
$CommonFileElements$
<file
src="content/**"
exclude="**/node_modules/**;**/bin/**;**/obj/**;**/.vs/**;**/.vscode/**;**/ClientApp/dist/**;**/wwwroot/dist/**;content/Directory.Build.*"
target="" />
<file src="logo.png" target="" />
</files>
</package>

0 comments on commit 7c24bdd

Please sign in to comment.