コード例 #1
0
        private void BeginRelease()
        {
            List <M_Release> list = GetModel();

            if (list == null)
            {
                return;
            }
            File.Delete(function.VToP(vpath));
            foreach (M_Release model in list)
            {
                #region 生成
                switch (model.MyRType)
                {
                case M_Release.RType.Index:    //生成全站首页或栏目首页
                    if (string.IsNullOrEmpty(model.NodeIDS))
                    {
                        bc.CreatePageIndex();
                    }
                    //else { bc.CreatePageIndex(DataConverter.CLng(model.NodeIDS)); }
                    break;

                case M_Release.RType.ALL:    //生成指定栏目下或全站的内容
                    CreateSiteAll(model.NodeIDS);
                    break;

                case M_Release.RType.IDRegion:
                    CreateByIDRegion(model);
                    break;

                case M_Release.RType.Newest:    //指定数量的最新文章
                    bc.CreateLastInfoRecord(model.Count.ToString());
                    break;

                case M_Release.RType.DateRegion:
                    CreateByDate(model);
                    break;

                case M_Release.RType.ByNodeIDS:    //通过栏目ID发布内容
                    bc.CreateInfoColumn(model.NodeIDS);
                    break;

                case M_Release.RType.ALLNode:    //所有栏目的内容页
                    bc.CreateColumnAll();
                    break;

                case M_Release.RType.NodeIDS:    //发布选定栏目页
                    bc.CreateColumnByID(model.NodeIDS);
                    break;

                case M_Release.RType.ALLSPage:
                    bc.CreateSingle();
                    break;

                case M_Release.RType.SPage:    //取出指定单页信息,交于节点生成方法生成
                    bc.CreateColumnByID(model.NodeIDS);
                    break;

                case M_Release.RType.Special:
                    bc.CreateSpecial(model.NodeIDS);
                    break;

                case M_Release.RType.Gids:    //发布选定的多个内容页
                    bc.createann(model.Gids);
                    break;

                default:
                    ZLLog.L(Model.ZLEnum.Log.safe, "指定的生成方式不存在");
                    return;
                }//switch end;
                #endregion
            }
            if (contentCount < 1 && bc.m_CreateCount > 0)
            {
                //后期全部转移至此
                contentCount = bc.m_CreateCount;
            }
            ResutList.Add(new M_ReleaseResult()
            {
                ResultMsg = "<i class=\"fa fa-check-circle\"></i>生成请求处理完成",
                Status    = 99,
                Count     = contentCount,
                IsEnd     = true
            });
        }
コード例 #2
0
        private static Task BeginRelease()
        {
            List <M_Release> list = GetModel();

            if (list == null || list.Count < 1)
            {
                AddResult("<i class='fa fa-lightbulb-o'></i> 没有需要生成的内容"); return(Task.CompletedTask);
            }
            File.Delete(function.VToP(vpath));
            foreach (M_Release model in list)
            {
                try
                {
                    #region 生成
                    switch (model.MyRType)
                    {
                    case M_Release.RType.Index:    //生成全站首页或栏目首页
                        if (string.IsNullOrEmpty(model.NodeIDS))
                        {
                            bc.CreatePageIndex();
                        }
                        //else { bc.CreatePageIndex(DataConverter.CLng(model.NodeIDS)); }
                        break;

                    case M_Release.RType.ALL:    //生成指定栏目下或全站的内容
                        CreateSiteAll(model.NodeIDS);
                        break;

                    case M_Release.RType.IDRegion:
                        CreateByIDRegion(model);
                        break;

                    case M_Release.RType.Newest:    //指定数量的最新文章
                        bc.CreateLastInfoRecord(model.Count.ToString());
                        break;

                    case M_Release.RType.DateRegion:
                        CreateByDate(model);
                        break;

                    case M_Release.RType.ByNodeIDS:    //通过栏目ID发布内容
                        bc.CreateInfoColumn(model.NodeIDS);
                        break;

                    case M_Release.RType.ALLNode:    //所有栏目的内容页
                        bc.CreateColumnAll();
                        break;

                    case M_Release.RType.NodeIDS:    //发布选定栏目页
                        bc.CreateColumnByID(model.NodeIDS);
                        break;

                    case M_Release.RType.ALLSPage:
                        bc.CreateSingle();
                        break;

                    case M_Release.RType.SPage:    //取出指定单页信息,交于节点生成方法生成
                        bc.CreateColumnByID(model.NodeIDS);
                        break;

                    case M_Release.RType.Special:    //生成专题列表页与所属内容页
                        bc.CreateSpecial(model.NodeIDS);
                        break;

                    case M_Release.RType.Gids:    //发布选定的多个内容页
                        bc.createann(model.Gids);
                        break;

                    default:
                        ZLLog.L(Model.ZLEnum.Log.labelex, "指定的生成方式不存在");
                        return(Task.CompletedTask);
                    }//switch end;
                    #endregion
                }
                catch (Exception ex) { ZLLog.L(Model.ZLEnum.Log.labelex, "BeginRelease--," + JsonConvert.SerializeObject(model) + "原因:" + ex.Message); }
            }
            if (contentCount < 1 && bc.m_CreateCount > 0)
            {
                contentCount = bc.m_CreateCount;
            }
            ResutList.Add(new M_ReleaseResult()
            {
                ResultMsg = "<i class=\"fa fa-check-circle\"></i>生成请求处理完成",
                Status    = 99,
                Count     = contentCount,
                IsEnd     = true
            });
            return(Task.CompletedTask);
        }