付智勇

no message

@@ -77,4 +77,16 @@ recordInfoController.prototype.tencentRecordInfo = async(ctx,next)=>{ @@ -77,4 +77,16 @@ recordInfoController.prototype.tencentRecordInfo = async(ctx,next)=>{
77 throw error; 77 throw error;
78 } 78 }
79 } 79 }
  80 +
  81 +recordInfoController.prototype.getRecordFileURL = async(ctx,next)=>{
  82 + try {
  83 + const path = ctx.request.body.path;
  84 + let recordInfo = await recordInfoService.getRecordFileURL(path)
  85 + return recordInfo;
  86 + } catch (e) {
  87 + console.log(e)
  88 + throw e
  89 + }
  90 +
  91 +}
80 module.exports = new recordInfoController() 92 module.exports = new recordInfoController()
@@ -44,7 +44,7 @@ router.put('/updaterecordInfo/:channel', async (ctx, next) => { @@ -44,7 +44,7 @@ router.put('/updaterecordInfo/:channel', async (ctx, next) => {
44 } 44 }
45 }) 45 })
46 46
47 - router.post('/tencentRecordInfo', async (ctx, next) => { 47 +router.post('/tencentRecordInfo', async (ctx, next) => {
48 try{ 48 try{
49 var data = await meetingContoller.tencentRecordInfo(ctx, next); 49 var data = await meetingContoller.tencentRecordInfo(ctx, next);
50 status.successTemp(ctx,200,data); 50 status.successTemp(ctx,200,data);
@@ -52,6 +52,15 @@ router.put('/updaterecordInfo/:channel', async (ctx, next) => { @@ -52,6 +52,15 @@ router.put('/updaterecordInfo/:channel', async (ctx, next) => {
52 console.error(e) 52 console.error(e)
53 status.catchError(ctx,400,e.message); 53 status.catchError(ctx,400,e.message);
54 } 54 }
55 - }) 55 +})
  56 +router.post('/getRecordFileURL', async (ctx, next) => {
  57 + try{
  58 + var data = await meetingContoller.getRecordFileURL(ctx, next);
  59 + status.successTemp(ctx,200,data);
  60 + }catch(e){
  61 + console.error(e)
  62 + status.catchError(ctx,400,e.message);
  63 + }
  64 +})
56 65
57 module.exports = router 66 module.exports = router
1 const recordInfo =require( '../model/RecordInfoModel') 1 const recordInfo =require( '../model/RecordInfoModel')
2 const tencentRecordInfoModel =require( '../model/tencentRecordInfoModel') 2 const tencentRecordInfoModel =require( '../model/tencentRecordInfoModel')
  3 +const callfile = require('child_process');
  4 +const fs = require('fs');
3 5
4 6
5 function recordInfoService(){ 7 function recordInfoService(){
@@ -40,4 +42,20 @@ recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{ @@ -40,4 +42,20 @@ recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{
40 throw error; 42 throw error;
41 } 43 }
42 } 44 }
  45 +
  46 +recordInfoService.prototype.getRecordFileURL = async(URL)=>{
  47 + try {
  48 + let path = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples'
  49 + let myPath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/'+URL
  50 + let shell = `/20171011/markettest_1227676976_023539/`
  51 + // let filenames = await callfile.exec(myPath)
  52 + let files=fs.readdirSync(path);
  53 + console.log(files)
  54 + return files
  55 + } catch (error) {
  56 + throw error;
  57 + }
  58 +
  59 +}
  60 +
43 module.exports = new recordInfoService(); 61 module.exports = new recordInfoService();
@@ -37,6 +37,7 @@ studentMeetingService.prototype.addStudentMeeting = async(body)=>{ @@ -37,6 +37,7 @@ studentMeetingService.prototype.addStudentMeeting = async(body)=>{
37 t.rollback(); 37 t.rollback();
38 return {code:300,msg:'课堂不存在'} 38 return {code:300,msg:'课堂不存在'}
39 } 39 }
  40 +
40 let sm = await studentMeeting.create(body,{transaction: t}); 41 let sm = await studentMeeting.create(body,{transaction: t});
41 // let MeetingBack = await meetingModel.update( 42 // let MeetingBack = await meetingModel.update(
42 // {reservationNumber:Meeting.reservationNumber+1}, 43 // {reservationNumber:Meeting.reservationNumber+1},
@@ -83,8 +84,48 @@ studentMeetingService.prototype.queryStudentMeeting = async(teacherName,page=1,p @@ -83,8 +84,48 @@ studentMeetingService.prototype.queryStudentMeeting = async(teacherName,page=1,p
83 84
84 studentMeetingService.prototype.getStudentMeetingBySite = async(siteId,page=1,pageno=8)=>{ 85 studentMeetingService.prototype.getStudentMeetingBySite = async(siteId,page=1,pageno=8)=>{
85 try { 86 try {
86 - let StudentMeetingBySite = await studentMeeting.findAll({where:{siteId:siteId}});  
87 - return StudentMeetingBySite; 87 + let querySql = `SELECT
  88 + 3u.*, 3meet.meeting_name,
  89 + 3meet.meeting_status meetingStatus,
  90 + 3meet.id meetingId,
  91 + 3meet.create_user teacherName,
  92 + 3meet.meeting_number meetingNumber,
  93 + 3meet.begin_time meetingBeginTime,
  94 + 3meet.end_time meetingEndTime,
  95 + 3sm. STATUS studentMeetingStatus,
  96 + 3u2.user_name checkUserName,
  97 + 3sm.check_time check_time,
  98 + 3sm.id studentMeetingId,
  99 + (SELECT
  100 + 3m_attachment.path
  101 + FROM
  102 + 3m_user
  103 + LEFT JOIN 3m_attachment ON 3m_attachment.business_id = 3m_user.id
  104 + WHERE
  105 + 3m_user.login_name = 3meet.create_user) teacherPhoto,
  106 + (
  107 + SELECT
  108 + path
  109 + FROM
  110 + 3m_attachment
  111 + WHERE
  112 + 3m_attachment.business_id = 3meet.id and 3m_attachment.category = 1
  113 + ) meetingPhoto
  114 + FROM
  115 + 3m_student_meeting 3sm
  116 + LEFT JOIN 3m_user 3u ON 3u.id = 3sm.student_id
  117 + LEFT JOIN 3m_user 3u2 ON 3u2.id = 3sm.check_user_id
  118 + LEFT JOIN 3m_meeting 3meet ON 3meet.id = 3sm.meeting_id
  119 + WHERE
  120 + 3sm.site_id = '` +siteId+"'";;
  121 +
  122 +
  123 + querySql += ' AND 3sm.status != 5 ORDER BY 3sm.create_time DESC LIMIT '+(page-1)*pageno+' , ' +pageno
  124 + let count = await studentMeeting.count({where:{siteId:siteId,status:{$ne: 5}}})
  125 + let sm = await sequelize.query(querySql);
  126 + return {studentMeeting:sm[0],count:count,page:page,pageno:pageno};
  127 +
  128 + //return sm[0];
88 } catch (error) { 129 } catch (error) {
89 throw error; 130 throw error;
90 } 131 }