正在显示
3 个修改的文件
包含
40 行增加
和
3 行删除
| @@ -100,4 +100,15 @@ studentMeetingController.prototype.getStudentMeetingByStudentId = async(ctx, nex | @@ -100,4 +100,15 @@ studentMeetingController.prototype.getStudentMeetingByStudentId = async(ctx, nex | ||
| 100 | } | 100 | } |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | +studentMeetingController.prototype.isAppointment = async(ctx, next)=>{ | ||
| 104 | + try { | ||
| 105 | + var body = ctx.request.body; | ||
| 106 | + let Appointment = await studentMeetingService.isAppointment(body); | ||
| 107 | + return Appointment; | ||
| 108 | + } catch (error) { | ||
| 109 | + console.log(error) | ||
| 110 | + throw error | ||
| 111 | + } | ||
| 112 | +} | ||
| 113 | + | ||
| 103 | module.exports = new studentMeetingController(); | 114 | module.exports = new studentMeetingController(); |
| @@ -57,6 +57,19 @@ router.get('/queryStudentMeeting/:teacherName',async (ctx, next) => { | @@ -57,6 +57,19 @@ router.get('/queryStudentMeeting/:teacherName',async (ctx, next) => { | ||
| 57 | }) | 57 | }) |
| 58 | 58 | ||
| 59 | /** | 59 | /** |
| 60 | + * 根据查询老师的预约 | ||
| 61 | + */ | ||
| 62 | +router.post('/isAppointment',async (ctx, next) => { | ||
| 63 | + try{ | ||
| 64 | + var data = await studentMeetingController.isAppointment(ctx, next); | ||
| 65 | + status.successTemp(ctx,200,data); | ||
| 66 | + }catch(e){ | ||
| 67 | + console.log(e) | ||
| 68 | + status.catchError(ctx,400,e.message); | ||
| 69 | + } | ||
| 70 | +}) | ||
| 71 | + | ||
| 72 | +/** | ||
| 60 | * 查询站点的预约课程 | 73 | * 查询站点的预约课程 |
| 61 | */ | 74 | */ |
| 62 | router.get('/getStudentMeetingBySite/:siteId',async (ctx, next) => { | 75 | router.get('/getStudentMeetingBySite/:siteId',async (ctx, next) => { |
| @@ -100,6 +100,7 @@ studentMeetingService.prototype.updateStudentMeetingBySite = async(id,data) =>{ | @@ -100,6 +100,7 @@ studentMeetingService.prototype.updateStudentMeetingBySite = async(id,data) =>{ | ||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | studentMeetingService.prototype.getStudentMeetingByStudentId = async(id,page=1,pageno=8) =>{ | 102 | studentMeetingService.prototype.getStudentMeetingByStudentId = async(id,page=1,pageno=8) =>{ |
| 103 | + try { | ||
| 103 | let querySql = `SELECT | 104 | let querySql = `SELECT |
| 104 | 3u.*, 3meet.meeting_name, | 105 | 3u.*, 3meet.meeting_name, |
| 105 | 3meet.meeting_status meetingStatus, | 106 | 3meet.meeting_status meetingStatus, |
| @@ -120,9 +121,21 @@ studentMeetingService.prototype.getStudentMeetingByStudentId = async(id,page=1,p | @@ -120,9 +121,21 @@ studentMeetingService.prototype.getStudentMeetingByStudentId = async(id,page=1,p | ||
| 120 | WHERE | 121 | WHERE |
| 121 | 3sm.student_id = '` +id+"'";; | 122 | 3sm.student_id = '` +id+"'";; |
| 122 | 123 | ||
| 123 | -querySql += ' AND 3sm.status != 5 ORDER BY 3sm.create_time DESC LIMIT '+(page-1)*pageno+' , ' +pageno | ||
| 124 | -let sm = await sequelize.query(querySql); | ||
| 125 | -return sm[0]; | 124 | + querySql += ' AND 3sm.status != 5 ORDER BY 3sm.create_time DESC LIMIT '+(page-1)*pageno+' , ' +pageno |
| 125 | + let sm = await sequelize.query(querySql); | ||
| 126 | + return sm[0]; | ||
| 127 | + } catch (error) { | ||
| 128 | + throw error | ||
| 129 | + } | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +studentMeetingService.prototype.isAppointment = async(body)=>{ | ||
| 133 | + try { | ||
| 134 | + let Appointment = await studentMeeting.findAll({where:body}); | ||
| 135 | + return Appointment; | ||
| 136 | + } catch (error) { | ||
| 137 | + throw error; | ||
| 138 | + } | ||
| 126 | } | 139 | } |
| 127 | 140 | ||
| 128 | module.exports = new studentMeetingService(); | 141 | module.exports = new studentMeetingService(); |
-
请 注册 或 登录 后发表评论