using DS.Module.Core.Helpers; namespace DS.Module.Core; /// /// 微信公众号网页开发 /// 参考文档 /// https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html /// public class WxWebHelper { // static Logger Logger = LogManager.GetCurrentClassLogger(); /// /// 获取Token /// /// /// /// /// public static string GetAccess_token(string appid, string secret, string code) { string strUrl = String.Format(@"https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code", appid, secret, code); var result = RequestHelper.Get(strUrl); return result; } /// /// 获取公众号用户信息 /// /// /// /// public static string GetUserInfo(string Token, string openid) { string url = String.Format(@" https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang=zh_CN", Token, openid); var result = RequestHelper.Get(url); return result; } }