Beispiel #1
0
        public static string BuildSignatureScriptContent(WeChatJsConfiguration jsConfig)
        {
            const string script = @"; function configWeixinJs ( cfg, dontSetupWeixin ){{
    cfg = cfg || {{}};
    cfg.appId = '{0}'; cfg.timestamp = {1}; cfg.nonceStr = '{2}'; cfg.signature = '{3}'; cfg.debug = {4};

	if(!cfg.jsApiList || !cfg.jsApiList.length) {{
        cfg.jsApiList = [ 'checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo' ];
    }}
    
    if( window.jWeixin && !dontSetupWeixin) {{
        jWeixin.config( cfg ); 
        if( window.weixinShareData ){{
	        jWeixin.ready ( function () {{
		        jWeixin.onMenuShareAppMessage(weixinShareData);
		        jWeixin.onMenuShareTimeline(weixinShareData);
		        jWeixin.onMenuShareQQ(weixinShareData);
	        }});
        }}
    }}else if( !window.jWeixin && window.console ){{
        console.log( 'WeChatJs: please put this WeChatJs script after WeChat\'s official sdk script.' );
    }}

    return cfg;
}} configWeixinJs( null, {5} );";

            return(string.Format(script,
                                 jsConfig.AppId,
                                 jsConfig.Timestamp,
                                 jsConfig.NonceString,
                                 jsConfig.Signature,
                                 jsConfig.DebugMode.ToString().ToLower(),
                                 jsConfig.DontSetupWeChatOnGeneratingScript.ToString().ToLower()));
        }
Beispiel #2
0
        public static string BuildSignatureScriptContent(WeChatJsConfiguration jsConfig)
        {
            const string script = @"; function configWeixinJs ( cfg, dontSetupWeixin ){{
    cfg = cfg || {{}};
    cfg.appId = '{0}'; cfg.timestamp = {1}; cfg.nonceStr = '{2}'; cfg.signature = '{3}'; cfg.debug = {4};

	if(!cfg.jsApiList || !cfg.jsApiList.length) {{
        cfg.jsApiList = [ 'checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo' ];
    }}
    
    if( window.jWeixin && !dontSetupWeixin) {{
        jWeixin.config( cfg ); 
        if( window.weixinShareData ){{
	        jWeixin.ready ( function () {{
		        jWeixin.onMenuShareAppMessage(weixinShareData);
		        jWeixin.onMenuShareTimeline(weixinShareData);
		        jWeixin.onMenuShareQQ(weixinShareData);
	        }});
        }}
    }}else if( !window.jWeixin && window.console ){{
        console.log( 'WeChatJs: please put this WeChatJs script after WeChat\'s official sdk script.' );
    }}

    return cfg;
}} configWeixinJs( null, {5} );";
            return string.Format(script,
                jsConfig.AppId,
                jsConfig.Timestamp,
                jsConfig.NonceString,
                jsConfig.Signature,
                jsConfig.DebugMode.ToString().ToLower(),
                jsConfig.DontSetupWeChatOnGeneratingScript.ToString().ToLower());
        }