using Furion.DependencyInjection; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using YBDevice.Entity; namespace YBDevice.NApi.Application.WXInfo { /// /// 微信开放平台openticket配置 /// public class WXService : IWXService, ITransient { private readonly ISqlSugarRepository repository; private readonly SqlSugarClient dbClient; public WXService(ISqlSugarRepository sqlSugarRepository) { repository = sqlSugarRepository; dbClient = repository.Context; } /// /// 获取openticket /// /// /// public async Task GetOpenTicketAsync(string componentAppId) { var component = await dbClient.Queryable().Where(x => x.ComponentAppId == componentAppId).FirstAsync(); return component?.OpenTicket; } /// /// 获取公众号的刷新token /// /// 公众号appid /// 开放平台appid /// public async Task GetRefreshToken(string authorizerId, string componentAppId) { var data = await dbClient.Queryable().FirstAsync(x => x.authorizer_appid == authorizerId && x.componentappid == componentAppId); if (data != null) { return data.authorizer_refresh_token; } return ""; } } }