找回密码
 立即注册
搜索
热搜: 丝袜 魅魔 黑丝
查看: 5|回复: 0

28681557_堕落于我。体育仓库的忠犬

[复制链接]

13万

主题

340

回帖

22万

积分

管理员

站长

UID
1
积分
224315
余额
13 R
Moe币
84800
在线时间
264 小时
注册时间
2025-12-28
最后登录
2026-9-19
发表于 2026-9-3 23:00:59 | 显示全部楼层 |阅读模式
  } else if ("recommend".equals(dto.getSortBy())) {
            wrapper.eq(Manga::getIsRecommend, 1).orderByDesc(Manga::getSortWeight);
        } else {
            wrapper.orderByDesc(Manga::getLastUpdateTime);
        }

        Page<Manga> page = mangaMapper.selectPage(
                new Page<>(dto.getPageNum(), dto.getPageSize()), wrapper);

        List<MangaListVO> records = page.getRecords().stream().map(manga -> {
            MangaListVO vo = new MangaListVO();
            vo.setId(manga.getId());
            vo.setTitle(manga.getTitle());
            vo.setAuthor(manga.getAuthor());
            vo.setCover(manga.getCover());
            vo.setCategoryId(manga.getCategoryId());
            Category category = categoryMapper.selectById(manga.getCategoryId());
            vo.setCategoryName(category != null ? category.getName() : "");
            vo.setStatus(manga.getStatus());
            vo.setPublishStatus(manga.getPublishStatus());
            vo.setPriceType(manga.getPriceType());
            vo.setPrice(manga.getPrice());
            vo.setAgeRange(manga.getAgeRange());
            vo.setClickCount(manga.getClickCount());
            vo.setFavoriteCount(manga.getFavoriteCount());
            vo.setCommentCount(manga.getCommentCount());
            vo.setIsRecommend(manga.getIsRecommend());
            vo.setSortWeight(manga.getSortWeight());
            vo.setLastChapterTitle(manga.getLastChapterTitle());
            vo.setLastUpdateTime(manga.getLastUpdateTime());
            vo.setCreateTime(manga.getCreateTime());
            return vo;
        }).collect(Collectors.toList());

        IPage<MangaListVO> result = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
        result.setRecords(records);
        return result;
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void incrementClick(Long id) {
        mangaMapper.update(null, new com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper<Manga>()
                .eq("id", id)
                .setSql("click_count = click_count + 1"));
    }

    @Override
    public List<MangaListVO> getRelated(Long mangaId, Integer limit, Long userId) {
        if (limit == null) limit = 10;
        Manga current = mangaMapper.selectById(mangaId);
        if (current == null || current.getCategoryId() == null) {
            return Collections.emptyList();
        }
        LambdaQueryWrapper<Manga> wrapper = new LambdaQueryWrapper<Manga>()
                .eq(Manga::getPublishStatus, 1)
                .eq(Manga::getCategoryId, current.getCategoryId())
                .ne(Manga::getId, mangaId);
        applyTeenFilter(wrapper, userId);
        List<Manga> list = mangaMapper.selectList(
                wrapper.orderByDesc(Manga::getClickCount)
                        .last("LIMIT " + limit));
        return list.stream().map(m -> {
            MangaListVO vo = new MangaListVO();
            vo.setId(m.getId());
            vo.setTitle(m.getTitle());
            vo.setAuthor(m.getAuthor());
            vo.setCover(m.getCover());
            vo.setCategoryId(m.getCategoryId());
            vo.setStatus(m.getStatus());
            vo.setPriceType(m.getPriceType());
            vo.setIsFree(m.getIsFree());
            vo.setClickCount(m.getClickCount());
            vo.setFavoriteCount(m.getFavoriteCount());
            vo.setCommentCount(m.getCommentCount());
            vo.setLastChapterTitle(m.getLastChapterTitle());
            vo.setLastUpdateTime(m.getLastUpdateTime());
            return vo;
        }).collect(Collectors.toList());
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Long submit(MangaSubmitDTO dto, Long userId) {
        Manga manga = new Manga();
        manga.setTitle(dto.getTitle());
        manga.setAuthor(dto.getAuthor() != null ? dto.getAuthor() : "");
        manga.setCategoryId(dto.getCategoryId());
        manga.setCover(dto.getCover() != null ? dto.getCover() : "");
        manga.setDescription(dto.getDescription());
        manga.setStatus(dto.getStatus() != null ? dto.getStatus() : 0);
        // 投稿必须显式选择适龄分级(DTO 已 @NotNull 校验),此处不再默认落 0,
        // 防止创作者未选择时被静默归为「全年龄」而对未成年人可见
        manga.setAgeRange(dto.getAgeRange());
        manga.setUserId(userId);
        // 投稿默认为下架状态,等待管理员审核上架
        manga.setPublishStatus(0);
        manga.setIsFree(1);
        manga.setPriceType(0);
        manga.setPrice(0);
        manga.setIsRecommend(0);
        manga.setSortWeight(0);
        manga.setClickCount(0);
        manga.setFavoriteCount(0);
        manga.setCommentCount(0);
        mangaMapper.insert(manga);

        // 关联标签
        if (dto.getTagIds() != null && !dto.getTagIds().isEmpty()) {
            for (Long tagId : dto.getTagIds()) {
                MangaTag mt = new MangaTag();
                mt.setMangaId(manga.getId());
                mt.setTagId(tagId);
                mangaTagMapper.insert(mt);
            }
        }

        return manga.getId();
    }

    @Override
    public List<Map<String, Object>> getUserSubmissions(Long userId) {
        List<Manga> list = mangaMapper.selectList(
                new LambdaQueryWrapper<Manga>()
                        .eq(Manga::getUserId, userId)
                        .orderByDesc(Manga::getCreateTime));

        return list.stream().map(manga -> {
            Map<String, Object> map = new HashMap<>();
            map.put("id", manga.getId());
            map.put("title", manga.getTitle());
            map.put("author", manga.getAuthor());
            map.put("cover", manga.getCover());
            map.put("categoryId", manga.getCategoryId());
            Category category = categoryMapper.selectById(manga.getCategoryId());
            map.put("categoryName", category != null ? category.getName() : "");
            map.put("status", manga.getStatus());
            map.put("publishStatus", manga.getPublishStatus());
            map.put("ageRange", manga.getAgeRange());
            map.put("clickCount", manga.getClickCount());
            map.put("favoriteCount", manga.getFavoriteCount());
            map.put("createTime", manga.getCreateTime());
            return map;
        }).collect(toList());
    }
}
变了。低沉、甜腻、带着哀求。
我满意地笑了。
“怎么了?想要什么吗?”
康太仍跪着靠近我,颤抖的手抓住我的衬衫下摆。
“求你……摸我……”
“哦?这是怎么回事。刚才那副态度呢?狗对主人该怎么说?”
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|M男之家

GMT+8, 2026-9-19 20:52 , Processed in 0.094976 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表