collect_hy_book.js 1.0 KB

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