recordInfoService.js 1.7 KB
const recordInfo =require( '../model/RecordInfoModel')
const tencentRecordInfoModel =require( '../model/tencentRecordInfoModel')
const callfile = require('child_process');
const  fs = require('fs');


function recordInfoService(){

}
recordInfoService.prototype.updaterecordInfo = async(channel)=>{
    try {
        let channelupdate = await recordInfo.update(
            {status:0},
            {where:
                {channel:channel}})
        return channelupdate;
    } catch (error) {
        throw error;
    }
}
recordInfoService.prototype.addRecordInfo = async(body) =>{
    try {
        let addrecord =  await recordInfo.create(body);
        return addrecord;
    } catch (error) {
        throw error;
    }
}
recordInfoService.prototype.getRecordInfo = async(channel) =>{
    try {
        let addrecord =  await recordInfo.findAll({where:{channel:channel}});
        return addrecord;
    } catch (error) {
        throw error;
    }
}
recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{
    try {
        let tencentRecordInfo = await tencentRecordInfoModel.findAll({where:{channelId:channelId}})
        return tencentRecordInfo
    } catch (error) {
        throw error;
    }
}

recordInfoService.prototype.getRecordFileURL = async(URL)=>{
    try {
        let path = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples'+URL
        let myPath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/'+URL
        let shell = `/20171011/markettest_1227676976_023539/`
        // let filenames = await callfile.exec(myPath) 
        let files=fs.readdirSync(path);        
        console.log(files)
        return files       
    } catch (error) {
        throw error;
    }
    
}

module.exports = new recordInfoService();