904118851 3 сар өмнө
parent
commit
975e84ed27

+ 1 - 1
PULL_DATA_FACTORY/PULL_DATA.js

@@ -151,7 +151,7 @@ async function processDetailTask(task_item) {
                                 status:0,
                                 createTime_new:new Date(element.createTime),
                                 updateTime_new:new Date(element.updateTime),
-                                create_day:new Date(element.createTime)
+                                create_day:new Date(helper.getLocalDate())
                             }
                         )
                     }

+ 4 - 2
PULL_TIME_DATA/PULL_TIME_DATA_NEW.js

@@ -3,7 +3,8 @@ const rabbitMq = require('../src/mq/rabbit-mq');
 const helper = require('../src/helper');
 const mysql = require('mysql2/promise');
 const crypto = require('crypto');
-const config = require('../etc/config.json')
+const config = require('../etc/config.json');
+const tools = require('../tools');
 const dbConfig = config.isDebug?config.debug_mysql:config.release_mysql
 
 // 时间戳转MySQL datetime格式
@@ -82,6 +83,7 @@ async function processVideoTitles(connection, titles) {
 }
 
 const insertOriginData = async(connection,values) =>{
+    
     const insertSQL = `
     INSERT INTO origin_data
     (video_id, materialId, title, video_link, publish_time, 
@@ -117,7 +119,7 @@ const messageHandler = async (msg) => {
         
         // 转换时间戳为MySQL datetime格式
         const values = data.map(item => [
-            item.contentId,
+            tools.getOriginVideoId(item.contentUrl),
             item.contentId,
             item.contentTitle,
             item.contentUrl,

+ 7 - 0
tools.js

@@ -331,6 +331,13 @@ class tools {
     isObject(value) {
         return typeof value === 'object' && value !== null;
     }
+
+    getOriginVideoId(url){
+        const match = url.match(/\/video\/(\d+)/);
+        // 2. 提取结果
+        const videoId = match ? match[1] : null;
+        return videoId
+    }
 }
 
 module.exports = new tools(require('./src/use_redis'));