tg_factory_main.js 5.4 KB

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