|
@@ -5,6 +5,7 @@ const video_applet_product_controllers = require('../src/data_manager/Controller
|
|
|
const redis_help = require('../src/use_redis');
|
|
|
const config = require('../etc/config.json');
|
|
|
const other_book_controllers = require('../src/data_manager/Controllers/other_book_controllers');
|
|
|
+const tools = require('../tools');
|
|
|
const time_count = 1000;
|
|
|
const task_queue = []
|
|
|
|
|
@@ -107,6 +108,7 @@ async function processTask(){
|
|
|
info.genre = product_item.genre
|
|
|
info.book_id = product_item.product_id
|
|
|
info.book_name = product_item.product_name
|
|
|
+ info.book_platform = product_item.book_platform
|
|
|
await CMD.update_filter_data(FilterConfig,info)
|
|
|
await updateSameProductId(UpdateProductList[info.book_id],info)
|
|
|
await new Promise(resolve => setTimeout(resolve,100));
|
|
@@ -159,7 +161,6 @@ async function processCreateTask(){
|
|
|
if(hy_book_data.is_c500){
|
|
|
hy_book_data.tg_platform_id = config.platform_heiyanmf
|
|
|
}
|
|
|
-
|
|
|
if(hy_book_data.genre==1){ //长篇给黑岩免费长篇添加进去
|
|
|
await CMD.insert_product({
|
|
|
tg_platform_id:config.platform_heiyanmf,
|
|
@@ -174,6 +175,7 @@ async function processCreateTask(){
|
|
|
result.data.genre = hy_book_data.genre
|
|
|
result.data.book_id = hy_book_data.book_id
|
|
|
result.data.book_name = hy_book_data.book_name
|
|
|
+ result.data.book_platform = hy_book_data.tg_platform_id
|
|
|
}else{
|
|
|
result.data.words = 0
|
|
|
result.data.genre = 999
|
|
@@ -187,6 +189,7 @@ async function processCreateTask(){
|
|
|
result.data.genre = product.genre
|
|
|
result.data.book_id = product.product_id
|
|
|
result.data.book_name = product.product_name
|
|
|
+ result.data.book_platform = product.book_platform
|
|
|
}
|
|
|
await CMD.update_filter_data(FilterConfig,result.data)
|
|
|
}
|
|
@@ -228,12 +231,18 @@ CMD.isBlackBook = function(all_black_books,book_id){
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
-CMD.getMainInfoByAppid = function(MainConfig,app_id){
|
|
|
+CMD.getMainInfoByAppid = function(MainConfig,app_id,isMf){
|
|
|
let list = []
|
|
|
for (let index = 0; index < MainConfig.length; index++) {
|
|
|
const element = MainConfig[index];
|
|
|
if(element.app_id==app_id){
|
|
|
- list.push(element)
|
|
|
+ if(isMf){
|
|
|
+ if(config.platform_heiyanmf==element.tg_platform_id){
|
|
|
+ list.push(element)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ list.push(element)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return list
|
|
@@ -273,7 +282,8 @@ CMD.getSharedPlatform = function(PlatformShared,platform_shared_id){
|
|
|
CMD.update_filter_data = async function(FilterConfig,data) {
|
|
|
// let isGenre = CMD.isGenre(FilterConfig,data.genre)
|
|
|
let isGenre = true
|
|
|
- // console.log("data.genre:",data.genre,data,isGenre)
|
|
|
+ let isMf = data.book_platform==config.platform_heiyanmf
|
|
|
+ console.log("data.book_platform:",data.book_platform)
|
|
|
if(isGenre){
|
|
|
|
|
|
await filter_data_controllers.updateFilterData({id:data.id},{status:1,book_id:data.book_id,book_name:data.book_name,genre:data.genre,words:data.words})
|
|
@@ -290,7 +300,7 @@ CMD.update_filter_data = async function(FilterConfig,data) {
|
|
|
|
|
|
PlatformConfig = JSON.parse(PlatformConfig)
|
|
|
|
|
|
- let PlatformInfo = CMD.getPlatformInfo(PlatformConfig,config.platform_heiyan)
|
|
|
+ let PlatformInfo = CMD.getPlatformInfo(PlatformConfig,isMf==true?config.platform_heiyanmf:config.platform_heiyan)
|
|
|
|
|
|
console.log("PlatformInfo:",PlatformInfo)
|
|
|
|
|
@@ -315,7 +325,7 @@ CMD.update_filter_data = async function(FilterConfig,data) {
|
|
|
|
|
|
MainConfig = JSON.parse(MainConfig)
|
|
|
|
|
|
- let list = CMD.getMainInfoByAppid(MainConfig,data.app_id)
|
|
|
+ let list = CMD.getMainInfoByAppid(MainConfig,data.app_id,isMf)
|
|
|
|
|
|
if(list.length<0){
|
|
|
return console.error("获取主体错误:",data)
|
|
@@ -332,6 +342,7 @@ CMD.update_filter_data = async function(FilterConfig,data) {
|
|
|
data.main_id = main_info.id
|
|
|
data.main_name = main_info.main_name
|
|
|
let butler_id = main_info.butler_id
|
|
|
+
|
|
|
if(main_info.tg_link_config==undefined||main_info.tg_link_config==null){
|
|
|
console.error("主体配置推广链接错误:",main_info)
|
|
|
}else{
|
|
@@ -343,30 +354,33 @@ CMD.update_filter_data = async function(FilterConfig,data) {
|
|
|
let word = data.words
|
|
|
if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
|
|
|
//符合标准进行创建表
|
|
|
- const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
|
|
|
- if(!result.success){
|
|
|
-
|
|
|
- let table_data = {
|
|
|
- book_platform:config.platform_heiyan,
|
|
|
- product_name:data.book_name,
|
|
|
- product_id:data.book_id,
|
|
|
- dy_small_program_start:"",
|
|
|
- dy_small_program_start_data:"",
|
|
|
- dy_small_applet_app_id:data.app_id,
|
|
|
- status:0,
|
|
|
- main_id:data.main_id,
|
|
|
- promotion_id:"",
|
|
|
- wait_status:0,
|
|
|
- material_platform_id:material_platform_id,
|
|
|
- butler_id:butler_id
|
|
|
- }
|
|
|
-
|
|
|
- if(main_info.pay_type==0){
|
|
|
- table_data.book_platform = config.platform_heiyanmf
|
|
|
- table_data.product_parent_id = data.product_parent_id
|
|
|
+ let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
|
|
|
+ if(butler_video_applet_info==null){
|
|
|
+ const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
|
|
|
+ if(!result.success){
|
|
|
+
|
|
|
+ let table_data = {
|
|
|
+ book_platform:config.platform_heiyan,
|
|
|
+ product_name:data.book_name,
|
|
|
+ product_id:data.book_id,
|
|
|
+ dy_small_program_start:"",
|
|
|
+ dy_small_program_start_data:"",
|
|
|
+ dy_small_applet_app_id:data.app_id,
|
|
|
+ status:0,
|
|
|
+ main_id:data.main_id,
|
|
|
+ promotion_id:"",
|
|
|
+ wait_status:0,
|
|
|
+ material_platform_id:material_platform_id,
|
|
|
+ butler_id:butler_id
|
|
|
+ }
|
|
|
+
|
|
|
+ if(main_info.pay_type==0){
|
|
|
+ table_data.book_platform = config.platform_heiyanmf
|
|
|
+ table_data.product_parent_id = data.product_parent_id
|
|
|
+ }
|
|
|
+ //没有找到 可以创建
|
|
|
+ await video_applet_product_controllers.createAppletProductData(table_data)
|
|
|
}
|
|
|
- //没有找到 可以创建
|
|
|
- await video_applet_product_controllers.createAppletProductData(table_data)
|
|
|
}
|
|
|
}
|
|
|
}
|