コード例 #1
0
        public SessionWxResponse GetSession(JSCodeApiToken token)
        {
            var app = this.sharingHostService.MerchantDetails
                      .SelectMany(x => x.Apps)
                      .SingleOrDefault(x => x.AppId == token.AppId);

            token.Secret = app.Secret;
            return(this.wxapi.GetSession(token));
        }
コード例 #2
0
ファイル: WeChatApiService.cs プロジェクト: manny2016/Sharing
        public SessionWxResponse GetSession(JSCodeApiToken token)
        {
            var url = string.Format("https://api.weixin.qq.com/sns/jscode2session?appid={0}&js_code={1}&secret={2}&grant_type=authorization_code",
                                    token.AppId, token.Code, token.Secret);

            return(url.GetUriJsonContent <SessionWxResponse>());
            //return this.cache.GetOrCreate<SessionWxResponse>(
            //  string.Format("Session_{0}", token.AppId),
            //  (entity) => {

            //  });
        }
コード例 #3
0
 public SessionWxResponse GetSession(JSCodeApiToken token)
 {
     return(client.GetSession(token));
 }