Example #1
0
        /// <summary>
        /// 获取当前页面卡券JS配置信息
        /// </summary>
        /// <returns></returns>
        public JSSDKConfigInfo GetCardJSSDKConfigInfo()
        {
            var ticket     = WeChatApisContext.Current.TicketApi.GetSafeCardAccessToken().Ticket;
            var configInfo = new JSSDKConfigInfo
            {
                AppId     = Current.GetConfig().AppId,
                Timestamp = JSSDKHelper.GetTimestamp(),
                NonceStr  = JSSDKHelper.GetNoncestr()
            };

            return(configInfo);
        }
Example #2
0
        /// <summary>
        /// 获取当前页面JS配置信息
        /// </summary>
        /// <param name="absoluteUrl">The absoluteUrl<see cref="string"/></param>
        /// <returns></returns>
        public JSSDKConfigInfo GetJSSDKConfigInfo(string absoluteUrl)
        {
            var ticket     = WeChatApisContext.Current.TicketApi.SafeGet().Ticket;
            var configInfo = new JSSDKConfigInfo
            {
                AppId     = Current.GetConfig().AppId,
                Timestamp = JSSDKHelper.GetTimestamp(),
                NonceStr  = JSSDKHelper.GetNoncestr()
            };

            configInfo.Signature = JSSDKHelper.GetSignature(ticket, configInfo.NonceStr, configInfo.Timestamp,
                                                            absoluteUrl);
            return(configInfo);
        }
Example #3
0
        /// <summary>
        ///     获取当前页面JS配置信息
        /// </summary>
        /// <returns></returns>
        public JSSDKConfigInfo GetJSSDKConfigInfo()
        {
            var ticket     = WeChatApisContext.Current.TicketApi.SafeGet().Ticket;
            var configInfo = new JSSDKConfigInfo
            {
                AppId     = WeChatConfigManager.Current.GetConfig().AppId,
                Timestamp = JSSDKHelper.GetTimestamp(),
                NonceStr  = JSSDKHelper.GetNoncestr()
            };

            configInfo.Signature = JSSDKHelper.GetSignature(ticket, configInfo.NonceStr, configInfo.Timestamp,
                                                            HttpContext.Current.Request.Url.AbsoluteUri);
            return(configInfo);
        }