|
@@ -30,7 +30,7 @@ async function processTask(){
|
|
|
|
|
|
const [records] = await connection.execute(
|
|
const [records] = await connection.execute(
|
|
`SELECT * FROM video_product
|
|
`SELECT * FROM video_product
|
|
- WHERE book_platform = ${config.platform_fanqie} AND match_book = 'NONE'
|
|
|
|
|
|
+ WHERE book_platform = ${config.platform_fanqiemf} AND match_book = 'NONE'
|
|
LIMIT ? OFFSET ?`,
|
|
LIMIT ? OFFSET ?`,
|
|
[pageSize, offset]
|
|
[pageSize, offset]
|
|
);
|
|
);
|
|
@@ -43,34 +43,36 @@ async function processTask(){
|
|
|
|
|
|
for (let index = 0; index < records.length; index++) {
|
|
for (let index = 0; index < records.length; index++) {
|
|
const element = records[index];
|
|
const element = records[index];
|
|
- let iap_book_info = await require('../src/api/fq/fq_search_book').根据番茄免费ID查询付费书籍(element.product_id)
|
|
|
|
- if(iap_book_info!=null){
|
|
|
|
- let book_info = await video_product_controllers.getProductData({book_id:iap_book_info.book_id})
|
|
|
|
- if(!book_info.success){
|
|
|
|
- //创建一个付费书籍
|
|
|
|
- await video_product_controllers.createProductData({
|
|
|
|
- book_platform:config.platform_fanqie,
|
|
|
|
- product_name:iap_book_info.book_name,
|
|
|
|
- genre:iap_book_info.genre,
|
|
|
|
- product_id:iap_book_info.book_id,
|
|
|
|
- words:iap_book_info.words,
|
|
|
|
- match_book:element.product_id
|
|
|
|
- })
|
|
|
|
- }else{
|
|
|
|
- await video_product_controllers.updateData({id:book_info.data.id},{
|
|
|
|
- match_book:element.product_id
|
|
|
|
- })
|
|
|
|
|
|
+ if(element.match_book=="NONE"){
|
|
|
|
+ let iap_book_info = await require('../src/api/fq/fq_search_book').根据番茄免费ID查询付费书籍(element.product_id)
|
|
|
|
+ if(iap_book_info!=null){
|
|
|
|
+ let book_info = await video_product_controllers.getProductData({book_id:iap_book_info.book_id})
|
|
|
|
+ if(!book_info.success){
|
|
|
|
+ //创建一个付费书籍
|
|
|
|
+ await video_product_controllers.createProductData({
|
|
|
|
+ book_platform:config.platform_fanqie,
|
|
|
|
+ product_name:iap_book_info.book_name,
|
|
|
|
+ genre:iap_book_info.genre,
|
|
|
|
+ product_id:iap_book_info.book_id,
|
|
|
|
+ words:iap_book_info.words,
|
|
|
|
+ match_book:element.product_id
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ await video_product_controllers.updateData({id:book_info.data.id},{
|
|
|
|
+ match_book:element.product_id
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await connection.execute(
|
|
|
|
+ `UPDATE video_product
|
|
|
|
+ SET match_book = ?,
|
|
|
|
+ product_parent_id = ?
|
|
|
|
+ WHERE id = ?`,
|
|
|
|
+ [iap_book_info.book_id, iap_book_info.book_id, element.id]
|
|
|
|
+ );
|
|
}
|
|
}
|
|
-
|
|
|
|
- await connection.execute(
|
|
|
|
- `UPDATE video_product
|
|
|
|
- SET match_book = ?,
|
|
|
|
- product_parent_id = ?
|
|
|
|
- WHERE id = ?`,
|
|
|
|
- [iap_book_info.book_id, iap_book_info.book_id, element.id]
|
|
|
|
- );
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|