From 9519575f8b073d2f988f9c204248ff8cf2fb161c Mon Sep 17 00:00:00 2001
From: 付智勇 <fuzhiyong@efangtec.com>
Date: Thu, 26 Oct 2017 10:53:15 +0800
Subject: [PATCH] no message

---
 controller/recordInfoController.js | 12 ++++++++++++
 routes/RecordInfo.js               |  9 +++++++++
 services/recordInfoService.js      | 24 ++++++++++++++++++++++--
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/controller/recordInfoController.js b/controller/recordInfoController.js
index cd2f988..87bf6b0 100644
--- a/controller/recordInfoController.js
+++ b/controller/recordInfoController.js
@@ -90,4 +90,16 @@ recordInfoController.prototype.getRecordFileURL = async(ctx,next)=>{
     }
 
 }
+recordInfoController.prototype.getOldRecordInfo = async(ctx,next)=>{
+    try {
+        const meetingNumber =  ctx.request.body.meetingNumber;     
+        let recordInfo = await recordInfoService.getOldRecordInfo(meetingNumber) 
+        return recordInfo;
+    } catch (e) {
+        console.log(e)
+        throw e
+    }
+
+}
+
 module.exports = new recordInfoController()
\ No newline at end of file
diff --git a/routes/RecordInfo.js b/routes/RecordInfo.js
index 8f577f8..d9645ac 100644
--- a/routes/RecordInfo.js
+++ b/routes/RecordInfo.js
@@ -53,6 +53,15 @@ router.post('/tencentRecordInfo', async (ctx, next) => {
         status.catchError(ctx,400,e.message);    
       } 
 })
+router.post('/getOldRecordInfo', async (ctx, next) => {
+  try{
+      var data = await meetingContoller.getOldRecordInfo(ctx, next);
+      status.successTemp(ctx,200,data);
+    }catch(e){
+        console.error(e)
+      status.catchError(ctx,400,e.message);    
+    } 
+})
 router.post('/getRecordFileURL', async (ctx, next) => {
   try{
       var data = await meetingContoller.getRecordFileURL(ctx, next);
diff --git a/services/recordInfoService.js b/services/recordInfoService.js
index 6dc154a..5bf9b44 100644
--- a/services/recordInfoService.js
+++ b/services/recordInfoService.js
@@ -4,6 +4,7 @@ const callfile = require('child_process');
 const  fs = require('fs');
 const moment = require('moment')
 const applacation = require('../applacation')
+const  sequelize = require('../config');
 
 
 function recordInfoService(){
@@ -47,8 +48,8 @@ recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{
 
 recordInfoService.prototype.getRecordFileURL = async(path,time)=>{
     try {
-        let onlinePath = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples/'      
-        //let onlinePath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/' 
+        //let onlinePath = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples/'      
+        let onlinePath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/' 
         var backFile=[];
         var fileU
         let addrecord =  await recordInfo.findAll({where:{channel:path}});
@@ -127,4 +128,23 @@ recordInfoService.prototype.getRecordFileURL = async(path,time)=>{
     
 }
 
+
+recordInfoService.prototype.getOldRecordInfo = async(meetingNumber) =>{
+    try {
+        let sql = `SELECT
+                        *
+                    FROM
+                        3m_meeting_current_info
+                    WHERE
+                        3m_meeting_current_info.meeting_number = '`+meetingNumber+`'
+                    ORDER BY
+                        3m_meeting_current_info.create_time DESC`
+        console.log(sql);
+        let OldRecordInfo = await sequelize.query(sql);        
+        return OldRecordInfo[0][0];
+    } catch (error) {
+        throw error;
+    }
+}
+
 module.exports = new recordInfoService();
\ No newline at end of file
--
libgit2 0.24.0