mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-20 18:48:10 +08:00
chore(tenpayv3): 新增基于 .NET Framework 4.7 的示例项目
This commit is contained in:
@@ -1,32 +1,25 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Controllers
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Controllers
|
||||
{
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Events;
|
||||
|
||||
[ApiController]
|
||||
[Route("notify")]
|
||||
[Route("api/notify")]
|
||||
public class WechatNotifyController : ControllerBase
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly Options.WechatOptions _wechatOptions;
|
||||
|
||||
private readonly Services.HttpClients.IWechatApiHttpClientFactory _wechatApiHttpClientFactory;
|
||||
|
||||
public WechatNotifyController(
|
||||
ILoggerFactory loggerFactory,
|
||||
IOptions<Options.WechatOptions> wechatOptions,
|
||||
Services.HttpClients.IWechatApiHttpClientFactory wechatApiHttpClientFactory)
|
||||
{
|
||||
_logger = loggerFactory.CreateLogger(GetType());
|
||||
_wechatOptions = wechatOptions.Value;
|
||||
_wechatApiHttpClientFactory = wechatApiHttpClientFactory;
|
||||
}
|
||||
|
||||
|
@@ -1,25 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Controllers
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Sample.Controllers
|
||||
{
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
|
||||
[ApiController]
|
||||
[Route("user")]
|
||||
[Route("api/user")]
|
||||
public class WechatUserController : ControllerBase
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly Services.Repositories.IWechatAccessTokenEntityRepository _wechatAccessTokenEntityRepository;
|
||||
|
||||
private readonly Services.HttpClients.IWechatApiHttpClientFactory _wechatApiHttpClientFactory;
|
||||
|
||||
public WechatUserController(
|
||||
@@ -38,9 +32,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Sample_Net5.Controllers
|
||||
[FromQuery(Name = "app_id")] string appId,
|
||||
[FromQuery(Name = "open_id")] string openId)
|
||||
{
|
||||
// 获取用户基本信息
|
||||
// 文档:https://developers.weixin.qq.com/doc/offiaccount/User_Management/Get_users_basic_information_UnionID.html#UinonId
|
||||
|
||||
var entity = _wechatAccessTokenEntityRepository.FirstOrDefault(e => e.AppId == appId);
|
||||
var client = _wechatApiHttpClientFactory.Create(appId);
|
||||
var request = new CgibinUserInfoRequest() { AccessToken = entity?.AccessToken, OpenId = openId };
|
||||
|
Reference in New Issue
Block a user