collect_hy_book.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }else{
  26. data.genre = 3;
  27. }
  28. // if(typeDesc=="短篇"){
  29. // data.genre = 3;
  30. // }
  31. if(data.genre==0){
  32. console.log("获取黑岩书籍信息错误:",book_info)
  33. }
  34. data.words = words
  35. data.book_name = book_name
  36. return data
  37. }
  38. module.exports = CMD;