collect_hy_book.js 955 B

123456789101112131415161718192021222324252627282930313233343536
  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. let book_name = book_info.rows[0].name;
  14. let typeDesc = book_info.rows[0].typeDesc; //'中篇',
  15. let words = book_info.rows[0].words; //多少字
  16. data.genre = 0
  17. if(typeDesc=="中篇"){
  18. data.genre = 2;
  19. }
  20. if(typeDesc=="长篇"){
  21. data.genre = 1;
  22. }
  23. if(typeDesc=="短篇"){
  24. data.genre = 3;
  25. }
  26. if(data.genre==0){
  27. console.log("获取黑岩书籍信息错误:",book_info)
  28. }
  29. data.words = words
  30. data.book_name = book_name
  31. return data
  32. }
  33. module.exports = CMD;