collect_hy_book.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //执行一个寻找黑岩任务
  2. const CMD = {}
  3. const { head } = require('request')
  4. let hy_search_book = require('../src/api/hy/hy_search_book')
  5. const helper = require('../src/helper')
  6. CMD.runTask = async function(data){
  7. // console.log("执行一个寻找黑岩任务:",data)
  8. let book_info = await hy_search_book.search_id(data.book_id)
  9. if(book_info==undefined||book_info==null){
  10. return null
  11. }
  12. if(book_info.rows==null||book_info.rows==undefined){
  13. return null
  14. }
  15. if(book_info.rows.length<=0){
  16. return null
  17. }
  18. let book_name = book_info.rows[0].name;
  19. let typeDesc = book_info.rows[0].typeDesc; //'中篇',
  20. let words = book_info.rows[0].words; //多少字
  21. data.genre = 0
  22. // if(typeDesc=="中篇"){
  23. // data.genre = 2;
  24. // }
  25. if(words>100000){
  26. data.genre = 1;
  27. }else{
  28. data.genre = 3;
  29. }
  30. data.is_c500 = false
  31. if(helper.checkChannel(book_name,'C500')||helper.checkChannel(book_name,'C400')){ //番茄免费短篇
  32. data.is_c500 = true
  33. data.genre = 3;
  34. }
  35. // if(typeDesc=="长篇"){
  36. // data.genre = 1;
  37. // }else{
  38. // data.genre = 3;
  39. // }
  40. // if(typeDesc=="短篇"){
  41. // data.genre = 3;
  42. // }
  43. if(data.genre==0){
  44. console.log("获取黑岩书籍信息错误:",book_info)
  45. }
  46. data.words = words
  47. data.book_name = book_name
  48. return data
  49. }
  50. module.exports = CMD;