Exemple #1
0
        public static async Task <Tuple <long, long> > DocEnsure(
            IServiceProvider ServiceProvider,
            IServiceInstanceManager sim,
            long?ScopeId
            )
        {
            var mHelp = await sim.GetService <IDocumentService>("m-help", ScopeId);

            await ServiceProvider.Invoke(
                ((IFilePathResolver frr, IDocumentManager dm, IDocumentCategoryManager cm)arg) =>
                MobileHelpEnsure(arg.frr, arg.dm, arg.cm),
                mHelp.Id
                );

            var pcHelp = await sim.GetService <IDocumentService>("pc-help", ScopeId);

            var re = await ServiceProvider.Invoke(
                ((IContentManager ContentManager,
                  IFilePathResolver frr,
                  IDocumentManager dm,
                  IDocumentCategoryManager cm
                  )arg) =>
                PCHelpEnsure(sim, ScopeId, arg.ContentManager, arg.frr, arg.dm, arg.cm),
                pcHelp.Id
                );

            //await scope.MobileDocEnsureNew();
            return(re);
        }
Exemple #2
0
        public static async Task <Tuple <long, long> > PCHelpEnsure(
            IServiceInstanceManager sim,
            long?ScopeId,
            IContentManager ContentManger,
            IFilePathResolver FilePathResolver,
            IDocumentManager DocManager,
            IDocumentCategoryManager CatManager
            )
        {
            var re = await DocManager.DocEnsureFromFiles(
                CatManager,
                //"pc-help",
                null,
                FilePathResolver.Resolve($"root://StaticResources/帮助文档/PC文档")
                );

            await sim.UpdateSetting <HygouSetting>(
                ScopeId,
                s =>
            {
                s.PCHelpCenterDefaultDocId = re[0].Children[0].Id;
            });

            var tail_doc_list = await ContentManger.ContentEnsure(
                "PC页面尾部文档列表",
                "PC页面尾部文档列表",
                null,
                re.Select(cat =>
                          new ContentItem {
                Title1 = cat.Name,
                Items = cat.Children.Select(doc =>
                                            new ContentItem {
                    Title1 = doc.Name, Uri = $"/help/doc/{doc.Id}"
                }
                                            ).ToArray()
            }
                          ).Take(4).ToArray()
                );

            var tail_link_list = await ContentManger.ContentEnsure(
                "PC页面尾部链接列表",
                "PC页面尾部链接列表",
                null,
                re.Last().Children.Select(doc =>
                                          new ContentItem {
                Title1 = doc.Name, Uri = $"/help/doc/{doc.Id}"
            }
                                          ).ToArray()
                );

            await sim.UpdateSetting <FriendlyContentSetting>(
                ScopeId,
                s =>
            {
                s.PCHomeTailMenuId = tail_doc_list.Id;
            });

            return(Tuple.Create(tail_doc_list.Id, tail_link_list.Id));
        }
Exemple #3
0
        static async Task NewSerivces(IServiceProvider ServiceProvider, IServiceInstanceManager sim, long?ScopeId)
        {
            //await(sim.NewDocumentService("PC系统文档", "pc-sys")
            //	.WithDisplay("PC系统文档", "PC系统文档,如关于我们等")
            //	.Enabled()
            //	).Ensure(ServiceProvider, ScopeId);

            await(sim.NewDocumentService("PC帮助文档", "pc-help")
                  .WithDisplay("PC帮助文档")
                  .Enabled()
                  ).Ensure(ServiceProvider, ScopeId);

            //await(sim.NewDocumentService("移动端系统文档", "m-sys")
            //	.WithDisplay("移动端系统文档", "移动端系统文档,如关于我们等")
            //	.Enabled()
            //	).Ensure(ServiceProvider, ScopeId);

            await(sim.NewDocumentService("移动端帮助文档", "m-help")
                  .WithDisplay("移动端帮助文档")
                  .Enabled()
                  ).Ensure(ServiceProvider, ScopeId);
        }
Exemple #4
0
        public static async Task PCSiteEnsure(
            IServiceInstanceManager sim,
            long?ScopeId,
            IContentManager ContentManager,
            ISiteTemplateManager SiteTemplateManager,
            ISiteManager SiteManager,
            IItemService ItemService,
            ProductContentInitializer prdctns,
            ProductCategoryInitializer collection,
            long PageTailDocListContentId,
            long PageTailLinkListContentId,
            long MainCategoryId
            )
        {
            var head_carousel = await ContentManager.ContentEnsure(
                "PC页面内容",
                "PC首页幻灯片",
                null,
                new[] {
                new ContentItem {
                    Image = StaticRes.File + "-pc-carousel-1-jpg", Uri = "/activity/register"
                },
                new ContentItem {
                    Image = StaticRes.File + "-pc-carousel-2-jpg", Uri = "/activity/recharge"
                },
                //new ContentItem{Image=StaticResRoot.Value+"-pc-carousel-3-jpg"},
                //new ContentItem{Image=StaticResRoot.Value+"-pc-carousel-4-jpg"},
                //new ContentItem{Image=StaticResRoot.Value+"-pc-carousel-5-jpg"},
                //new ContentItem{Image=StaticResRoot.Value+"-pc-carousel-6-jpg"},
                //new ContentItem{Image=StaticResRoot.Value+"-pc-carousel-7-jpg"},
                //new ContentItem{Image=StaticResRoot.Value+"-pc-carousel-8-jpg"},
                //new ContentItem{Image=StaticResRoot.Value+"-pc-carousel-9-jpg"},
            });

            await sim.UpdateSetting <FriendlyContentSetting>(
                ScopeId,
                s =>
            {
                s.PCHomePageSliderId = head_carousel.Id;
            });

            var banner_1 = await ContentManager.ContentEnsure(
                "PC广告位",
                "PC首页广告位1",
                null,
                new[] { new ContentItem {
                            Image = StaticRes.File + "-pc-banners-1-gif", Uri = "/activity/register"
                        } },
                "PC首页广告位,位于第1,第2产品分类之间"
                );

            var banner_2 = await ContentManager.ContentEnsure(
                "PC广告位",
                "PC首页广告位2",
                null,
                new[] { new ContentItem {
                            Image = StaticRes.File + "-pc-banners-2-jpg", Uri = "/activity/recharge"
                        } },
                "PC首页广告位,位于第3,第4产品分类之间"
                );

            var banner_3 = await ContentManager.ContentEnsure(
                "PC广告位",
                "PC首页广告位3",
                null,
                new[] { new ContentItem {
                            Image = StaticRes.File + "-pc-banners-2-jpg", Uri = "/activity/recharge"
                        } },
                "PC首页广告条,位于第5,第6产品分类之间"
                );

            var banner_4 = await ContentManager.ContentEnsure(
                "PC广告位",
                "PC首页广告位4",
                null,
                new[] { new ContentItem {
                            Image = StaticRes.File + "-pc-banners-2-jpg", Uri = "/activity/recharge"
                        } },
                "PC首页广告位,位于第7,第8产品分类之间"
                );

            await sim.UpdateSetting <FriendlyContentSetting>(
                ScopeId,
                s =>
            {
                s.PCAdCategory = "PC广告位";
            });


            var cats = await ItemService.ListCategories(MainCategoryId, null);

            var items = new[] {
                //new ContentItem{Title1="奢侈品区", Icon="yg-icons-1-png", Image="yg-icons-1b-png",Uri="/cat/6"},
                //new ContentItem{Title1="汽车专区", Icon="yg-icons-2-png", Image="yg-icons-2b-png",Uri="/cat/8"},
                //new ContentItem{Title1="手机数码", Icon="yg-icons-3-png", Image="yg-icons-3b-png",Uri="/cat/2"},
                //new ContentItem{Title1="家用电器", Icon="yg-icons-4-png", Image="yg-icons-4b-png",Uri="/cat/5"},
                //new ContentItem{Title1="金银珠宝", Icon="yg-icons-5-png", Image="yg-icons-5b-png",Uri="/cat/1"},
                //new ContentItem{Title1="云购超市", Icon="yg-icons-6-png", Image="yg-icons-6b-png",Uri="/cat/4"},
                //new ContentItem{Title1="服饰百货", Icon="yg-icons-7-png", Image="yg-icons-7b-png",Uri="/cat/3"},
                //new ContentItem{Title1="其他商品", Icon="yg-icons-8-png", Image="yg-icons-8b-png",Uri="/cat/7"},
                new ContentItem {
                    Title1 = "话费充值", Title2 = "移动 联通 电信", Icon = StaticRes.File + "-pc-prdcats-recharge40-png", Uri = "/cat/7"
                },
                new ContentItem {
                    Title1 = "手机", Title2 = "三星 iPhone 华为", Icon = StaticRes.File + "-pc-prdcats-phone40-png", Uri = "/cat/2"
                },
                new ContentItem {
                    Title1 = "数码", Title2 = "佳能 尼康 索尼", Icon = StaticRes.File + "-pc-prdcats-camera40-png", Uri = "/cat/5"
                },
                new ContentItem {
                    Title1 = "汽车", Title2 = "奔驰 大众 宝马", Icon = StaticRes.File + "-pc-prdcats-car40-png", Uri = "/cat/8"
                },
                new ContentItem {
                    Title1 = "黄金", Title2 = "金条 金元宝", Icon = StaticRes.File + "-pc-prdcats-gold40-png", Uri = "/cat/1"
                },
            };

            foreach (var it in items)
            {
                it.Uri = "/cat/" + cats.Items.Single(c => c.Title == (it.Title1.Length == 2?it.Title1 + "专区":it.Title1)).Id;
            }
            var cat_menu = await ContentManager.ContentEnsure(
                "PC页面内容",
                "PC页面头部产品分类菜单",
                null,
                items
                );

            await sim.UpdateSetting <FriendlyContentSetting>(
                ScopeId,
                s =>
            {
                s.PCHeadProductCategoryMenuId = cat_menu.Id;
            });

            var main_menu = await ContentManager.ContentEnsure(
                "PC页面内容",
                "PC页面头部主菜单",
                null,
                new[] {
                new ContentItem {
                    Title1 = "首页", Uri = "/"
                },
                //new ContentItem{Title1="十元", Uri="/col/"+collection.C10.Id},
                //new ContentItem{Title1="百元", Uri="/col/"+collection.C100.Id},
                //new ContentItem{Title1="限购", Uri="/col/"+collection.Limit.Id},
                new ContentItem {
                    Title1 = "揭晓", Uri = "/open"
                },
                new ContentItem {
                    Title1 = "晒单", Uri = "/shared"
                },
                new ContentItem {
                    Title1 = "新手", Uri = "/help/doc/1"
                }
            });

            await sim.UpdateSetting <FriendlyContentSetting>(
                ScopeId,
                s =>
            {
                s.PCHeadMenuId = main_menu.Id;
            });


            var tpl = await SiteTemplateManager.SiteTemplateEnsure(
                "PC网站",
                new SiteModel
            {
                name  = "PC网站",
                pages = new[]
                {
                    #region 页面公共内容
                    new PageModel
                    {
                        ident  = "页面公共内容",
                        name   = "页面公共内容",
                        blocks = new[]
                        {
                            new BlockModel
                            {
                                ident    = "头部产品分类菜单",
                                contents = new []
                                {
                                    new BlockContentModel
                                    {
                                        name    = "分类菜单",
                                        content = cat_menu.Id,
                                        render  = "razor",
                                        view    = "~/Views/Renders/Utils/HeaderCategoryMenu.cshtml"
                                    }
                                }
                            },
                            new BlockModel
                            {
                                ident    = "头部主菜单",
                                contents = new []
                                {
                                    new BlockContentModel
                                    {
                                        name    = "主菜单",
                                        content = main_menu.Id,
                                        render  = "razor",
                                        view    = "~/Views/Renders/Utils/HeaderMainMenu.cshtml"
                                    }
                                }
                            },
                            new BlockModel
                            {
                                ident    = "尾部文档列表",
                                contents = new []
                                {
                                    new BlockContentModel
                                    {
                                        name    = "文档列表",
                                        content = PageTailDocListContentId,
                                        render  = "razor",
                                        view    = "~/Views/Renders/Utils/TailDocList.cshtml"
                                    }
                                }
                            },
                            new BlockModel
                            {
                                ident    = "尾部链接列表",
                                contents = new []
                                {
                                    new BlockContentModel
                                    {
                                        name    = "文档列表",
                                        content = PageTailLinkListContentId,
                                        render  = "razor",
                                        view    = "~/Views/Renders/Utils/TailLinkList.cshtml"
                                    }
                                }
                            }
                        }
                    },
                    #endregion

                    #region 首页
                    new PageModel
                    {
                        ident    = "首页",
                        name     = "首页",
                        includes = new [] { "页面公共内容" },
                        blocks   = new []
                        {
                            new BlockModel
                            {
                                ident    = "幻灯片区域",
                                contents = new []
                                {
                                    new BlockContentModel
                                    {
                                        name    = "幻灯片",
                                        content = head_carousel.Id,
                                        render  = "razor",
                                        view    = "~/Views/Renders/Utils/Carousel.cshtml"
                                    }
                                }
                            },
                            new BlockModel
                            {
                                ident    = "主体内容",
                                contents = new []
                                {
                                    new BlockContentModel
                                    {
                                        name          = "最新揭晓",
                                        content       = prdctns.AllRounds.Id,
                                        render        = "razor",
                                        view          = "~/Views/Renders/Products/OpenWaitingRoundList.cshtml",
                                        contentConfig = Json.Stringify(new { args = new{ Paging = new Paging {
                                                                                             Count = 5
                                                                                         } } }),
                                        title1 = "最新揭晓",
                                        title2 = "揭晓",
                                        title3 = "1F"
                                    },
                                    new BlockContentModel
                                    {
                                        name          = "2楼",
                                        title1        = "话费充值",
                                        content       = prdctns.CategoriesProducts[0].Id,
                                        render        = "razor",
                                        view          = "~/Views/Renders/Products/ProductList.cshtml",
                                        contentConfig = Json.Stringify(new { args = new{ Paging = new Paging {
                                                                                             Count = 4
                                                                                         } } }),
                                        title2 = "充值",
                                        title3 = "2F"
                                    },
                                    new BlockContentModel
                                    {
                                        name    = "广告1",
                                        content = banner_1.Id,
                                        render  = "razor",
                                        view    = "~/Views/Renders/Utils/Banner.cshtml",
                                    },
                                    new BlockContentModel
                                    {
                                        name          = "3楼",
                                        title1        = "手机专区",
                                        content       = prdctns.CategoriesProducts[1].Id,
                                        render        = "razor",
                                        view          = "~/Views/Renders/Products/ProductList.cshtml",
                                        contentConfig = Json.Stringify(new { args = new{ Paging = new Paging {
                                                                                             Count = 4
                                                                                         } } }),
                                        title3 = "3F",
                                        title2 = "手机"
                                    },
                                    new BlockContentModel
                                    {
                                        name          = "4楼",
                                        title1        = "数码专区",
                                        content       = prdctns.CategoriesProducts[2].Id,
                                        render        = "razor",
                                        view          = "~/Views/Renders/Products/ProductList.cshtml",
                                        contentConfig = Json.Stringify(new { args = new{ Paging = new Paging {
                                                                                             Count = 4
                                                                                         } } }),
                                        title2 = "数码",
                                        title3 = "4F"
                                    },
                                    new BlockContentModel
                                    {
                                        name    = "广告2",
                                        content = banner_2.Id,
                                        render  = "razor",
                                        view    = "~/Views/Renders/Utils/Banner.cshtml",
                                    },
                                    new BlockContentModel
                                    {
                                        name          = "5楼",
                                        title1        = "汽车专区",
                                        content       = prdctns.CategoriesProducts[3].Id,
                                        render        = "razor",
                                        view          = "~/Views/Renders/Products/ProductList.cshtml",
                                        contentConfig = Json.Stringify(new { args = new{ Paging = new Paging {
                                                                                             Count = 4
                                                                                         } } }),
                                        title2 = "汽车",
                                        title3 = "5F"
                                    },
                                    new BlockContentModel
                                    {
                                        name          = "6楼",
                                        title1        = "黄金专区",
                                        content       = prdctns.CategoriesProducts[4].Id,
                                        render        = "razor",
                                        view          = "~/Views/Renders/Products/ProductList.cshtml",
                                        contentConfig = Json.Stringify(new { args = new{ Paging = new Paging {
                                                                                             Count = 4
                                                                                         } } }),
                                        title2 = "黄金",
                                        title3 = "6F"
                                    },
                                    //new BlockContentModel
                                    //{
                                    //	name ="广告3",
                                    //	content=banner_3.Id,
                                    //	render="razor",
                                    //	view="~/Views/Renders/Utils/Banner.cshtml",
                                    //},
                                    //new BlockContentModel
                                    //{
                                    //	name ="6楼",
                                    //	content=prdctns.CategoriesProducts[5].Id,
                                    //	render="razor",
                                    //	view="~/Views/Renders/Products/ProductList.cshtml",
                                    //	contentConfig="{\"_pl\":4}",
                                    //	title3 ="6F"
                                    //},
                                    //new BlockContentModel
                                    //{
                                    //	name ="7楼",
                                    //	content=prdctns.CategoriesProducts[6].Id,
                                    //	render="razor",
                                    //	view="~/Views/Renders/Products/ProductList.cshtml",
                                    //	contentConfig="{\"_pl\":4}",
                                    //	title3 ="7F"
                                    //},
                                    //new BlockContentModel
                                    //{
                                    //	name ="广告4",
                                    //	content=banner_4.Id,
                                    //	render="razor",
                                    //	view="~/Views/Renders/Utils/Banner.cshtml",
                                    //},
                                    //new BlockContentModel
                                    //{
                                    //	name ="8楼",
                                    //	content=prdctns.CategoriesProducts[7].Id,
                                    //	render="razor",
                                    //	view="~/Views/Renders/Products/ProductList.cshtml",
                                    //	contentConfig="{\"_pl\":4}",
                                    //	title3 ="8F"
                                    //},
                                    //new BlockContentModel
                                    //{
                                    //	name ="新品上架",
                                    //	content=prdctns.AllProducts.Id,
                                    //	contentConfig="{\"_pm\":\"new\",\"_pl\":8}",
                                    //	render="razor",
                                    //	view="~/Views/Renders/Products/ProductList.cshtml",
                                    //	viewConfig= "{\"hideStatus\":true}",
                                    //	title3 ="9F",
                                    //	title1="新品上架"
                                    //}
                                }
                            }
                        }
                    },
                    #endregion
                    #region 产品详细

                    new PageModel
                    {
                        ident    = "产品详细",
                        name     = "产品详细",
                        includes = new [] { "页面公共内容" },
                        blocks   = new []
                        {
                            new BlockModel
                            {
                                ident    = "推荐区域",
                                contents = new []
                                {
                                    new BlockContentModel
                                    {
                                        name          = "推荐",
                                        content       = prdctns.AllProducts.Id,
                                        contentConfig = "{\"_pm\":\"new\",\"_pl\":8}",
                                        render        = "razor",
                                        view          = "~/Views/Renders/Products/ProductList.cshtml",
                                        title3        = "9F"
                                    }
                                }
                            }
                        }
                    },
                    #endregion
                    #region 产品分类

                    new PageModel
                    {
                        ident    = "产品分类",
                        name     = "产品分类",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    #endregion
                    #region 产品集列表

                    new PageModel
                    {
                        ident    = "产品集列表",
                        name     = "产品集列表",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    #endregion
                    #region 用户页面
                    new PageModel
                    {
                        ident    = "用户注册",
                        name     = "用户注册",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户登录",
                        name     = "用户登录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户找回密码",
                        name     = "用户找回密码",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "绑定手机号",
                        name     = "绑定手机号",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户首页",
                        name     = "用户首页",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户夺宝记录",
                        name     = "用户夺宝记录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户充值",
                        name     = "用户充值",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "充值扫码",
                        name     = "充值扫码",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "充值状态",
                        name     = "充值状态",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户充值成功",
                        name     = "用户充值成功",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户充值记录",
                        name     = "用户充值记录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户中奖记录",
                        name     = "用户中奖记录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户晒单列表",
                        name     = "用户晒单列表",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户晒单页面",
                        name     = "用户晒单页面",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户收货地址",
                        name     = "用户收货地址",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户安全中心",
                        name     = "用户安全中心",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户通知中心",
                        name     = "用户通知中心",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },

                    new PageModel
                    {
                        ident    = "用户积分记录",
                        name     = "用户积分记录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户优惠券记录",
                        name     = "用户优惠券记录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户专属活动",
                        name     = "用户专属活动",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    new PageModel
                    {
                        ident    = "用户好友邀请",
                        name     = "用户好友邀请",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    #endregion

                    #region 购物车

                    new PageModel
                    {
                        ident    = "购物车",
                        name     = "购物车",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    #endregion
                    #region 交易

                    new PageModel
                    {
                        ident    = "用户夺宝成功页",
                        name     = "用户夺宝成功页",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[0]
                    },
                    #endregion
                    #region 夺宝

                    new PageModel
                    {
                        ident    = "最新揭晓",
                        name     = "最新揭晓",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {
                            //new BlockModel
                            //{
                            //	ident="即将揭晓",
                            //	contents=new []
                            //	{
                            //		new BlockContentModel
                            //		{
                            //			content=prdctns.AllProducts.Id,
                            //			render="razor",
                            //			view="~/Views/Renders/Products/ProductList.cshtml",
                            //			contentConfig="{\"_pl\":10,\"_ps\":\"soon\"}"
                            //		},
                            //	}
                            //}
                        }
                    },
                    new PageModel
                    {
                        ident    = "全部晒单",
                        name     = "全部晒单",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {}
                    },
                    #endregion

                    #region 其他用户页面

                    new PageModel
                    {
                        ident    = "其他用户夺宝记录",
                        name     = "其他用户夺宝记录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {}
                    },

                    new PageModel
                    {
                        ident    = "其他用户晒单列表",
                        name     = "其他用户晒单列表",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {}
                    },
                    new PageModel
                    {
                        ident    = "其他用户晒单详细",
                        name     = "其他用户晒单详细",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {}
                    },

                    new PageModel
                    {
                        ident    = "其他用户中奖记录",
                        name     = "其他用户中奖记录",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {}
                    },
                    #endregion

                    #region 帮助中心
                    new PageModel
                    {
                        ident    = "帮助中心",
                        name     = "帮助中心",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {}
                    },
                    new PageModel
                    {
                        ident    = "用户反馈",
                        name     = "用户反馈",
                        includes = new [] { "页面公共内容" },
                        blocks   = new BlockModel[] {}
                    },
                    #endregion
                }
            }
                );

            await SiteManager.SiteEnsure("main", "PC主站", tpl.Id);
        }
Exemple #5
0
        public static async Task <ProductCategoryInitializer> Create(
            IServiceInstanceManager ServiceInstanceManager,
            IProductCategoryManager CategoryManager,
            IProductItemManager ItemManager,
            long sellerId,
            long?ScopeId,
            ProductTypeInitializer types
            )
        {
            var special = await CategoryManager.EnsureEntity(
                await CategoryManager.QuerySingleEntityIdent(new CategoryQueryArgument {
                Name = "特别分类"
            }),
                (CategoryInternal c) =>
            {
                c.Name        = "特别分类";
                c.Title       = "特别分类";
                c.ObjectState = EntityLogicState.Enabled;
                c.Children    = CategoryManager.FillTreeIdentByName(
                    ObjectKey.From(c.Id),
                    new[]
                {
                    new CategoryInternal
                    {
                        Name        = "十元",
                        Title       = "十元",
                        Image       = StaticRes.File + "-pc-cols-1-jpg",
                        Tag         = "10",
                        ObjectState = EntityLogicState.Enabled,
                    },
                    new CategoryInternal
                    {
                        Name        = "上线充值活动",
                        Title       = "上线充值活动",
                        Tag         = "recharge-activity",
                        ObjectState = EntityLogicState.Enabled,
                    },
                    //new Bizness.Products.Models.ProductCategoryEditable
                    //{
                    //	Name="百元",
                    //	Title="百元",
                    //	Image = "yg-cols-100-jpg",
                    //	Tag="100",
                    //	ObjectState=ServiceProtocol.ObjectManager.LogicObjectState.Enabled,
                    //},
                    //new Bizness.Products.Models.ProductCategoryEditable
                    //{
                    //	Name="限购",
                    //	Title="限购",
                    //	Image = "yg-cols-limit-jpg",
                    //	Tag = "limit",
                    //	ObjectState=ServiceProtocol.ObjectManager.LogicObjectState.Enabled,
                    //},
                    //new Bizness.Products.Models.ProductCategoryEditable
                    //{
                    //	Name="新手",
                    //	Title="新手",
                    //	Image = "yg-cols-newuser-jpg",
                    //	Tag = "new",
                    //	ObjectState=ServiceProtocol.ObjectManager.LogicObjectState.Enabled,
                    //}
                },
                    (pid, i) => new CategoryQueryArgument {
                    ParentId = i.ParentId, Name = i.Name
                },
                    ic => ic.Children,
                    (ic, i) => ic.Id = i.Id
                    ).Result;
            });

            var standard = await CategoryManager.EnsureEntity(
                await CategoryManager.QuerySingleEntityIdent(new CategoryQueryArgument {
                Name = "标准分类"
            }),
                (CategoryInternal c) =>
            {
                c.Name        = "标准分类";
                c.Title       = "标准分类";
                c.ObjectState = EntityLogicState.Enabled;
                c.Children    = CategoryManager.FillTreeIdentByName(
                    ObjectKey.From(c.Id), new[] {
                    new CategoryInternal {
                        Order = 1, Name = "话费充值", Title = "话费充值", Description = "移动 联通 电信", Icon = StaticRes.File + "-pc-prdcats-recharge18-png", Image = StaticRes.File + "-pc-prdcats-recharge64-png"
                    },
                    new CategoryInternal {
                        Order = 2, Name = "手机", Title = "手机专区", Description = "三星 iPhone 华为", Icon = StaticRes.File + "-pc-prdcats-phone18-png", Image = StaticRes.File + "-pc-prdcats-phone64-png"
                    },
                    new CategoryInternal {
                        Order = 3, Name = "数码", Title = "数码专区", Description = "佳能 尼康 索尼", Icon = StaticRes.File + "-pc-prdcats-camera18-png", Image = StaticRes.File + "-pc-prdcats-camera64-png"
                    },
                    new CategoryInternal {
                        Order = 4, Name = "汽车", Title = "汽车专区", Description = "奔驰 大众 宝马", Icon = StaticRes.File + "-pc-prdcats-car18-png", Image = StaticRes.File + "-pc-prdcats-car64-png"
                    },
                    new CategoryInternal {
                        Order = 5, Name = "黄金", Title = "黄金专区", Description = "金条 金元宝", Icon = StaticRes.File + "-pc-prdcats-gold18-png", Image = StaticRes.File + "-pc-prdcats-gold64-png"
                    },
                },
                    (pid, i) => new CategoryQueryArgument {
                    ParentId = i.ParentId, Name = i.Name
                },
                    ic => ic.Children,
                    (ic, i) => ic.Id = i.Id
                    ).Result;
                //Children=types.Types.Select(
                //	t=>new Bizness.Products.Models.ProductCategoryEditable
                //	{
                //		Name=t.Title,
                //		Title=t.Title,
                //		Image=t.Image,
                //		Icon=t.Icon,
                //		ObjectState=ServiceProtocol.ObjectManager.LogicObjectState.Enabled,
                //	}
                //	).ToArray()
            });

            //var special = cats.Where(c => c.Name == "特别分类").Single();
            //var c100 = cats.Where(c => c.Name == "百元").Single();
            //var c10 = cats.Where(c => c.Name == "十元").Single();
            //var recharge = cats.Where(c => c.Name == "上线充值活动").Single();
            //var climit = cats.Where(c => c.Name == "限购").Single();
            //var cnew = cats.Where(c => c.Name == "新手").Single();

            //var standard = cats.Where(c => c.Name == "标准分类").Single();
            var ctypes = (await CategoryManager.QueryAsync(new CategoryQueryArgument {
                ParentId = standard.Id
            }, Paging.All)).Items.ToArray();


            //var ctx = scope.Resolve<IDataContext>();

            var setCatProduct = new Func <string, string, Task>(async(cat, typeName) =>
            {
                var type  = ctypes.First(c => c.Name == cat);
                var ptype = types.Types.Where(t => t.Name == typeName).Single();
                var ids   = await ItemManager.QueryIdentsAsync(new ItemQueryArgument {
                    TypeId = ptype.Id
                }, Paging.All);
                //await ctx.ReadOnly<DataModels.ProductItem>()
                //                .Where(i => i.SourceItemId == null && i.Product.TypeId == ptype.Id)
                //                .Select(i => i.Id).ToArrayAsync();
                await CategoryManager.SetItems(type.Id, ids.Items.Select(i => i.Id).ToArray());
            });

            await setCatProduct("话费充值", "话费充值");
            await setCatProduct("手机", "手机");
            await setCatProduct("数码", "数码");
            await setCatProduct("汽车", "汽车");
            await setCatProduct("黄金", "黄金");


            //         foreach (var type in ctypes)
            //{
            //	var ptype = types.Types.Where(t => t.Name == type.Name).Single();
            //	var ids = await ctx.ReadOnly<DataModels.ProductItem>()
            //		.Where(i => i.SourceItemId == null && i.Product.TypeId == ptype.Id)
            //		.Select(i => i.Id).ToArrayAsync();
            //	await scope.ProductCategorySetItems(type.Id, ids);
            //}


            //         var pids100=await ctx.ReadOnly<DataModels.ProductItem>()
            //	.Where(p => p.SourceItemId==null && p.Product.CFPriceUnitExpect == 100)
            //	.Select(p => p.Id).ToArrayAsync();

            //await scope.ProductCategorySetItems(c100.Id, pids100);


            //var pids10 = await ctx.ReadOnly<DataModels.ProductItem>()
            //	.Where(p => p.SourceItemId == null && p.Product.CFPriceUnitExpect == 10)
            //	.Select(p => p.Id).ToArrayAsync();

            //await scope.ProductCategorySetItems(c10.Id, pids10);

            //var activityProducts = new[]
            //{
            //    "中国移动50元话费充值卡",
            //    "中国移动100元话费充值卡",
            //    "中国移动500元话费充值卡",
            //    "中国电信500元话费充值卡",
            //    "OPPO R9s 全网通4G+64GB 双卡双待手机 玫瑰金",
            //    "华为P9 全网通 4GB+64GB版 玫瑰金 移动联通电信4G手机 双卡双待",
            //    "iPhone 7 128GB 土豪金 移动联通电信4G手机",
            //    "iPhone 7 128GB 玫瑰金 移动联通电信4G手机",
            //    "凯迪拉克ATS-L 2016款 28T 精英型",
            //    "奥迪A4L 2017款40TFSI 时尚型",
            //    "奔驰C200 2016款C200L4MATIC 运动版",
            //    "斯巴鲁  傲虎 2.5运动导航版"
            //};

            //var pidsRecharge = await ctx.ReadOnly<DataModels.ProductItem>()
            //    .Where(p => activityProducts.Contains(p.Product.Title))
            //    .Select(p=>new { name = p.Product.Title, id = p.Id })
            //    .Take(12).ToDictionaryAsync(p => p.name, p => p.id);

            //await scope.ProductCategorySetItems(recharge.Id, activityProducts.Select(p=>pidsRecharge.Get(p)).Where(i=>i>0).ToArray());

            //var pids_limit = await ctx.ReadOnly<DataModels.ProductItem>()
            //	.OrderByDescending(p=>p.Id)
            //	.Take(100)
            //	.Select(p => p.Id).ToArrayAsync();

            //await scope.ProductCategorySetItems(climit.Id, pids_limit);


            //var pids_newuser = await ctx.ReadOnly<DataModels.ProductItem>()
            //	.OrderByDescending(p => p.Price)
            //	.Take(100)
            //	.Select(p => p.Id).ToArrayAsync();
            //await scope.ProductCategorySetItems(cnew.Id, pids_newuser);


            await ServiceInstanceManager.UpdateSetting <HygouSetting>(
                ScopeId,
                s =>
            {
                s.MainProductCategoryId = standard.Id;
            });

            return(new ProductCategoryInitializer
            {
                //C10 = c10,
                //C100 = c100,
                //Limit = climit,
                //NewUser = cnew,
                MainProductCategoryId = standard.Id,
                SpecialCategoryRoot = special,
                TypedCategoryRoot = standard,
                TypedCategorys = ctypes
            });
        }