|
@@ -3,6 +3,8 @@ const config = require("../etc/config.json");
|
|
const mysql = require('mysql2/promise');
|
|
const mysql = require('mysql2/promise');
|
|
const taskdbConfig = config.isDebug?config.debug_task_mysql:config.release_task_mysql
|
|
const taskdbConfig = config.isDebug?config.debug_task_mysql:config.release_task_mysql
|
|
const redis_help = require('../src/use_redis');
|
|
const redis_help = require('../src/use_redis');
|
|
|
|
+const video_product_controllers = require('../src/data_manager/Controllers/video_product_controllers');
|
|
|
|
+const helper = require("../src/helper");
|
|
const CMD = {}
|
|
const CMD = {}
|
|
async function processTask(){
|
|
async function processTask(){
|
|
let right_status = true
|
|
let right_status = true
|
|
@@ -13,7 +15,7 @@ async function processTask(){
|
|
multipleStatements: true
|
|
multipleStatements: true
|
|
});
|
|
});
|
|
//先获取100本没有发布时间的番茄免费书籍
|
|
//先获取100本没有发布时间的番茄免费书籍
|
|
- let sql = `SELECT * FROM video_product WHERE book_platform = ${config.platform_fanqiemf} AND publish_time IS NULL LIMIT 500`
|
|
|
|
|
|
+ let sql = `SELECT * FROM video_product WHERE book_platform = ${config.platform_fanqiemf} AND product_parent_id !="" AND publish_time IS NULL LIMIT 500`
|
|
console.log("sql:",sql)
|
|
console.log("sql:",sql)
|
|
const [rows] = await connection.execute(
|
|
const [rows] = await connection.execute(
|
|
sql
|
|
sql
|
|
@@ -25,24 +27,16 @@ async function processTask(){
|
|
|
|
|
|
for (let index = 0; index < rows.length; index++) {
|
|
for (let index = 0; index < rows.length; index++) {
|
|
let video_product_info = rows[index]
|
|
let video_product_info = rows[index]
|
|
- let data = await require('../src/api/fq/fq_search_book').search_mf_new_id(video_product_info.product_id)
|
|
|
|
- if(data==""){
|
|
|
|
- console.error("接口失效")
|
|
|
|
- }else{
|
|
|
|
- if(data!=null){
|
|
|
|
- let publish_time = data.on_shelf_time
|
|
|
|
|
|
+ let book_info = await video_product_controllers.getProductData({book_id:video_product_info.product_parent_id})
|
|
|
|
+ if(book_info.success){
|
|
|
|
+ if(book_info.publish_time!=null){
|
|
|
|
+ let publish_time = helper.getDate7DaysBefore(book_info.publish_time,null,'YYYY-MM-DD')
|
|
await connection.execute(
|
|
await connection.execute(
|
|
`UPDATE video_product SET publish_time = "${publish_time}" WHERE id = ${video_product_info.id} `
|
|
`UPDATE video_product SET publish_time = "${publish_time}" WHERE id = ${video_product_info.id} `
|
|
);
|
|
);
|
|
- }else{
|
|
|
|
- console.error("查无此书:",video_product_info)
|
|
|
|
- await connection.execute(
|
|
|
|
- ` UPDATE video_product SET status = 0 , publish_time = '2000-01-01 01:01:01' WHERE id = ${video_product_info.id} `
|
|
|
|
- );
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}catch(e){
|
|
}catch(e){
|