Esempio n. 1
0
        public int NovelReadLog(NovelLogInfo model)
        {
            string spName = "Wap.Novel_Log";

            var p = new DynamicParameters();

            p.Add("@NovelId", model.NovelId);
            p.Add("@CookieId", model.CookieId);
            p.Add("@UserId", model.UserId);
            p.Add("@UserName", model.UserName);
            p.Add("@ClientId", model.ClientId);
            p.Add("@Version", model.Version);
            p.Add("@UserAgent", model.UserAgent);
            p.Add("@IMEI", model.IMEI);
            p.Add("@IMSI", model.IMSI);
            p.Add("@ChannelId", model.ChannelId);
            p.Add("@SourceType", model.SourceType);
            p.Add("@Mobile", model.Mobile);
            p.Add("@NetType", model.NetType);
            p.Add("@Province", model.Province);
            p.Add("@City", model.City);
            p.Add("@ReferUrl", model.ReferUrl);
            p.Add("@IPAddress", model.IPAddress);
            p.Add("@RemoteHost", model.RemoteHost);
            p.Add("@AddTime", model.AddTime);
            //p.Add("@PromotionCode", model.PromotionCode);
            p.Add("@ROut", dbType: DbType.Int32, direction: ParameterDirection.Output);

            DbManage.Execute(spName, p, CommandType.StoredProcedure);

            return(p.Get <int>("@ROut"));
        }
Esempio n. 2
0
        public void AddNovelLog(NovelLogInfo logInfo)
        {
            var param = new DynamicParameters();

            param.Add("@NovelId", logInfo.NovelId);
            param.Add("@CookieId", logInfo.CookieId);
            param.Add("@ClientId", logInfo.ClientId);
            param.Add("@UserId", logInfo.UserId);
            param.Add("@UserName", logInfo.UserName);
            param.Add("@Version", logInfo.Version);
            param.Add("@UserAgent", logInfo.UserAgent);
            param.Add("@IMEI", logInfo.IMEI);
            param.Add("@IMSI", logInfo.IMSI);
            param.Add("@ChannelId", logInfo.ChannelId);
            param.Add("@SourceType", logInfo.SourceType);
            param.Add("@Mobile", logInfo.Mobile);
            param.Add("@NetType", logInfo.NetType);
            param.Add("@Province", logInfo.Province);
            param.Add("@City", logInfo.City);
            param.Add("@ReferUrl", logInfo.ReferUrl);
            param.Add("@IPAddress", logInfo.IPAddress);
            param.Add("@RemoteHost", logInfo.RemoteHost);
            param.Add("@AddTime", logInfo.AddTime);

            param.Add("@ROut", dbType: DbType.Int32, direction: ParameterDirection.Output);

            DbManage.Execute("Wap.Novel_Log", param, CommandType.StoredProcedure);
        }
Esempio n. 3
0
        public int NovelReadLog(NovelLogInfo model)
        {
            if (model == null)
            {
                return(0);
            }

            using (var conn = DbConnection(DbOperation.Write))
            {
                var repo = new Repository.LogRepo(conn);
                return(repo.NovelReadLog(model));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 书籍详情
        /// </summary>
        /// <param name="nid"></param>
        /// <returns></returns>
        public async Task <ActionResult> Detail(int novelId = 0)
        {
            string loginUserName = currentUser.UserName;
            Novel  novel         = null;

            if (novelId > 0)
            {
                novel = _bookService.GetNovel(novelId);
            }

            if (novel == null || novel.Id <= 0)
            {
                return(Redirect(DataContext.GetErrorUrl(ErrorMessage.小说不存在, channelId: RouteChannelId)));
            }

            BookDetailView view = novel.ToBookDetailView();
            //活动截止时间
            var packageInfo = await Task.Run(() => _packageService.GetNovelPackage(Constants.PackageType.LimitFree, novelId));

            if (packageInfo != null)
            {
                view.PackageEndTime = packageInfo.EndTime;
            }
            else
            {
                view.PackageEndTime = null;
            }

            //是否收藏
            bool isAddMark = await Task.Run(() => _bookmarkService.Exists(novelId, loginUserName));

            view.IsAddMark = isAddMark;
            //是否全本优惠
            view.IsOrder = await Task.Run(() => IsOrder(_orderService));

            //阅读记录
            ILogService         logService = DataContext.ResolveService <ILogService>();
            NovelReadRecordInfo readRecord = await Task.Run(() => logService.GetRecentChapter(loginUserName, novelId));

            if (readRecord != null)
            {
                view.RecentReadChapterCode = readRecord.ChapterCode;
            }

            //作者的话
            string column = "Message";

            string where = "and novelId = @novelId and authorId = @authorId ";
            string orderby      = " order by id desc";
            var    authorNotice = await Task.Run(() => _bookService.GetAuthorNotice(column, where, orderby, new { novelId = novelId, authorId = novel.UserId }));

            view.AuthorNotice = authorNotice == null ? null : authorNotice.Message;

            //章节信息
            var lastChapter = await Task.Run(() => _chapterService.GetLatestChapter(novelId));

            view.RecentChapterName       = lastChapter == null ? null : lastChapter.ChapterName;
            view.RecentChapterUpdateTime = lastChapter == null ? default(DateTime) : lastChapter.OnlineTime;
            view.RecentChapterCode       = lastChapter == null ? 0 : lastChapter.ChapterCode;
            int rowCount    = 0;
            var chapterList = await Task.Run(() => GetChapterList(out rowCount, novelId, novel.ContentType));

            view.TotalChapterCount = rowCount;
            view.ChapterList       = new SimpleResponse <IEnumerable <ChapterView> >(!chapterList.IsNullOrEmpty(), chapterList);

            //评论信息
            int commentCount = 0;
            var commentList  = await Task.Run(() => GetCommentList(out commentCount, novel.Id));

            view.CommentCount = commentCount;
            view.CommentList  = new SimpleResponse <IEnumerable <CommentView> >(!commentList.IsNullOrEmpty(), commentList);

            //猜你喜欢
            bool IsCartoonType = novel.ContentType == (int)Constants.Novel.ContentType.漫画;

            view.RecClassId = IsCartoonType ? RecSection.CartoonDetail.GuessRec : RecSection.BookDetail.GuessRec;
            if (IsCartoonType)
            {
                //漫画详情-来源
                var cp = await Task.Run(() => _bookService.GetCP("CnName", "and Id = @cpId and status = @status", "order by id ", new { cpId = novel.CPId, status = 1 }));

                view.CPName = cp == null ? null : cp.CnName;
            }

            //记录日志

            NovelLogInfo log = new NovelLogInfo();

            log          = GetLogInfo(log) as NovelLogInfo;
            log.CookieId = GetCookieId();
            log.NovelId  = novelId;
            log.AddTime  = DateTime.Now;
            var service = DataContext.ResolveService <ILogService>();
            await Task.Run(() => service.NovelReadLog(log));

            var model = new SimpleResponse <BookDetailView>(view != null, view);

            if (IsCartoonType)
            {
                return(View("/Views/Cartoon/Detail.cshtml", model));
            }
            else
            {
                return(View(model));
            }
        }