代码拉取完成,页面将自动刷新
同步操作将从 不问/NET CORE版本的微信API框架 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
"WeChat": {
/// <summary>
/// 应用ID
/// </summary>
"appid": "",
/// <summary>
/// 应用密钥
/// </summary>
"appsecret": "",
/// <summary>
/// 令牌
/// </summary>
"token": "",
/// <summary>
/// 消息加解密密钥 目前明文模式 不需要填
/// </summary>
"encodingaeskey": "",
/// <summary>
/// 消息接收url
/// </summary>
"url": "/wx"
},
//-------------------------------支付相关------------------------------------
"Pay": {
/// <summary>
/// 支付账户的微信ID
/// </summary>
"appid": "",
/// <summary>
/// 微信支付商户号
/// </summary>
"mchid": "",
/// <summary>
/// 加密密钥
/// </summary>
"sign_key": "",
/// <summary>
/// SSL证书目录 注意应该填写绝对路径(仅退款、撤销订单时需要)
/// </summary>
"sslpath": "",
/// <summary>
/// 证书密码
/// </summary>
"sslpassword": "",
/// <summary>
/// 支付异步消息回调
/// </summary>
"pay_notify": "/wx/pay_notifyurl",
/// <summary>
/// 退款异步消息回调
/// </summary>
"refund_notify": "/wx/refund_notifyurl",
/// <summary>
/// 回调域名
/// </summary>
"notify_url": "http://xxxxx"
}
//微信API配置
services.AddWeChatApi(Configuration.GetSection("WeChat"));
//微信消息中间件
app.AddWeChatApiMessageMiddleware();
//微信API配置
services.AddWeChatApi<xxx>(Configuration.GetSection("WeChat"));
protected override void TextMsg(TextMsg msg)
{
this.ReplyTextMsg($"你好,您发送的消息是:{msg.Content}");
}
//微信API配置
services.AddWeChatApiCache<ccc>();
WxApi wxApi;
WxPay wxPay;
public HomeController(WxApi wxApi, WxPay wxPay)
{
this.wxApi = wxApi;
this.wxPay = wxPay;
}
public string TestSendTemplateMsg()
{
wxApi.ApiService.SendTemplateMsg("openid", "模板ID",
new Keyword("标题"), new Keyword("备注"),
"跳转url", 跳转小程序,
new Keyword("1"),
new Keyword("2"),
new Keyword("3"));
return "1";
}
public class WxPayService : Notify
{
public WxPayService(WxPay wxPay) : base(wxPay)
{
}
protected override bool Pay(PayNotify payNotify)
{
LogerHelper.Debug($"成功支付:{payNotify.out_trade_no}");
return true;
}
protected override bool Refund(RefundNotifyInfo refundNotifyInfo)
{
LogerHelper.Debug($"成功退款:{refundNotifyInfo.out_refund_no}");
return true;
}
}
//微信支付
services.AddWeChatPay<WxPayService>(Configuration.GetSection("Pay"));
//支付退款回调中间件
app.AddWeChatPayMiddleware();
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
//微信API配置
services.AddWeChatApi(Configuration.GetSection("WeChat")).AddWeChatApiMessage<WxMessage>().AddWeChatApiCache<WxCache>();
//微信支付
services.AddWeChatPay<WxPayService>(Configuration.GetSection("Pay"));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
//微信消息中间件
app.AddWeChatApiMessageMiddleware();
//支付退款回调中间件
app.AddWeChatPayMiddleware();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。