コード例 #1
0
ファイル: PreviewController.cs プロジェクト: wjydc/YueDu_v3
        public ActionResult Index()
        {
            #region

            string absoluteUrl = "";
            if (EnvSettings.Domain.IsInvalid(out absoluteUrl))
            {
                return(Redirect(absoluteUrl));
            }

            #endregion

            Novel novel = _bookService.GetNovel(NovelId);
            if (novel != null && novel.Id > 0)
            {
                InitializeChapterPager();
                bool IsNovel = novel.ContentType == (int)Constants.Novel.ContentType.小说;

                if (IsNovel)
                {
                    Chapter chapter = _chapterService.GetChapter(NovelId, ChapterCode, ChapterDirection, out ChapterCode);

                    if (chapter != null && chapter.Id > 0 && IsRead(_orderService))
                    {
                        // 分页
                        string replyText         = null;
                        bool   isPreChapterCode  = false;
                        bool   isNextChapterCode = false;
                        string url = GetChapterPager("/preview", ChapterCode, out replyText, out isPreChapterCode, out isNextChapterCode);

                        //小说阅读记录
                        ReadLog(currentUser.UserName, NovelId, chapter.Id, ChapterCode);

                        //最近阅读日志
                        RecentReadContext.Save(novel, chapter.ChapterName, ChapterCode, RouteChannelId, currentUser.UserId);

                        ChapterDetailView detailView = new ChapterDetailView()
                        {
                            Novel             = new SimpleResponse <Novel>(true, novel),
                            Chapter           = new SimpleResponse <Chapter>(true, chapter),
                            ChapterContent    = IsNovel ? FileHelper.ReadFile(FileHelper.MergePath("\\", new string[] { novel.FilePath, chapter.FileName }), chapter.ChapterName) : "",
                            IsPreChapterCode  = isPreChapterCode,
                            IsNextChapterCode = isNextChapterCode,
                            PreChapterUrl     = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.pre, channelId: RouteChannelId),
                            NextChapterUrl    = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.next, channelId: RouteChannelId),
                            ReplyText         = replyText
                        };

                        return(View(detailView));
                    }
                }
            }

            return(Redirect(DataContext.GetErrorUrl(ErrorMessage.小说不存在, channelId: RouteChannelId)));
        }
コード例 #2
0
ファイル: OrderController.cs プロジェクト: wjydc/YueDu_v3
        public ActionResult AllAudioPackage()
        {
            string url = "";

            ErrorMessage     errorMessage = ErrorMessage.失败;
            PackageOrderInfo model        = new PackageOrderInfo();

            model                  = GetLogInfo(model) as PackageOrderInfo;
            model.UserName         = currentUser.UserName;
            model.Fee              = SiteSection.Audio.AllPackageFee;
            model.Cash             = SiteSection.Audio.AllPackageFee;
            model.Status           = (int)Constants.Status.yes;
            model.OrderTime        = DateTime.Now;
            model.AutoRenew        = 0;
            model.Balance          = 0;
            model.BeginTime        = DateTime.Now;
            model.EndTime          = DateTime.Now;
            model.FeeId            = 0;
            model.Integral         = 0;
            model.OrderCode        = "";
            model.OrderContentType = 2;
            model.PackageId        = 0;
            model.PackageTitle     = "";
            model.PayChannel       = 0;
            model.Rebate           = 0;
            model.RebateExpression = "";
            model.RebateFee        = 0;
            model.CancelTime       = DateTime.Now;
            int result = _orderService.OrderPackage(model);

            if (EnumHelper.TryParsebyValue <ErrorMessage>(result, out errorMessage))
            {
                switch (errorMessage)
                {
                case ErrorMessage.成功:
                    url = NovelId > 0 ? ChapterContext.GetUrl("/chapter/detail", NovelId, ChapterCode, channelId: RouteChannelId) : "/";
                    break;

                case ErrorMessage.余额不足:
                    url = StringHelper.GetReturnUrl("/order/recharge", UrlParameterHelper.GetParams("returnUrl"), channelId: RouteChannelId);
                    break;

                case ErrorMessage.已包月:
                    url = ChapterContext.GetUrl("/chapter/detail", NovelId, ChapterCode, channelId: RouteChannelId);
                    break;

                case ErrorMessage.用户不存在:
                    url = DataContext.GetErrorUrl(ErrorMessage.用户不存在, channelId: RouteChannelId);
                    break;
                }
            }

            return(Redirect(url));
        }
コード例 #3
0
ファイル: ChapterController.cs プロジェクト: wjydc/YueDu_v3
        public void Read()
        {
            string userName = currentUser.UserName;

            if (!string.IsNullOrEmpty(userName) && NovelId > 0)
            {
                ILogService         service = DataContext.ResolveService <ILogService>();
                NovelReadRecordInfo model   = service.GetRecentChapter(userName, NovelId);
                if (model != null && model.Id > 0)
                {
                    ChapterCode = model.ChapterCode;
                }
            }

            Redirect(ChapterContext.GetUrl("/chapter/detail", NovelId, ChapterCode, ChapterDirection, channelId: RouteChannelId));
        }
コード例 #4
0
        public ActionResult Open(int cType = 0)
        {
            string url = "/".GetChannelRouteUrl(RouteChannelId);
            NovelRecentReadListView readLog = RecentReadContext.Get(RecentReadContext.GetCookieName(cType), _logService, currentUser.UserName, currentUser.UserId);

            if (!readLog.IsNullOrEmpty <NovelRecentReadListView>() && !readLog.List.IsNullOrEmpty <IList <NovelRecentReadView> >())
            {
                NovelRecentReadView info = readLog.List.Reverse().FirstOrDefault();
                if (info != null && info.Id > 0)
                {
                    string channelId = string.IsNullOrEmpty(info.RouteChannelId) ? RouteChannelId : info.RouteChannelId;
                    url = ChapterContext.GetUrl("/chapter/detail", info.Id, info.ChapterCode, channelId: channelId);
                }
            }
            return(Redirect(url));
        }
コード例 #5
0
        public ActionResult Open(int cType = 0, int ccid = 0)
        {
            Constants.Novel.StatisticType statisticType = Constants.Novel.StatisticType.none;
            string channelId = _channelCompanyService.GetRecentReadChannelId(ccid, RouteChannelId, out statisticType);

            if (IsRouteChannel)
            {
                string promotionCode = HeaderInfo.PromotionCode;

                if (statisticType == Constants.Novel.StatisticType.promotion)
                {
                    PromotionLink promote = _promotionLinkService.Detail("and ChannelCode = @channelId and PromotionCode = @promotionCode", new { channelId, promotionCode });
                    if (promote != null && promote.Id > 0 && !string.IsNullOrEmpty(promotionCode))
                    {
                        #region 统计推广码关注人数

                        if (ccid > 0)
                        {
                            string follow = CookieHelper.Get(string.Concat("tgf_", ccid));
                            if (string.IsNullOrEmpty(follow))
                            {
                                _promotionLinkService.Update(" FollowCount = ISNULL(FollowCount, 0) + 1 ", promote.Id);
                                CookieHelper.Set(string.Concat("tgf_", ccid), StringHelper.ToString(DateTime.Now.ToFileTime()));
                            }
                        }

                        #endregion 统计推广码关注人数
                    }
                    else
                    {
                    }
                }
            }

            string url = "/".GetChannelRouteUrl(channelId);
            NovelRecentReadListView readLog = RecentReadContext.Get(RecentReadContext.GetCookieName(cType), _logService, currentUser.UserName, currentUser.UserId);
            if (!readLog.IsNullOrEmpty <NovelRecentReadListView>() && !readLog.List.IsNullOrEmpty <IList <NovelRecentReadView> >())
            {
                NovelRecentReadView info = readLog.List.Reverse().FirstOrDefault();
                if (info != null && info.Id > 0)
                {
                    url = ChapterContext.GetUrl("/chapter/detail", info.Id, info.ChapterCode, channelId: channelId);
                }
            }
            return(Redirect(url));
        }
コード例 #6
0
        public ActionResult Open(int cType = 0, int?cid = 0)
        {
            int    channelCompanyId = cid.HasValue ? cid.ToInt() : 0;
            string channelId        = _channelCompanyService.GetRecentReadChannelId(channelCompanyId, RouteChannelId);

            string url = "/".GetChannelRouteUrl(channelId);
            NovelRecentReadListView readLog = RecentReadContext.Get(RecentReadContext.GetCookieName(cType), currentUser.UserId);

            if (!readLog.IsNullOrEmpty <NovelRecentReadListView>() && !readLog.List.IsNullOrEmpty <IList <NovelRecentReadView> >())
            {
                NovelRecentReadView info = readLog.List.Reverse().FirstOrDefault();
                if (info != null && info.Id > 0)
                {
                    url = ChapterContext.GetUrl("/chapter/detail", info.Id, info.ChapterCode, channelId: channelId);
                }
            }
            return(Redirect(url));
        }
コード例 #7
0
ファイル: BookController.cs プロジェクト: wjydc/YueDu_v3
        public ActionResult BeginRead(int novelId, int code)
        {
            string readUrl = ChapterContext.GetUrl("/chapter/detail", novelId, code, channelId: RouteChannelId);

            return(Redirect(readUrl));
        }
コード例 #8
0
ファイル: ChapterController.cs プロジェクト: wjydc/YueDu_v3
        public ActionResult Detail()
        {
            string hideUrl = "";

            if (ChapterContext.VerifyRedirect(NovelId, ChapterCode, ChapterDirection, out hideUrl, SiteSection.Chapter.IsRedirectWeChat))
            {
                return(Redirect(hideUrl));
            }

            SetReadMode();
            Novel novel = _bookService.GetNovel(NovelId);

            if (novel != null && novel.Id > 0)
            {
                InitializeChapterPager();

                Chapter chapter = _chapterService.GetChapter(NovelId, ChapterCode, ChapterDirection, out ChapterCode);
                if (chapter != null && chapter.Id > 0 && IsRead(_orderService))
                {
                    #region

                    bool   isPreChapterCode  = false;
                    bool   isNextChapterCode = false;
                    string url = GetChapterPager("/chapter/detail", ChapterCode, out isPreChapterCode, out isNextChapterCode);

                    #endregion

                    #region 推荐阅读

                    //推荐阅读 - 轮循广告
                    int adClassId           = RecSection.BookChapterDetail.Ad;
                    IEnumerable <AD> adList = GetADList(adClassId, novel.Id, 3);

                    #endregion

                    //阅读记录
                    ReadLog(currentUser.UserName, chapter.NovelId, chapter.Id, chapter.ChapterCode);

                    //最近阅读日志
                    RecentReadContext.Save(novel, chapter.ChapterName, ChapterCode, RouteChannelId, currentUser.UserId);

                    //是否收藏
                    bool isMark = _bookmarkService.Exists(NovelId, currentUser.UserName);

                    //漫画目录
                    IEnumerable <ExtendChapterView> extendChapterList = GetExtendChapterList(novel);

                    //千字价格
                    int chapterWordSizeFee = GetChapterWordSizeFee(novel.ChapterWordSizeFee);

                    //章节正文
                    string chapterContent = GetContent(novel.ContentType, chapter.ChapterName, novel.FilePath, chapter.FileName);

                    ChapterDetailView detailView = new ChapterDetailView()
                    {
                        Novel                    = new SimpleResponse <Novel>(true, novel),
                        Chapter                  = new SimpleResponse <Chapter>(true, chapter),
                        ChapterFee               = GetFee(chapter.WordSize, chapterWordSizeFee),
                        ChapterContent           = chapterContent,
                        IsPreChapterCode         = isPreChapterCode,
                        IsNextChapterCode        = isNextChapterCode,
                        PreChapterUrl            = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.pre, channelId: RouteChannelId),
                        NextChapterUrl           = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.next, channelId: RouteChannelId),
                        AdList                   = new SimpleResponse <IEnumerable <AD> >(!adList.IsNullOrEmpty <AD>(), adList),
                        IsMark                   = isMark,
                        ExtendChapterList        = new SimpleResponse <IEnumerable <ExtendChapterView> >(!extendChapterList.IsNullOrEmpty <ExtendChapterView>(), extendChapterList),
                        ChapterAudioUrl          = GetAudioUrl(novel.ContentType, chapter.FileName),
                        HitUrl                   = GetHitUrl(),
                        ShowQrCodeMinChapterCode = StringHelper.ToInt(UrlParameterHelper.GetParams("qrdx"))
                    };

                    if (novel.ContentType == (int)Constants.Novel.ContentType.漫画)
                    {
                        return(View("/views/cartoonchapter/detail.cshtml", detailView));
                    }
                    else if (novel.ContentType == (int)Constants.Novel.ContentType.听书)
                    {
                        return(View("/views/audiochapter/detail.cshtml", detailView));
                    }
                    else
                    {
                        return(View(detailView));
                    }
                }
                else
                {
                    if (novel.FeeType == (int)Constants.Novel.FeeType.chapter || novel.FeeType == (int)Constants.Novel.FeeType.novelchapter)
                    {
                        return(Redirect(ChapterContext.GetUrl("/preorder/chapter", NovelId, ChapterCode, channelId: RouteChannelId)));
                    }
                    else if (novel.FeeType == (int)Constants.Novel.FeeType.novel)
                    {
                        return(Redirect(ChapterContext.GetUrl("/preorder/novel", NovelId, ChapterCode, channelId: RouteChannelId)));
                    }
                }
            }

            return(Redirect(DataContext.GetErrorUrl(ErrorMessage.小说不存在, channelId: RouteChannelId)));
        }
コード例 #9
0
        public ActionResult T(int id = 0, string type = "")
        {
            Constants.Novel.PromotionType promotionType = Constants.Novel.PromotionType.none;
            string url = "";

            if (id > 0)
            {
                if (EnumHelper.TryParsebyName <Constants.Novel.PromotionType>(type, out promotionType))
                {
                    if (promotionType == Constants.Novel.PromotionType.pmc)
                    {
                        PromotionLink promotionLink = _promotionLinkService.Detail(id);
                        if (promotionLink != null && promotionLink.Id > 0 &&
                            !string.IsNullOrEmpty(promotionLink.ChannelCode) &&
                            !string.IsNullOrEmpty(promotionLink.PromotionCode))
                        {
                            SetSessionHeaderInfoFromRoute(promotionLink.ChannelCode, promotionLink.PromotionCode);

                            string chapterUrl  = "/chapter/detail/".GetChannelRouteUrl(promotionLink.ChannelCode);
                            int    chapterCode = promotionLink.EndChapterCode > promotionLink.StartChapterCode ? promotionLink.EndChapterCode : 0;

                            if (promotionLink.FuncType == 1)
                            {
                                IDictionary <string, object> dict = new Dictionary <string, object>();
                                dict.Add("c", ChapterContext.GetRangeToken(promotionLink.EndChapterCode, promotionLink.FollowChapter));
                                dict.Add("rp", ChapterContext.GetReplyText(promotionLink.ReplyKeywords));
                                chapterUrl = "/preview".GetChannelRouteUrl(promotionLink.ChannelCode).SpliceUrl(dict);
                            }

                            url = ChapterContext.GetUrl(chapterUrl, promotionLink.NovelId, chapterCode, Constants.Novel.ChapterDirection.none, channelId: RouteChannelId);
                        }
                    }
                    else if (promotionType == Constants.Novel.PromotionType.rk)
                    {
                        PromotionLink promotionLink = _promotionLinkService.Detail(id);
                        if (promotionLink != null && promotionLink.Id > 0 &&
                            !string.IsNullOrEmpty(promotionLink.ChannelCode) &&
                            !string.IsNullOrEmpty(promotionLink.PromotionCode))
                        {
                            SetSessionHeaderInfoFromRoute(promotionLink.ChannelCode, promotionLink.PromotionCode);

                            string chapterUrl = "/chapter/detail/".GetChannelRouteUrl(promotionLink.ChannelCode);

                            url = ChapterContext.GetUrl(chapterUrl, promotionLink.NovelId, promotionLink.FollowChapter, Constants.Novel.ChapterDirection.none, channelId: RouteChannelId);
                        }
                    }
                }
                else
                {
                    NovelPromotionChannel model = _novelPromotionChannelService.Detail(id);
                    if (model != null && model.NovelId > 0 && model.ChapterCode >= 0)
                    {
                        string chapterUrl = "chapter/detail";
                        string channelId  = model.ChannelId;

                        if (!string.IsNullOrEmpty(channelId))
                        {
                            chapterUrl = string.Concat(chapterUrl, "?channelid=", channelId);
                        }
                        url = ChapterContext.GetUrl(chapterUrl, model.NovelId, model.ChapterCode, channelId: RouteChannelId);
                    }
                }
            }

            if (string.IsNullOrEmpty(url))
            {
                url = DataContext.GetErrorUrl(channelId: RouteChannelId);
            }

            return(Redirect(url));
        }
コード例 #10
0
ファイル: OrderController.cs プロジェクト: wjydc/YueDu_v3
        public ActionResult Novel()
        {
            string url = "";

            Novel novelInfo = _bookService.GetNovel(NovelId, (int)Constants.Status.yes);

            if (!novelInfo.IsNullOrEmpty <Novel>() && novelInfo.Id > 0)
            {
                ErrorMessage errorMessage = ErrorMessage.失败;
                switch (novelInfo.FeeType)
                {
                case (int)Constants.Novel.FeeType.novel:
                case (int)Constants.Novel.FeeType.novelchapter:
                    int result = Novel(novelInfo);
                    if (EnumHelper.TryParsebyValue <ErrorMessage>(result, out errorMessage))
                    {
                        switch (errorMessage)
                        {
                        case ErrorMessage.成功:
                            url = ChapterContext.GetUrl("/chapter/detail", NovelId, ChapterCode, channelId: RouteChannelId);
                            break;

                        case ErrorMessage.余额不足:
                            url = StringHelper.GetReturnUrl("/order/recharge", UrlParameterHelper.GetParams("returnUrl"), channelId: RouteChannelId);
                            break;

                        case ErrorMessage.已购买过该小说:
                            url = ChapterContext.GetUrl("/chapter/detail", NovelId, ChapterCode, channelId: RouteChannelId);
                            break;

                        case ErrorMessage.用户不存在:
                            url = DataContext.GetErrorUrl(ErrorMessage.用户不存在, channelId: RouteChannelId);
                            break;

                        case ErrorMessage.小说不存在:
                            url = DataContext.GetErrorUrl(ErrorMessage.小说不存在, channelId: RouteChannelId);
                            break;

                        case ErrorMessage.小说章节不存在:
                            url = DataContext.GetErrorUrl(ErrorMessage.小说章节不存在, channelId: RouteChannelId);
                            break;

                        case ErrorMessage.该小说标价有误无法购买:
                            url = DataContext.GetErrorUrl(ErrorMessage.该小说标价有误无法购买, channelId: RouteChannelId);
                            break;

                        case ErrorMessage.该小说无法按本计费:
                            url = DataContext.GetErrorUrl(ErrorMessage.该小说无法按本计费, channelId: RouteChannelId);
                            break;

                        default:
                            url = DataContext.GetErrorUrl(ErrorMessage.未知错误, channelId: RouteChannelId);
                            break;
                        }
                    }
                    break;

                case (int)Constants.Novel.FeeType.chapter:
                    url = ChapterContext.GetUrl("/preorder/chapter", NovelId, ChapterCode, channelId: RouteChannelId);
                    break;
                }
            }

            return(Redirect(url));
        }
コード例 #11
0
        public ActionResult Detail()
        {
            #region

            string absoluteUrl = "";
            if (EnvSettings.Domain.IsInvalid(out absoluteUrl))
            {
                return(Redirect(absoluteUrl));
            }

            #endregion

            SetReadMode();
            Novel novel = _bookService.GetNovel(NovelId);
            if (novel != null && novel.Id > 0)
            {
                InitializeChapterPager();

                Chapter chapter = _chapterService.GetChapter(NovelId, ChapterCode, ChapterDirection, out ChapterCode);
                if (chapter != null && chapter.Id > 0 && IsRead(_orderService))
                {
                    #region

                    bool   isPreChapterCode  = false;
                    bool   isNextChapterCode = false;
                    string url = GetChapterPager("/chapter/detail", ChapterCode, out isPreChapterCode, out isNextChapterCode);

                    #endregion

                    #region 推荐阅读

                    //推荐阅读 - 轮循广告
                    int adClassId           = RecSection.BookChapterDetail.Ad;
                    IEnumerable <AD> adList = GetADList(adClassId, novel.Id, 3);

                    #endregion

                    //阅读记录
                    ReadLog(currentUser.UserName, chapter.NovelId, chapter.Id, chapter.ChapterCode);

                    //最近阅读日志
                    RecentReadContext.Save(novel, chapter.ChapterName, ChapterCode, RouteChannelId, currentUser.UserId);

                    //是否收藏
                    bool isMark = _bookmarkService.Exists(NovelId, currentUser.UserName);

                    //漫画目录
                    IEnumerable <ExtendChapterView> extendChapterList = GetExtendChapterList(novel);

                    // 千字价格
                    int chapterWordSizeFee = GetChapterWordSizeFee(novel.ChapterWordSizeFee);
                    //正文中插入用户信息
                    string encryptInfo = string.IsNullOrEmpty(currentUser.UserName) ? null : string.Concat("16", ";", currentUser.UserName.Substring(1));

                    ChapterDetailView detailView = new ChapterDetailView()
                    {
                        Novel                    = new SimpleResponse <Novel>(true, novel),
                        Chapter                  = new SimpleResponse <Chapter>(true, chapter),
                        ChapterFee               = GetFee(chapter.WordSize, chapterWordSizeFee),
                        ChapterContent           = StringHelper.ConvertAndSignTxt((novel.ContentType == (int)Constants.Novel.ContentType.小说) ? FileHelper.ReadFile(FileHelper.MergePath("\\", new string[] { novel.FilePath, chapter.FileName }), chapter.ChapterName) : "", Constants.SecurityKey.userAESId.ToLower(), encryptInfo),
                        IsPreChapterCode         = isPreChapterCode,
                        IsNextChapterCode        = isNextChapterCode,
                        PreChapterUrl            = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.pre, channelId: RouteChannelId),
                        NextChapterUrl           = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.next, channelId: RouteChannelId),
                        AdList                   = new SimpleResponse <IEnumerable <AD> >(!adList.IsNullOrEmpty <AD>(), adList),
                        IsMark                   = isMark,
                        ExtendChapterList        = new SimpleResponse <IEnumerable <ExtendChapterView> >(!extendChapterList.IsNullOrEmpty <ExtendChapterView>(), extendChapterList),
                        ChapterAudioUrl          = GetAudioUrl(novel.ContentType, chapter.FileName),
                        HitUrl                   = GetHitUrl(),
                        ShowQrCodeMinChapterCode = StringHelper.ToInt(UrlParameterHelper.GetParams("qrdx"))
                    };

                    if (novel.ContentType == (int)Constants.Novel.ContentType.漫画)
                    {
                        return(View("/views/cartoonchapter/detail.cshtml", detailView));
                    }
                    else if (novel.ContentType == (int)Constants.Novel.ContentType.听书)
                    {
                        return(View("/views/audiochapter/detail.cshtml", detailView));
                    }
                    else
                    {
                        return(View(detailView));
                    }
                }
                else
                {
                    if (novel.FeeType == (int)Constants.Novel.FeeType.chapter || novel.FeeType == (int)Constants.Novel.FeeType.novelchapter)
                    {
                        return(Redirect(ChapterContext.GetUrl("/preorder/chapter", NovelId, ChapterCode, channelId: RouteChannelId)));
                    }
                    else if (novel.FeeType == (int)Constants.Novel.FeeType.novel)
                    {
                        return(Redirect(ChapterContext.GetUrl("/preorder/novel", NovelId, ChapterCode, channelId: RouteChannelId)));
                    }
                }
            }

            return(Redirect(DataContext.GetErrorUrl(ErrorMessage.小说不存在, channelId: RouteChannelId)));
        }
コード例 #12
0
ファイル: PreOrderController.cs プロジェクト: wjydc/YueDu_v3
        public ActionResult Chapter()
        {
            SetReadMode();
            Novel novel = _bookService.GetNovel(NovelId);

            if (novel != null && novel.Id > 0)
            {
                if (novel.FeeType == (int)Constants.Novel.FeeType.novel)
                {
                    return(Redirect(DataContext.GetErrorUrl(ErrorMessage.该小说无法按章计费, channelId: RouteChannelId)));
                }

                InitializeChapterPager();

                Chapter chapter = _chapterService.GetChapter(NovelId, ChapterCode, ChapterDirection, out ChapterCode);
                if (chapter != null && chapter.Id > 0 && IsRead(_orderService))
                {
                    return(Redirect(ChapterContext.GetUrl("/chapter/detail", chapter.NovelId, chapter.ChapterCode, channelId: RouteChannelId)));
                }

                if (chapter != null && chapter.Id > 0)
                {
                    int i = 0;
                    if (int.TryParse(StringHelper.ToString(SessionHelper.Get("ancp")), out i) && i == NovelId)
                    {
                        return(Redirect(ChapterContext.GetUrl("/order/chapter", chapter.NovelId, chapter.ChapterCode, channelId: RouteChannelId)));
                    }

                    #region

                    bool   isPreChapterCode  = false;
                    bool   isNextChapterCode = false;
                    string url = GetChapterPager("/chapter/detail", ChapterCode, out isPreChapterCode, out isNextChapterCode);

                    #endregion

                    bool isMark = _bookmarkService.Exists(NovelId, currentUser.UserName);

                    // 千字价格
                    int chapterWordSizeFee       = GetChapterWordSizeFee(novel.ChapterWordSizeFee);
                    ChapterDetailView detailView = new ChapterDetailView()
                    {
                        Novel              = new SimpleResponse <Novel>(true, novel),
                        Chapter            = new SimpleResponse <Chapter>(true, chapter),
                        ChapterWordSizeFee = chapterWordSizeFee,
                        ChapterFee         = GetFee(chapter.WordSize, chapterWordSizeFee),
                        NovelFee           = GetFee((decimal)(novel.WordSize * 0.95f), chapterWordSizeFee),
                        ChapterContent     = (novel.ContentType == (int)Constants.Novel.ContentType.小说) ? StringHelper.CutString(FileHelper.ReadFile(FileHelper.MergePath("\\", new string[] { novel.FilePath, chapter.FileName }), chapter.ChapterName), 100, true) : "",
                        IsPreChapterCode   = isPreChapterCode,
                        IsNextChapterCode  = isNextChapterCode,
                        PreChapterUrl      = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.pre, channelId: RouteChannelId),
                        NextChapterUrl     = ChapterContext.GetUrl(url, NovelId, ChapterCode, Constants.Novel.ChapterDirection.next, channelId: RouteChannelId),
                        UserBalance        = GetUserBalance(),
                        IsMark             = isMark
                    };

                    if (novel.ContentType == (int)Constants.Novel.ContentType.漫画)
                    {
                        return(View("/views/cartoonchapter/order.cshtml", detailView));
                    }
                    else if (novel.ContentType == (int)Constants.Novel.ContentType.听书)
                    {
                        return(View("/views/audiochapter/order.cshtml", detailView));
                    }
                    else
                    {
                        return(View("/views/chapter/order.cshtml", detailView));
                    }
                }
                else
                {
                    //章节不存在
                    return(Redirect(DataContext.GetErrorUrl(ErrorMessage.小说章节不存在, channelId: RouteChannelId)));
                }
            }
            else
            {
                //小说不存在
                return(Redirect(DataContext.GetErrorUrl(ErrorMessage.小说不存在, channelId: RouteChannelId)));
            }
        }