コード例 #1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            IList <MenuInfo> initFuwuMenus = VShopHelper.GetInitFuwuMenus();
            FWMenu           menu          = new FWMenu
            {
                button = new List <FWButton>()
            };
            List <FWButton> list2 = menu.button as List <FWButton>;

            foreach (MenuInfo info in initFuwuMenus)
            {
                FWButton item = this.BuildMenu(info);
                if ((info.Chilren != null) && (info.Chilren.Count > 0))
                {
                    item.subButton = new List <FWButton>();
                    foreach (MenuInfo info2 in info.Chilren)
                    {
                        (item.subButton as List <FWButton>).Add(this.BuildMenu(info2));
                    }
                }
                list2.Add(item);
            }
            if (!AlipayFuwuConfig.CommSetConfig(SettingsManager.GetMasterSettings(true).AlipayAppid, base.Server.MapPath("~/"), "GBK"))
            {
                base.Response.Write("<script>alert('您的服务窗配置信息错误,请您先检查配置!');location.href='AliFuwuConfig.aspx'</script>");
            }
            else
            {
                AlipayMobilePublicMenuUpdateResponse response = AliOHHelper.MenuUpdate(menu);
                if (((response != null) && !response.IsError) && (response.Code == "200"))
                {
                    this.ShowMsg("自定义菜单已同步到支付宝服务窗!", true);
                }
                else
                {
                    this.ShowMsg("操作失败!" + response.Msg, false);
                }
            }
        }
コード例 #2
0
        private void BtnSave_Click(object sender, System.EventArgs e)
        {
            System.Collections.Generic.IList <MenuInfo> initFuwuMenus = VShopHelper.GetInitFuwuMenus();
            FWMenu fWMenu = new FWMenu();

            fWMenu.button = new System.Collections.Generic.List <FWButton>();
            System.Collections.Generic.List <FWButton> list = fWMenu.button as System.Collections.Generic.List <FWButton>;
            foreach (MenuInfo current in initFuwuMenus)
            {
                FWButton fWButton = this.BuildMenu(current);
                if (current.Chilren != null && current.Chilren.Count > 0)
                {
                    fWButton.subButton = new System.Collections.Generic.List <FWButton>();
                    foreach (MenuInfo current2 in current.Chilren)
                    {
                        (fWButton.subButton as System.Collections.Generic.List <FWButton>).Add(this.BuildMenu(current2));
                    }
                }
                list.Add(fWButton);
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            string       alipayAppid    = masterSettings.AlipayAppid;

            if (!AlipayFuwuConfig.CommSetConfig(alipayAppid, base.Server.MapPath("~/"), "GBK"))
            {
                base.Response.Write("<script>alert('您的服务窗配置信息错误,请您先检查配置!');location.href='AliFuwuConfig.aspx'</script>");
                return;
            }
            AlipayMobilePublicMenuUpdateResponse alipayMobilePublicMenuUpdateResponse = AliOHHelper.MenuUpdate(fWMenu);

            if (alipayMobilePublicMenuUpdateResponse != null && !alipayMobilePublicMenuUpdateResponse.IsError && alipayMobilePublicMenuUpdateResponse.Code == "200")
            {
                this.ShowMsg("自定义菜单已同步到支付宝服务窗!", true);
                return;
            }
            this.ShowMsg("操作失败!" + alipayMobilePublicMenuUpdateResponse.Msg, false);
        }