22 lines
763 B
C#
22 lines
763 B
C#
|
|
using Newtonsoft.Json.Linq;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace Assets.Scripts.Apis
|
|||
|
|
{
|
|||
|
|
public class ThirdPartApi : ApiBase
|
|||
|
|
{
|
|||
|
|
public async Task<JObject> GetWxAccessToken(string code)
|
|||
|
|
{
|
|||
|
|
return await GetThirdPartAsync<JObject>($"https://api.weixin.qq.com/sns/oauth2/access_token?appid={App.WxAppId}&secret={App.WxAppSecret}&code={code}&grant_type=authorization_code");
|
|||
|
|
}
|
|||
|
|
public async Task<JObject> GetWxUserInfo(string accessToken, string openId)
|
|||
|
|
{
|
|||
|
|
return await GetThirdPartAsync<JObject>($"https://api.weixin.qq.com/sns/userinfo?access_token=" + accessToken + "&openid=" + openId);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|