正在显示
4 个修改的文件
包含
44 行增加
和
5 行删除
@@ -100,6 +100,9 @@ meetingController.prototype.getMeeting = async(ctx,next) =>{ | @@ -100,6 +100,9 @@ meetingController.prototype.getMeeting = async(ctx,next) =>{ | ||
100 | } | 100 | } |
101 | let page = ctx.header.page ? Number(ctx.header.page):ctx.header.page; | 101 | let page = ctx.header.page ? Number(ctx.header.page):ctx.header.page; |
102 | let pageno = ctx.header.pageno; | 102 | let pageno = ctx.header.pageno; |
103 | + if(ctx.header.type == 8){ | ||
104 | + pageno = 8; | ||
105 | + } | ||
103 | let meetingData = await meetingService.getMeeting(meetingbody,page,pageno); | 106 | let meetingData = await meetingService.getMeeting(meetingbody,page,pageno); |
104 | return meetingData; | 107 | return meetingData; |
105 | } catch (error) { | 108 | } catch (error) { |
@@ -31,5 +31,18 @@ studentMeetingController.prototype.addStudentMeeting = async(ctx, next)=>{ | @@ -31,5 +31,18 @@ studentMeetingController.prototype.addStudentMeeting = async(ctx, next)=>{ | ||
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | +studentMeetingController.prototype.getStudentMeetingCount = async(ctx, next) =>{ | ||
35 | + try { | ||
36 | + let meetingId = ctx.params.meetingId; | ||
37 | + if(!meetingId){ | ||
38 | + return status.paramError('meetingId'); | ||
39 | + } | ||
40 | + let sn = await studentMeetingService.getStudentMeetingCount(meetingId); | ||
41 | + return sn | ||
42 | + } catch (error) { | ||
43 | + throw error; | ||
44 | + } | ||
45 | +} | ||
46 | + | ||
34 | 47 | ||
35 | module.exports = new studentMeetingController(); | 48 | module.exports = new studentMeetingController(); |
@@ -17,5 +17,18 @@ router.post('/addStudentMeeting',async (ctx, next) => { | @@ -17,5 +17,18 @@ router.post('/addStudentMeeting',async (ctx, next) => { | ||
17 | } | 17 | } |
18 | }) | 18 | }) |
19 | 19 | ||
20 | + /** | ||
21 | + * 查询课堂预约人数 | ||
22 | + */ | ||
23 | +router.get('/getStudentMeetingCount/:meetingId',async (ctx, next) => { | ||
24 | + try{ | ||
25 | + var data = await studentMeetingController.getStudentMeetingCount(ctx, next); | ||
26 | + status.successTemp(ctx,200,data); | ||
27 | + }catch(e){ | ||
28 | + console.log(e) | ||
29 | + status.catchError(ctx,400,e.message); | ||
30 | + } | ||
31 | +}) | ||
32 | + | ||
20 | 33 | ||
21 | module.exports = router; | 34 | module.exports = router; |
@@ -19,11 +19,11 @@ sutudentMeetingService.prototype.addStudentMeeting = async(body)=>{ | @@ -19,11 +19,11 @@ sutudentMeetingService.prototype.addStudentMeeting = async(body)=>{ | ||
19 | t.rollback(); | 19 | t.rollback(); |
20 | return {code:300,msg:'课堂不存在'} | 20 | return {code:300,msg:'课堂不存在'} |
21 | } | 21 | } |
22 | - let sm = await sutudentMeeting.create(body); | ||
23 | - let MeetingBack = await meetingModel.update( | ||
24 | - {reservationNumber:Meeting.reservationNumber+1}, | ||
25 | - {where:{id:body.meetingId}}, | ||
26 | - {transaction: t}); | 22 | + let sm = await sutudentMeeting.create(body,{transaction: t}); |
23 | + // let MeetingBack = await meetingModel.update( | ||
24 | + // {reservationNumber:Meeting.reservationNumber+1}, | ||
25 | + // {where:{id:body.meetingId}}, | ||
26 | + // {transaction: t}); | ||
27 | t.commit(); | 27 | t.commit(); |
28 | return sm; | 28 | return sm; |
29 | } catch (error) { | 29 | } catch (error) { |
@@ -32,4 +32,14 @@ sutudentMeetingService.prototype.addStudentMeeting = async(body)=>{ | @@ -32,4 +32,14 @@ sutudentMeetingService.prototype.addStudentMeeting = async(body)=>{ | ||
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | +sutudentMeetingService.prototype.getStudentMeetingCount = async(meetingId) =>{ | ||
36 | + try { | ||
37 | + let sm = await sutudentMeeting.count({where:{meetingId:meetingId}}) | ||
38 | + return sm; | ||
39 | + } catch (error) { | ||
40 | + console.log(error) | ||
41 | + throw error; | ||
42 | + } | ||
43 | +} | ||
44 | + | ||
35 | module.exports = new sutudentMeetingService(); | 45 | module.exports = new sutudentMeetingService(); |
-
请 注册 或 登录 后发表评论