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