collect_hy_book.js 1011 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //执行一个寻找黑岩任务
  2. const CMD = {}
  3. let hy_search_book = require('../src/api/hy/hy_search_book')
  4. CMD.runTask = async function(data){
  5. // console.log("执行一个寻找黑岩任务:",data)
  6. let book_info = await hy_search_book.search_id(data.book_id)
  7. if(book_info.rows==null||book_info.rows==undefined){
  8. return null
  9. }
  10. if(book_info.rows.lenght<=0){
  11. return null
  12. }
  13. console.log("book_info.rows[0]:",book_info.rows[0])
  14. let book_name = book_info.rows[0].name;
  15. let typeDesc = book_info.rows[0].typeDesc; //'中篇',
  16. let words = book_info.rows[0].words; //多少字
  17. data.genre = 0
  18. if(typeDesc=="中篇"){
  19. data.genre = 2;
  20. }
  21. if(typeDesc=="长篇"){
  22. data.genre = 1;
  23. }
  24. if(typeDesc=="短篇"){
  25. data.genre = 3;
  26. }
  27. if(data.genre==0){
  28. console.log("获取黑岩书籍信息错误:",book_info)
  29. }
  30. data.words = words
  31. data.book_name = book_name
  32. return data
  33. }
  34. module.exports = CMD;