feat: 添加微信应用模块,支持微信支付及微信小程序对接(功能产品已上线验证)

This commit is contained in:
橙子
2023-09-03 11:22:19 +08:00
parent efee87e4c5
commit c2ca0b1f29
21 changed files with 1264 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using Furion;
using Microsoft.Extensions.DependencyInjection;
using Yi.Framework.Module.WeChat.Abstract;
namespace Yi.Framework.Module.WeChat.Extensions
{
public static class WeChatExtensions
{
public static string ToQueryString(this object model)
{
var properties = model.GetType().GetProperties();
var query = HttpUtility.ParseQueryString(string.Empty);
foreach (var property in properties)
{
var value = property.GetValue(model);
if (value != null)
{
query[property.Name] = value.ToString();
}
}
return "?" + query.ToString();
}
/// <summary>
/// 效验请求是否成功
/// </summary>
/// <param name="response"></param>
/// <returns></returns>
public static void ValidateSuccess(this IErrorObjct response)
{
if (response.errcode != 0)
{
throw new WeChatException(response.errmsg);
}
}
}
}