Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developer #2095

Merged
merged 4 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Senparc.Weixin.Sample.NetCore3.Models;
using Senparc.Weixin.Sample.NetCore3.Models.VD;

namespace Senparc.Weixin.Sample.NetCore3.Controllers
{
Expand All @@ -52,31 +53,88 @@ public HomeController(ILogger<HomeController> logger, IHostingEnvironment env)

public IActionResult Index()
{
Func<Version, string> getDisplayVersion = version =>
Regex.Match(version.ToString(), @"\d+\.\d+\.\d+").Value;

Func<Type, string> getTypeVersionInfo = type =>

var vd = new Home_IndexVD()
{
var version = System.Reflection.Assembly.GetAssembly(type).GetName().Version;
return getDisplayVersion(version);
AssemblyModelCollection = new Dictionary<Home_IndexVD_GroupInfo, List<Home_IndexVD_AssemblyModel>>()
};

TempData["SampleVersion"] = getTypeVersionInfo(this.GetType());//当前Demo的版本号
TempData["CO2NETVersion"] = getTypeVersionInfo(typeof(CO2NET.Config));//CO2NET版本号
TempData["NeuCharVersion"] = getTypeVersionInfo(typeof(Senparc.NeuChar.ApiBindInfo));//NeuChar版本号

TempData["WeixinVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.Config));
TempData["TenPayVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.TenPay.Register));//DPBMARK TenPay DPBMARK_END
TempData["MpVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.MP.Register));//DPBMARK MP DPBMARK_END
TempData["ExtensionVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.MP.MvcExtension.FixWeixinBugWeixinResult));//DPBMARK MP DPBMARK_END
TempData["OpenVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.Open.Register));//DPBMARK Open DPBMARK_END
//Senparc.Weixin SDK
var gitHubUrl = "https://github.com/JeffreySu/WeiXinMPSDK";
var sdkGroup = new Home_IndexVD_GroupInfo()
{
Title = "Senparc.Weixin SDK",
Description="对应于每一个微信平台的基础 SDK,包含了目前微信平台的绝大部分 API,进行微信开发重点是对这些库的使用。"
};
var sdkList = new List<Home_IndexVD_AssemblyModel>();
sdkList.Add(new Home_IndexVD_AssemblyModel("SDK 公共基础库", "Senparc.Weixin", this.GetType(),gitHubUrl: gitHubUrl));
sdkList.Add(new Home_IndexVD_AssemblyModel("微信支付", "Senparc.Weixin.TenPay", typeof(Senparc.Weixin.Config), gitHubUrl: gitHubUrl));
sdkList.Add(new Home_IndexVD_AssemblyModel("公众号<br />JSSDK<br />摇一摇周边", "Senparc.Weixin.MP", typeof(Senparc.Weixin.Config), gitHubUrl: gitHubUrl));//DPBMARK TenPay DPBMARK_END
sdkList.Add(new Home_IndexVD_AssemblyModel("公众号MvcExtension", "Senparc.Weixin.MP.MvcExtension", typeof(Senparc.Weixin.MP.Register), "Senparc.Weixin.MP.Mvc", gitHubUrl: gitHubUrl));//DPBMARK MP DPBMARK_END
sdkList.Add(new Home_IndexVD_AssemblyModel("小程序", "Senparc.Weixin.WxOpen", typeof(Senparc.Weixin.WxOpen.Register), gitHubUrl: gitHubUrl));//DPBMARK MiniProgram DPBMARK_END
sdkList.Add(new Home_IndexVD_AssemblyModel("微信支付", "Senparc.Weixin.TenPay", typeof(Senparc.Weixin.MP.MvcExtension.FixWeixinBugWeixinResult), gitHubUrl: gitHubUrl));//DPBMARK MP DPBMARK_END
sdkList.Add(new Home_IndexVD_AssemblyModel("开放平台", "Senparc.Weixin.Open", typeof(Senparc.Weixin.Open.Register), gitHubUrl: gitHubUrl));//DPBMARK Open DPBMARK_END
//TempData["QYVersion"] = getDisplayVersion(getFileVersionInfo("Senparc.Weixin.QY.dll"));//已经停止更新
TempData["WorkVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.Work.Register));//DPBMARK Work DPBMARK_END
TempData["RedisCacheVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.Cache.Redis.Register));//DPBMARK Redis DPBMARK_END
TempData["CsRedisCacheVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.Cache.CsRedis.Register));//DPBMARK Redis DPBMARK_END
TempData["MemcachedCacheVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.Cache.Memcached.Register));//DPBMARK Memcached DPBMARK_END
TempData["WxOpenVersion"] = getTypeVersionInfo(typeof(Senparc.Weixin.WxOpen.Register));//DPBMARK MiniProgram DPBMARK_END
TempData["WebSocketVersion"] = getTypeVersionInfo(typeof(Senparc.WebSocket.WebSocketConfig));//DPBMARK WebSocket DPBMARK_END
sdkList.Add(new Home_IndexVD_AssemblyModel("企业微信", "Senparc.Weixin.Work", typeof(Senparc.Weixin.Work.Register), gitHubUrl: gitHubUrl));//DPBMARK Work DPBMARK_END
vd.AssemblyModelCollection[sdkGroup] = sdkList;


var aspnetGroup = new Home_IndexVD_GroupInfo()
{
Title = "Senparc.Weixin SDK 的 ASP.NET 运行时基础库",
Description = "这些库基于 ASP.NET 运行时,依赖 ASP.NET 一些特性完成一系列基于 ASP.NET 及 ASP.NET Core 的操作。<br />" +
"分离出这些库的另外一个原因,是为了使 Senparc.Weixin SDK 核心库可以不依赖于 ASP.NET 运行时,以便部署在轻量级的容器等环境中。"
};
var aspnetList = new List<Home_IndexVD_AssemblyModel>();
aspnetList.Add(new Home_IndexVD_AssemblyModel("ASP.NET<br />运行时基础库", "Senparc.Weixin.AspNet", typeof(Senparc.Weixin.AspNet.WeixinRegister)));//AspNet 运行时基础库
aspnetList.Add(new Home_IndexVD_AssemblyModel("公众号消息中间件", "Senparc.Weixin.MP.Middleware", typeof(Senparc.Weixin.MP.MessageHandlers.Middleware.MessageHandlerMiddlewareExtension)));//DPBMARK MP DPBMARK_END
aspnetList.Add(new Home_IndexVD_AssemblyModel("小程序消息中间件", "Senparc.Weixin.WxOpen.Middleware", typeof(Senparc.Weixin.WxOpen.MessageHandlers.Middleware.MessageHandlerMiddlewareExtension)));//DPBMARK MiniProgram DPBMARK_END
aspnetList.Add(new Home_IndexVD_AssemblyModel("企业微信消息中间件", "Senparc.Weixin.Work.Middleware", typeof(Senparc.Weixin.Work.MessageHandlers.Middleware.MessageHandlerMiddlewareExtension)));//DPBMARK Work DPBMARK_END
vd.AssemblyModelCollection[aspnetGroup] = aspnetList;

var cacheAndExtensionGroup = new Home_IndexVD_GroupInfo()
{
Title = "Senparc.Weixin SDK 扩展组件",
Description = "Senparc.Weixin SDK 扩展组件用于提供缓存、WebSocket 等一系列扩展模块,<br />" +
"这些模块是盛派官方的一个实现,几乎所有的扩展模块都是严格面向接口开发的,<br />" +
"因此,您也可以自行扩展,并对接到微信 SDK 或其他系统中,<br />"
};
var cacheAndExtensionList = new List<Home_IndexVD_AssemblyModel>();
cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("Redis 缓存<br />(StackExchange.Redis)", "Senparc.Weixin.Cache.Redis", typeof(Senparc.Weixin.Cache.Redis.Register)));//DPBMARK Redis DPBMARK_END
cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("Redis 缓存<br />(CsRedis)", "Senparc.Weixin.Cache.CsRedis", typeof(Senparc.Weixin.Cache.CsRedis.Register)));//DPBMARK CsRedis DPBMARK_END
cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("Memcached 缓存", "Senparc.Weixin.Cache.Memcached", typeof(Senparc.Weixin.Cache.Memcached.Register)));//DPBMARK Memcached DPBMARK_END
cacheAndExtensionList.Add(new Home_IndexVD_AssemblyModel("WebSocket 模块", "Senparc.WebSocket", typeof(Senparc.WebSocket.WebSocketConfig)));//DPBMARK WebSocket DPBMARK_END
vd.AssemblyModelCollection[cacheAndExtensionGroup] = cacheAndExtensionList;

var neucharGroup = new Home_IndexVD_GroupInfo()
{
Title = "跨平台支持库:Senparc.NeuChar",
Description = "NeuChar 是盛派提供的一套跨平台服务的标准(例如跨微信公众号、微信小程序、丁丁、QQ小程序、百度小程序,等等),<br />" +
"使用一套代码,同时服务多平台。目前 Senparc.Weixin SDK 就是基于 NeuChar 标准在微信领域内的一个实现分支,<br />" +
"您也可以使用 NeuChar 扩展到更多的平台。<br />" +
"<a href=\"https://www.neuchar.com\" target=\"_blank\">https://www.neuchar.com</a> 是盛派官方提供的一个基于 NeuChar 标准实现的可视化跨平台配置操作平台。"
};
var neucharList = new List<Home_IndexVD_AssemblyModel>();
neucharList.Add(new Home_IndexVD_AssemblyModel("NeuChar 跨平台支持库", "Senparc.NeuChar", typeof(Senparc.NeuChar.ApiBindInfo)));// NeuChar 基础库
neucharList.Add(new Home_IndexVD_AssemblyModel("NeuChar APP 以及<br />NeuChar Ending<br />的对接 SDK", "Senparc.NeuChar.App", typeof(Senparc.NeuChar.App.HttpRequestType)));// NeuChar 基础库
vd.AssemblyModelCollection[neucharGroup] = neucharList;

var co2netGroup = new Home_IndexVD_GroupInfo()
{
Title = "底层公共基础库:Senparc.CO2NET",
Description = "Senparc.CO2NET 是一个支持 .NET Framework 和 .NET Core 的公共基础扩展库,包含常规开发所需要的基础帮助类。<br />" +
"开发者可以直接使用 CO2NET 为项目提供公共基础方法,免去重复准备和维护公共代码的痛苦。<br />" +
"您可以在几乎任何项目中使用 CO2NET。"
};
var co2netList = new List<Home_IndexVD_AssemblyModel>();
co2netList.Add(new Home_IndexVD_AssemblyModel("CO2NET 基础库", "Senparc.CO2NET", typeof(CO2NET.Config)));//CO2NET 基础库版本信息
co2netList.Add(new Home_IndexVD_AssemblyModel("APM 库", "Senparc.CO2NET.APM", typeof(CO2NET.APM.Config)));//CO2NET.APM 版本信息
co2netList.Add(new Home_IndexVD_AssemblyModel("Redis 库<br />(StackExchange.Redis)", "Senparc.CO2NET.Cache.Redis", typeof(Senparc.CO2NET.Cache.Redis.Register)));//CO2NET.Cache.Redis 版本信息
co2netList.Add(new Home_IndexVD_AssemblyModel("Redis 库<br />(CSRedis)", "Senparc.CO2NET.Cache.CsRedis", typeof(Senparc.CO2NET.Cache.CsRedis.Register)));//CO2NET.Cache.CsRedis 版本信息
co2netList.Add(new Home_IndexVD_AssemblyModel("Memcached 库", "Senparc.CO2NET.Cache.Memcached", typeof(Senparc.CO2NET.Cache.Memcached.Register)));//CO2NET.Cache.Memcached 版本信息
vd.AssemblyModelCollection[co2netGroup] = cacheAndExtensionList;


//缓存
//var containerCacheStrategy = CacheStrategyFactory.GetContainerCacheStrategyInstance();
Expand All @@ -96,13 +154,13 @@ public IActionResult Index()
}

Weixin.WeixinTrace.SendCustomLog("首页被访问",
string.Format("Url:{0}\r\nIP:{1}", Request.Host, HttpContext.Connection.RemoteIpAddress));
string.Format("Url:{0}\r\nIP:{1}", Request.Host, HttpContext.Connection.RemoteIpAddress));
//or use Header: REMOTE_ADDR

//获取编译时间
TempData["BuildTime"] = System.IO.File.GetLastWriteTime(this.GetType().Assembly.Location).ToString("yyyyMMdd.HH.mm");

return View();
return View(vd);
}

public ActionResult WeChatSampleBuilder()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Senparc.Weixin.Sample.NetCore3.Models.VD
{
public class Home_IndexVD
{
public Dictionary<Home_IndexVD_GroupInfo, List<Home_IndexVD_AssemblyModel>> AssemblyModelCollection { get; set; }
}

public class Home_IndexVD_GroupInfo {
public string Title { get; set; }
public string Description { get; set; }
}

public class Home_IndexVD_AssemblyModel
{
public string Title { get; set; }
public string AssemblyName { get; set; }
public string NugetName { get; set; }
public string Version { get; set; }
public bool SupportNet45 { get; set; }
public bool SupportStandard20 { get; set; }
public bool SupportStandard21 { get; set; }
public bool SupportNetCore22 => SupportStandard20;
public bool SupportNetCore31 => SupportStandard21;
public string GitHubUrl { get; set; }

public Home_IndexVD_AssemblyModel(string title, string name, Type versionType, string nugetName = null, string gitHubUrl = null, bool supportNet45 = true, bool supportStandard20 = true, bool supportStandard21 = true)
{
Func<Version, string> getDisplayVersion = version => Regex.Match(version.ToString(), @"\d+\.\d+\.\d+").Value;


Func<Type, string> getTypeVersionInfo = type =>
{
var version = System.Reflection.Assembly.GetAssembly(type).GetName().Version;
return getDisplayVersion(version);
};


Title = title;
AssemblyName = name;
Version = getTypeVersionInfo(versionType);
NugetName = nugetName ?? AssemblyName;
SupportNet45 = supportNet45;
SupportStandard20 = supportStandard20;
SupportStandard21 = supportStandard21;
GitHubUrl = gitHubUrl;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>5.204.0</Version>
<Version>5.300.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -39,6 +39,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
<PackageReference Include="Senparc.NeuChar.App" Version="0.7.100-preview1.1" />
<PackageReference Include="Senparc.NeuChar.AspNet" Version="0.1.100-preview1.1" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using Senparc.Weixin.Work;//DPBMARK Work DPBMARK_END
using Senparc.Weixin.Work.MessageHandlers.Middleware;//DPBMARK Work DPBMARK_END
using Senparc.Weixin.WxOpen;//DPBMARK MiniProgram DPBMARK_END
using Senparc.Weixin.WxOpen.MessageHandlers.Middleware;//DPBMARK MiniProgram DPBMARK_END

namespace Senparc.Weixin.Sample.NetCore3
{
Expand Down
Loading