tg_factory_main.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. setInterval(() => {
  2. }, 15000);
  3. const ProcessManager = require('./ProcessManager');
  4. const helper = require('./src/helper');
  5. const HttpClient = require('./src/HttpClient');
  6. const redis_help = require('./src/use_redis');
  7. const tools = require('./tools');
  8. const config = require('./etc/config.json')
  9. const hy_search_book = require('./src/api/hy/hy_search_book');
  10. // function getPlatformInfoByI(PlatformConfig,tg_platform_id){
  11. // for (let index = 0; index < PlatformConfig.length; index++) {
  12. // const element = PlatformConfig[index];
  13. // if(element.tg_platform_id==tg_platform_id){
  14. // return element
  15. // }
  16. // }
  17. // return null
  18. // }
  19. // function getMainInfoById(MainConfig,main_id){
  20. // // console.log("MainConfig:",MainConfig)
  21. // for (let index = 0; index < MainConfig.length; index++) {
  22. // const element = MainConfig[index];
  23. // if(element.id==main_id){
  24. // return element
  25. // }
  26. // }
  27. // return null
  28. // }
  29. let isInit = false
  30. // config.isDebug
  31. if(config.isDebug){
  32. redis_help.connect( async (results)=>{
  33. if(results){
  34. isInit = true
  35. // main()
  36. // let hy_book_data = await require('./2_PRODUCT_FACTORY/collect_hy_book').runTask({book_id:"1869900926728654850"})
  37. // console.log("hy_book_data:",hy_book_data)
  38. }
  39. })
  40. }
  41. // let data = await hy_search_book.search_id("1868479666362478594")
  42. // console.log("data:",data)
  43. // let response = helper.resolveDomain("clipvideoup.s6kuwan.com")
  44. // console.log("response:",response)
  45. // let MainConfig = await redis_help.getKeyValue("MainConfig")
  46. // MainConfig = JSON.parse(MainConfig)
  47. // let PlatformConfig = await redis_help.getKeyValue("PlatformConfig")
  48. // PlatformConfig = JSON.parse(PlatformConfig)
  49. // let PlatformInfo = getPlatformInfoByI(PlatformConfig,4)
  50. // let main_info = getMainInfoById(MainConfig,150)
  51. // let data = {
  52. // product_id:"11010288676",
  53. // product_name:"侍女有谋"
  54. // }
  55. // require("./5_CREATE_LINK_FACTORY/dz_create_link").runTask(data,main_info,PlatformInfo,()=>{
  56. // })
  57. // let data = await require('./src/api/dz/dz_search_book').search_id('11010288676')
  58. // console.log("data:",data)
  59. // require('./src/api/qm/qm_search_book').search_id('396740')
  60. // console.log("results:",await redis_help.getKeyValue("isPauseTask"))
  61. // let MainConfig = await redis_help.getKeyValue("MainConfig")
  62. // MainConfig = JSON.parse(MainConfig)
  63. // let PlatformConfig = await redis_help.getKeyValue("PlatformConfig")
  64. // PlatformConfig = JSON.parse(PlatformConfig)
  65. // let PlatformInfo = getPlatformInfoByI(PlatformConfig,3)
  66. // let main_info = getMainInfoById(MainConfig,151)
  67. // let data = {
  68. // product_id:"393425",
  69. // product_name:"转学生自称苗疆圣子,可我才是真圣子"
  70. // }
  71. // let {promotion_name} = await require("./5_CREATE_LINK_FACTORY/qm_create_link").runTask(data,main_info,PlatformInfo,()=>{
  72. // })
  73. // console.log("promotion_name:",promotion_name)
  74. // let n_data = await require("./src/api/qm/get_qm_promotion").getPromotionList(promotion_name)
  75. // console.log("get_qm_promotion:",n_data)
  76. // let get_hy_group_mapping = require('./src/api/hy/get_hy_group_mapping');
  77. // get_hy_group_mapping.get_group_mapping((data)=>{
  78. // if(data.code==200){
  79. // let list = data.data
  80. // }
  81. // console.log("get_hy_group_mapping:",data)
  82. // })
  83. // setTimeout( async ()=>{
  84. // let black_books = await redis_help.getKeyValue("all_black_books")
  85. // console.log("black_books:",black_books)
  86. // },5000)
  87. // let main = async function(){
  88. // let test = new HttpClient()
  89. // const postData = {
  90. // cmd:"create_link",
  91. // name:"台风夜老婆去救男秘书",
  92. // bookId:"1848991033902665730",
  93. // topUpTemplateId:"1854833762266247169",
  94. // passBackTemplateId:"6",
  95. // paidPoint:"9999999",
  96. // token:await tools.getHyToken()
  97. // };
  98. // let data = {
  99. // "name": postData.name,
  100. // "bookId": postData.bookId,
  101. // "passBackTemplateId": postData.passBackTemplateId,
  102. // "adPassbackTemplateId": "",
  103. // "topUpTemplateId": postData.topUpTemplateId,
  104. // "mediaChannel": "1",
  105. // "group": "35",
  106. // "paidPoint": postData.paidPoint,
  107. // "site": "5"
  108. // }
  109. // let res = await test.otherPost( helper.getHyCreateLinkOpt(postData.token) ,data)
  110. // console.log("res:",res)
  111. // let response = {
  112. // "message": "create_link successfully",
  113. // "received_data":{"originalId":res["data"]["originalId"],
  114. // "appId":res["data"]["appId"],
  115. // "launchPath":res["data"]["launchPath"],
  116. // "fullPath":res["data"]["fullPath"],
  117. // "wxMountLink":res["data"]["wxMountLink"]}
  118. // }
  119. // console.log("response:",response)
  120. // }
  121. // var main = function(){
  122. // require("./2_PRODUCT_FACTORY/PRODUCT_FACTORY")
  123. // require("./5_CREATE_LINK_FACTORY/CREATE_LINK_FACTORY")
  124. // require("./MAIN_SERVE_FACTORY/MAIN_SERVE_FACTORY")
  125. // require("./0_RECEIVE_FACTORY/RECEIVE_FACTORY")
  126. // require("./1_FILTER_FACTORY/FILTER_FACTORY")
  127. // }
  128. // let main = function(){
  129. // let manager = new ProcessManager()
  130. // manager.start()
  131. // manager.workers.forEach((v,k)=>{
  132. // if (v.process) {
  133. // v.process.send({
  134. // type: 'config',
  135. // data: { /* 配置数据 */ }
  136. // });
  137. // }
  138. // })
  139. // }