feat: 听书问题修改

- 百度文字转语音传参
- 过滤内容为空的书籍目录
This commit is contained in:
2026-07-23 09:22:43 +08:00
parent 333c54ab03
commit 83f467946d
2 changed files with 3 additions and 2 deletions

View File

@@ -194,7 +194,7 @@ public class BaiduVoicesUtils {
private static String cuid = "0322java"; private static String cuid = "0322java";
public static String run(String content) throws Exception { public static String run(String content) throws Exception {
TokenHolder holder = new TokenHolder(appKey, secretKey, TokenHolder.ASR_SCOPE); TokenHolder holder = new TokenHolder(appKey, secretKey, TokenHolder.TTS_SCOPE);
holder.resfresh(); holder.resfresh();
String token = holder.getToken(); String token = holder.getToken();
String url2 = url + "?tex=" + ConnUtil.urlEncode(content); String url2 = url + "?tex=" + ConnUtil.urlEncode(content);

View File

@@ -330,13 +330,14 @@ public class HomeController {
return R.ok().put("languageList",languageList); return R.ok().put("languageList",languageList);
} }
//图书章节 //图书章节(仅返回在 book_chapter_content 中有实际正文的目录)
@RequestMapping("/getBookChapter") @RequestMapping("/getBookChapter")
public R getBookChapter(@RequestBody Map<String,Object> params) { public R getBookChapter(@RequestBody Map<String,Object> params) {
String language = params.containsKey("language")?params.get("language").toString():"中文"; String language = params.containsKey("language")?params.get("language").toString():"中文";
List<BookChapterEntity> chapterList = bookChapterService.list(new LambdaQueryWrapper<BookChapterEntity>() List<BookChapterEntity> chapterList = bookChapterService.list(new LambdaQueryWrapper<BookChapterEntity>()
.eq(BookChapterEntity::getBookId,params.get("bookId")) .eq(BookChapterEntity::getBookId,params.get("bookId"))
.eq(BookChapterEntity::getLanguage,language) .eq(BookChapterEntity::getLanguage,language)
.exists("select 1 from book_chapter_content where book_chatper_id = book_chapter.id and content is not null and content != ''")
.orderByAsc(BookChapterEntity::getId)); .orderByAsc(BookChapterEntity::getId));
return R.ok().put("chapterList",chapterList); return R.ok().put("chapterList",chapterList);
} }