Example #1
0
        public JsonResult getPostsDetail(string postsId, string userId, int from, int count, DateTime refreshTime, string openId)
        {
            PostsHandler handler = new PostsHandler();

            handler.viewPosts(openId, postsId);
            PostsModel          result       = new PostsModel();
            bool                ifLoved      = false;
            List <RepliesModel> replies      = new List <RepliesModel>();
            List <PicsModel>    pics         = new List <PicsModel>();
            bool                ifFollowed   = false;
            string              lovedTimes   = "0";
            string              readCount    = string.Empty;
            bool                ifLegal      = handler.ifLegalPosts(postsId);
            List <RepliesModel> myReplies    = new List <RepliesModel>();
            string              repliesCount = string.Empty;
            string              shareCount   = string.Empty;


            pics         = handler.getAllPicsByPostsId(postsId);
            result       = handler.getPostsDetail(postsId);
            ifLoved      = handler.ifUserLoved(postsId, userId);
            repliesCount = handler.getRepliesCount(postsId);
            lovedTimes   = handler.postsLoved(postsId);
            myReplies    = handler.getMyReplies(postsId, from, count, refreshTime, openId);
            //replies = handler.getReplies(postsId, from, count, refreshTime, openId);
            ifFollowed = new UserHandler().ifFollowed(userId, postsId);
            readCount  = handler.getReadCount(postsId);
            ifLegal    = ifLegal && result.postsStatus != 1;
            shareCount = handler.getShareCount(postsId);
            bool ifMuted = new UserHandler().getConfigModel(openId).videoMuted == 1 ? true : false;

            return(Json(new { result = result, ifLoved = ifLoved, lovedTimes = lovedTimes, pics = pics, repliesCount = repliesCount, shareCount = shareCount, replies = replies, ifFollowed = ifFollowed, readCount = readCount, ifLegal = ifLegal, myReply = myReplies, ifMuted = ifMuted }));
        }
Example #2
0
        public JsonResult getPosts(string openId, int dataFrom, int count, DateTime refreshTime, int currentSel, double ulo, double ula)
        {
            PostsHandler      handler = new PostsHandler();
            List <PostsModel> list    = new List <PostsModel>();

            list = handler.getPosts(openId, dataFrom, count, refreshTime, currentSel, ula, ulo);
            return(Json(new { result = list }));
        }
Example #3
0
        public async Task <ActionResult> SinglePost(int year, int month, int day, string postname)
        {
            var postHandler = new PostsHandler(SiteConfig.POSTS_WEBAPI_ADDRESS, _webCache);

            var result = await postHandler.GetPost(year, month, day, postname);

            if (!result.HasValue)
            {
                throw new jcBPWebException(result.Exception, result.ErrorCode);
            }

            return(View(result.ReturnValue));
        }
Example #4
0
        public async Task <ActionResult> Index(int?pageNumber = null)
        {
            var postHandler = new PostsHandler(SiteConfig.POSTS_WEBAPI_ADDRESS, _webCache);

            var result = await postHandler.GetMainListing(SiteConfig.SITE_POST_PAGE_SIZE, pageNumber);

            if (!result.HasValue)
            {
                throw new jcBPWebException(result.Exception, result.ErrorCode);
            }

            return(View(result.ReturnValue));
        }