Exemplo n.º 1
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Text = "";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            this.htmlAppID = masterSettings.WeixinAppId;
            string weixinAppSecret = masterSettings.WeixinAppSecret;
            string cacheToken      = this.GetCacheToken(this.htmlAppID, weixinAppSecret);

            this.htmlTimeStamp = WeixinSet.ConvertDateTimeInt(DateTime.Now).ToString();
            this.htmlSignature = this.GetSignature(cacheToken, this.htmlTimeStamp, this.htmlNonceStr, out this.htmlstring1);
            base.Text          = string.Concat(new string[]
            {
                "<script>wx.config({ debug: false,appId: '",
                this.htmlAppID,
                "',timestamp: '",
                this.htmlTimeStamp,
                "', nonceStr: '",
                this.htmlNonceStr,
                "',signature: '",
                this.htmlSignature,
                "',jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','chooseWXPay']});var _GetTokenError='",
                this._GetTokenError,
                "'; </script>"
            });
            base.Render(writer);
        }
Exemplo n.º 2
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Text = "";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            this.htmlAppID = masterSettings.WeixinAppId;
            string weixinAppSecret = masterSettings.WeixinAppSecret;

            try
            {
                this.htmlToken = this.GetToken(this.htmlAppID, weixinAppSecret);
            }
            catch (Exception)
            {
            }
            this.htmlTimeStamp = WeixinSet.ConvertDateTimeInt(DateTime.Now).ToString();
            this.htmlSignature = this.GetSignature(this.htmlToken, this.htmlTimeStamp, this.htmlNonceStr, out this.htmlstring1);
            string token = TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);

            MenuApi.GetMenus(token);
            base.Text = string.Concat(new string[]
            {
                "<script>wx.config({ debug: false,appId: '",
                this.htmlAppID,
                "',timestamp: '",
                this.htmlTimeStamp,
                "', nonceStr: '",
                this.htmlNonceStr,
                "',signature: '",
                this.htmlSignature,
                "',jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','getLocation']});</script>"
            });
            base.Render(writer);
        }