|
@@ -68,9 +68,7 @@ async function processTask(){
|
|
|
Ids.push(filter_item.id)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
let remove_product_list = []
|
|
|
-
|
|
|
for (let index = 0; index < product_list_result.data.nonExistentIds.length; index++) {
|
|
|
const product_id = product_list_result.data.nonExistentIds[index];
|
|
|
if(remove_product_list[product_id]==true){
|
|
@@ -84,7 +82,6 @@ async function processTask(){
|
|
|
// console.log("Ids:",Ids)
|
|
|
// await filter_data_controllers.updateFilterDataByIds({ids:Ids},{status:1})
|
|
|
// }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -359,13 +356,7 @@ CMD.async_other_books = async function(data) {
|
|
|
}
|
|
|
|
|
|
CMD.insert_product = async function(data){
|
|
|
- await video_product_controllers.createProductData({
|
|
|
- book_platform:data.tg_platform_id,
|
|
|
- product_name:data.book_name,
|
|
|
- genre:data.genre,
|
|
|
- product_id:data.book_id,
|
|
|
- words:data.words
|
|
|
- })
|
|
|
+
|
|
|
//如果七猫库里有对应的免费的书,那么检测是否有此免费的书,如果没有则插入
|
|
|
let connection = null
|
|
|
try{
|
|
@@ -381,19 +372,24 @@ CMD.insert_product = async function(data){
|
|
|
);
|
|
|
|
|
|
console.log("sql:",sql)
|
|
|
-
|
|
|
- const [rows] = await connection.execute(
|
|
|
- `SELECT * FROM qm_iap_lib WHERE book_id = ${data.book_id} AND is_have_iaa = 1 LIMIT 1`
|
|
|
- );
|
|
|
- if(rows.length<=0){
|
|
|
-
|
|
|
- }else{
|
|
|
- let qm_iap_book_info = rows[0]
|
|
|
- let iaa_book_info = await CMD.getQMMFVideoProduct(qm_iap_book_info.iaa_book_id)
|
|
|
+ let match_book = "NONE"
|
|
|
+ let qm_iap_book_info = await require('../src/api/qm_mf/qm_mf_search_book').根据七猫付费ID查询免费书籍(data.book_id)
|
|
|
+ if(qm_iap_book_info!=null){
|
|
|
+ let iaa_book_info = await CMD.getQMMFVideoProduct(qm_iap_book_info.book_id)
|
|
|
+ match_book = qm_iap_book_info.book_id
|
|
|
if(iaa_book_info==null){
|
|
|
- await CMD.addQMMFVideoProduct(qm_iap_book_info.iaa_book_id,data.book_id)
|
|
|
+ await CMD.addQMMFVideoProduct(qm_iap_book_info,data.book_id)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ await video_product_controllers.createProductData({
|
|
|
+ book_platform:data.tg_platform_id,
|
|
|
+ product_name:data.book_name,
|
|
|
+ genre:data.genre,
|
|
|
+ product_id:data.book_id,
|
|
|
+ words:data.words,
|
|
|
+ match_book:match_book
|
|
|
+ })
|
|
|
}catch(e){
|
|
|
console.error("insert_product:",e)
|
|
|
}finally{
|
|
@@ -404,16 +400,14 @@ CMD.insert_product = async function(data){
|
|
|
}
|
|
|
|
|
|
//插入
|
|
|
-CMD.addQMMFVideoProduct = async function(product_id,product_parent_id){
|
|
|
+CMD.addQMMFVideoProduct = async function(qm_book_data,product_parent_id){
|
|
|
let connection = await mysql.createConnection({
|
|
|
...taskdbConfig,
|
|
|
multipleStatements: true
|
|
|
});
|
|
|
-
|
|
|
- let qm_book_data = await require('../src/api/qm_mf/qm_mf_search_book').search_id_new(product_id)
|
|
|
if(qm_book_data!=null){
|
|
|
await connection.execute(
|
|
|
- `INSERT INTO video_product (product_name,product_id,book_platform,genre,words,product_parent_id) VALUES ("${qm_book_data.book_name}",${product_id},${config.platform_qmmf},${qm_book_data.genre},"${qm_book_data.words}",${product_parent_id})`
|
|
|
+ `INSERT INTO video_product (product_name,product_id,book_platform,genre,words,product_parent_id,match_book) VALUES ("${qm_book_data.book_name}",${qm_book_data.book_id},${config.platform_qmmf},${qm_book_data.genre},"${qm_book_data.words}",${product_parent_id},${product_parent_id})`
|
|
|
);
|
|
|
}
|
|
|
await connection.end();
|
|
@@ -426,7 +420,7 @@ CMD.getQMMFVideoProduct = async function(product_id){
|
|
|
});
|
|
|
|
|
|
const [rows] = await connection.execute(
|
|
|
- `SELECT * FROM video_product WHERE product_id = ${product_id} AND book_platform = ${config.platform_qmmf} LIMIT 1`
|
|
|
+ `SELECT * FROM video_product WHERE product_id = '${product_id}' AND book_platform = ${config.platform_qmmf} LIMIT 1`
|
|
|
);
|
|
|
await connection.end();
|
|
|
|