付智勇

修改接口

@@ -35,9 +35,7 @@ app.use(koaBody({ multipart: true })); @@ -35,9 +35,7 @@ app.use(koaBody({ multipart: true }));
35 35
36 // middlewares 36 // middlewares
37 app.use(cors()); 37 app.use(cors());
38 -app.use(bodyparser({  
39 - enableTypes:['json', 'form', 'text']  
40 -})) 38 +
41 app.use(json()) 39 app.use(json())
42 app.use(logger()) 40 app.use(logger())
43 app.use(require('koa-static')(__dirname + '/public')) 41 app.use(require('koa-static')(__dirname + '/public'))
@@ -51,7 +51,7 @@ meetingController.prototype.createMeeting = async(ctx,next)=>{ @@ -51,7 +51,7 @@ meetingController.prototype.createMeeting = async(ctx,next)=>{
51 startTime: moment(meetingbody.beginTime).format("YYYY-MM-DD HH:MM:SS "), //开始时间 51 startTime: moment(meetingbody.beginTime).format("YYYY-MM-DD HH:MM:SS "), //开始时间
52 endTime: moment(meetingbody.endTime).format("YYYY-MM-DD HH:MM:SS"), // 结束时间 52 endTime: moment(meetingbody.endTime).format("YYYY-MM-DD HH:MM:SS"), // 结束时间
53 isPublic:meetingbody.isPublic, //是否公开课 53 isPublic:meetingbody.isPublic, //是否公开课
54 - hostPwd:876, 54 + hostPwd:meetingbody.hostPwd,
55 //repeatmode:meetingbody.repeatmode, //是否重复周期 55 //repeatmode:meetingbody.repeatmode, //是否重复周期
56 meetingType:meetingbody.meetingType, //课堂类型 56 meetingType:meetingbody.meetingType, //课堂类型
57 h5Module:Number( meetingbody.h5Module), // 是否支持H5 57 h5Module:Number( meetingbody.h5Module), // 是否支持H5
@@ -94,13 +94,83 @@ meetingController.prototype.createMeeting = async(ctx,next)=>{ @@ -94,13 +94,83 @@ meetingController.prototype.createMeeting = async(ctx,next)=>{
94 94
95 meetingController.prototype.getMeeting = async(ctx,next) =>{ 95 meetingController.prototype.getMeeting = async(ctx,next) =>{
96 try { 96 try {
  97 + var sql = `SELECT
  98 + id,
  99 + meeting_number AS meetingNumber,
  100 + meeting_name AS meetingName,
  101 + meeting_content AS meetingContent,
  102 + create_user,
  103 + create_time AS createTime,
  104 + begin_time AS beginTime,
  105 + end_time AS endTime,
  106 + invite_user AS inviteUser,
  107 + meeting_type AS meetingType,
  108 + meeting_status AS meetingStatus,
  109 + user_ip AS userIp,
  110 + meeting_key AS meetingKey,
  111 + host_password AS hostPassword,
  112 + presenter_password AS presenterPassword,
  113 + assistant_password AS assistantPassword,
  114 + attendee_password AS attendeePassword,
  115 + capacity,
  116 + top_node_id AS topNodeId,
  117 + top_node_addr AS topNodeAddr,
  118 + user_data AS userData,
  119 + site_id AS siteId,
  120 + classroom_number AS classroomNumber,
  121 + ui_language AS uiLanguage,
  122 + is_public AS isPublic,
  123 + control_mode AS controlMode,
  124 + mic_auto AS micAuto,
  125 + has_interaction AS hasInteraction,
  126 + auto_record AS autoRecord,
  127 + max_videoChannels AS maxVideoChannels,
  128 + max_audioChannels AS maxAudioChannels,
  129 + video_quality AS videoQuality,
  130 + pagenavi_Userprivilege AS pagenaviUserprivilege,
  131 + marker_Userprivilege AS markerUserprivilege,
  132 + chatToNormal_Userprivilege AS chatToNormalUserprivilege,
  133 + chatToHost_Userprivilege AS chatToHostUserprivilege,
  134 + doc_module AS docModule,
  135 + screen_module AS screenModule,
  136 + media_module AS mediaModule,
  137 + whiteboard_module AS whiteboardModule,
  138 + record_module AS recordModule,
  139 + video_module AS videoModule,
  140 + userList_module AS userListModule,
  141 + chat_module AS chatModule,
  142 + cycle,
  143 + repeatmode,
  144 + endmode,
  145 + finalenddate,
  146 + endcount,
  147 + repeatday,
  148 + repeatweek,
  149 + repeatmonthday,
  150 + repeatmonthweekweek,
  151 + repeatmonthweekday,
  152 + frequency,
  153 + month_type AS monthType,
  154 + inviter_radio AS inviterRadio,
  155 + ahead_time AS aheadTime,
  156 + chat_interval AS chatInterval,
  157 + h5_Module AS h5Module
  158 + FROM
  159 + 3m_meeting AS 3m_meeting
  160 + WHERE
  161 + 3m_meeting.site_id = 'networkschool'
  162 + ORDER BY
  163 + 3m_meeting.create_time DESC
  164 + LIMIT 0,
  165 + 4;`
97 let meetingbody = ctx.request.body; 166 let meetingbody = ctx.request.body;
98 if(!meetingbody.siteId){ 167 if(!meetingbody.siteId){
99 return status.paramError('siteId'); 168 return status.paramError('siteId');
100 } 169 }
101 let page = ctx.header.page ? Number(ctx.header.page):ctx.header.page; 170 let page = ctx.header.page ? Number(ctx.header.page):ctx.header.page;
102 let pageno = ctx.header.pageno ? Number(ctx.header.pageno):ctx.header.pageno; 171 let pageno = ctx.header.pageno ? Number(ctx.header.pageno):ctx.header.pageno;
103 - let meetingData = await meetingService.getMeeting(meetingbody,page,pageno); 172 + var meetingData = await meetingService.getMeeting(meetingbody,page,pageno);
  173 + console.log(meetingData.meetingInfo)
104 return meetingData; 174 return meetingData;
105 } catch (error) { 175 } catch (error) {
106 throw error; 176 throw error;
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 }, 10 },
11 "dependencies": { 11 "dependencies": {
12 "debug": "^2.6.3", 12 "debug": "^2.6.3",
  13 + "filepreview": "^1.0.14",
13 "koa": "^2.2.0", 14 "koa": "^2.2.0",
14 "koa-better-body": "^3.0.4", 15 "koa-better-body": "^3.0.4",
15 "koa-body": "^2.3.0", 16 "koa-body": "^2.3.0",
@@ -19,9 +19,86 @@ meetingService.prototype.createMeeting = async(meetingInfo) =>{ @@ -19,9 +19,86 @@ meetingService.prototype.createMeeting = async(meetingInfo) =>{
19 } 19 }
20 meetingService.prototype.getMeeting = async(queryData,page = 1,pageno =12) =>{ 20 meetingService.prototype.getMeeting = async(queryData,page = 1,pageno =12) =>{
21 try { 21 try {
22 - let backMeeting = await meetingModel.findAll({where:queryData,order:[['createTime', 'DESC']], offset: (page-1)*pageno, limit: pageno}); 22 + let sql =`SELECT
  23 + id,
  24 + meeting_number AS meetingNumber,
  25 + meeting_name AS meetingName,
  26 + meeting_content AS meetingContent,
  27 + create_user,
  28 + create_time AS createTime,
  29 + begin_time AS beginTime,
  30 + end_time AS endTime,
  31 + invite_user AS inviteUser,
  32 + meeting_type AS meetingType,
  33 + meeting_status AS meetingStatus,
  34 + user_ip AS userIp,
  35 + meeting_key AS meetingKey,
  36 + host_password AS hostPassword,
  37 + presenter_password AS presenterPassword,
  38 + assistant_password AS assistantPassword,
  39 + attendee_password AS attendeePassword,
  40 + capacity,
  41 + top_node_id AS topNodeId,
  42 + top_node_addr AS topNodeAddr,
  43 + user_data AS userData,
  44 + site_id AS siteId,
  45 + classroom_number AS classroomNumber,
  46 + ui_language AS uiLanguage,
  47 + is_public AS isPublic,
  48 + control_mode AS controlMode,
  49 + mic_auto AS micAuto,
  50 + has_interaction AS hasInteraction,
  51 + auto_record AS autoRecord,
  52 + max_videoChannels AS maxVideoChannels,
  53 + max_audioChannels AS maxAudioChannels,
  54 + video_quality AS videoQuality,
  55 + pagenavi_Userprivilege AS pagenaviUserprivilege,
  56 + marker_Userprivilege AS markerUserprivilege,
  57 + chatToNormal_Userprivilege AS chatToNormalUserprivilege,
  58 + chatToHost_Userprivilege AS chatToHostUserprivilege,
  59 + doc_module AS docModule,
  60 + screen_module AS screenModule,
  61 + media_module AS mediaModule,
  62 + whiteboard_module AS whiteboardModule,
  63 + record_module AS recordModule,
  64 + video_module AS videoModule,
  65 + userList_module AS userListModule,
  66 + chat_module AS chatModule,
  67 + cycle,
  68 + repeatmode,
  69 + endmode,
  70 + finalenddate,
  71 + endcount,
  72 + repeatday,
  73 + repeatweek,
  74 + repeatmonthday,
  75 + repeatmonthweekweek,
  76 + repeatmonthweekday,
  77 + frequency,
  78 + month_type AS monthType,
  79 + inviter_radio AS inviterRadio,
  80 + ahead_time AS aheadTime,
  81 + chat_interval AS chatInterval,
  82 + h5_Module AS h5Module,
  83 + (
  84 + SELECT
  85 + COUNT(*)
  86 + FROM
  87 + 3m_student_meeting
  88 + WHERE
  89 + 3m_student_meeting.meeting_id = 3m_meeting.id
  90 + ) reservationNumber
  91 + FROM
  92 + 3m_meeting AS 3m_meeting
  93 + WHERE 3m_meeting.site_id = '` +queryData.siteId+"'";
  94 + if(queryData.create_user){
  95 + sql += " and 3m_meeting.create_user = '" + queryData.create_user+"'";
  96 + }
  97 + sql += ' ORDER BY 3m_meeting.create_time DESC LIMIT '+(page-1)*pageno+' , ' +pageno
  98 + let backMeeting = await sequelize.query(sql);
  99 + //let backMeeting = await meetingModel.findAll({where:queryData,order:[['createTime', 'DESC']], offset: (page-1)*pageno, limit: pageno});
23 let count = await meetingModel.count({where:queryData}) 100 let count = await meetingModel.count({where:queryData})
24 - return {meetingInfo:backMeeting,count:count,page:page,pageno:pageno}; 101 + return {meetingInfo:backMeeting[0],count:count,page:page,pageno:pageno};
25 } catch (error) { 102 } catch (error) {
26 console.error(error) 103 console.error(error)
27 throw error; 104 throw error;