Cy.Weixin.Open 1.0.3

dotnet add package Cy.Weixin.Open --version 1.0.3
                    
NuGet\Install-Package Cy.Weixin.Open -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cy.Weixin.Open" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cy.Weixin.Open" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Cy.Weixin.Open" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cy.Weixin.Open --version 1.0.3
                    
#r "nuget: Cy.Weixin.Open, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Cy.Weixin.Open&version=1.0.3
                    
Install Cy.Weixin.Open as a Cake Addin
#tool nuget:?package=Cy.Weixin.Open&version=1.0.3
                    
Install Cy.Weixin.Open as a Cake Tool

微信公众号开发插件

插件介绍

目前只完成了接受普通消息、接受事件推送、被动回复用户消息、模版消息、客服消息  
  1. 公众平台测试号地址 https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login 微信扫码登录 1.1 插件配置 url填写你的接口回调地址(例如:http://域名/weixin/notify) token填写你的token 1.2 在Program.cs中,添加以下代码:

         builder.Services.AddWeiXinOpenServer(config =>
         {
             config.AppId = "公众号的appID";
             config.AppSecret = "公众号的appsecret";
             config.Token = "对应公众号填写的token";
             config.NotifyPath = "对应公众号填写的回调地址  /weixin/notify";
         });
         app.UseWeixinOpenMiddleware();//中间件
    
     或者
    
     builder.Services.AddWeiXinOpenServer(builder.Configuration);
     app.UseWeixinOpenMiddleware();
     支持自定义事件
     app.UseWeixinOpenMiddleware( new WeixinOptions()
         {
             OnRecieveAsync = async (context) =>
             {
                 Console.WriteLine("接受消息");
             },
             OnSubscribeAsync = async (context) =>
             {
                 Console.WriteLine("关注事件的时候");
             },
    
         });
     在appsettings.json中添加配置
      "WeiXin": {
            "Token": "cy",
            "AppId": "wx2960784a710d9e3f",
            "AppSecret": "f745080903ccc28fe9aee6e509c813b4"
      }
    

1.3本地调试需要内外网穿透 地址https://natapp.cn/ 本人用的是natapp 接受普通消息对应OnRecieveMessageAsync 接受事件推送对应On+Event

不喜勿喷~~

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 107 2/5/2025
1.0.2 94 1/16/2025
1.0.1 93 1/16/2025
1.0.0 94 1/16/2025

微信公众号开发
接受普通消息、接受事件推送、被动回复用户消息、模版消息、客服消息