This commit is contained in:
wangjinlei
2023-09-27 15:57:35 +08:00
parent 1755a78a8d
commit c3ba1d9691
9 changed files with 144 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peanut.common.utils.BaiduVoicesUtils;
import com.peanut.modules.book.entity.*;
@@ -51,6 +52,8 @@ public class BookChapterContentController {
private MyUserService myUserService;
@Autowired
private UserEbookBuyService userEbookBuyService;
@Autowired
private ShopProudictBookService shopProudictBookService;
/**
* 列表
@@ -346,14 +349,36 @@ public class BookChapterContentController {
}
/**
* 获取章节音频地址
* @return
*/
@RequestMapping("/getBooksCatalogue")
public R getBooksCatalogue(@RequestParam Integer chapterId,
@RequestParam Integer bookId,
@RequestParam Integer userId){
//鉴权阶段
BookEntity book_info = bookService.getById(bookId);
BookChapterEntity chapter_info = bookChapterService.getById(chapterId);
UserEbookBuyEntity userEbookBuyEntity = userEbookBuyService.getBaseMapper().selectOne(new LambdaQueryWrapper<UserEbookBuyEntity>().
eq(UserEbookBuyEntity::getUserId,userId).eq(UserEbookBuyEntity::getBookId,bookId));
if(chapter_info.getNumber()>book_info.getFreeChapterCount()&&userEbookBuyEntity==null){
Integer productByBookId = shopProudictBookService.getProductByBookId(bookId);
return R.ok().put("jq",false).put("product",productByBookId);
}
return R.ok().put("chapter",chapter_info);
}
/**
* app 获取电子书章节内容 2.0 (在用鉴权)
*/
@RequestMapping("/appBooksChapterContent")
public R getBooksCatalogue(@RequestParam("chapterid") Integer id,
@RequestMapping("/appBooksChapterContent1")
public R getBooksCatalogue1(@RequestParam("chapterid") Integer id,
@RequestParam("bookid") Integer bookid,
@RequestParam("userId") Integer userId) {
// TODO 验证 当前请求的书 是否存在免费章节数