meetingService.js
5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
var meetingModel = require('../model/meetingModel');
var status = require('../util/resTemplate');
var saitMd5 = require('../util/saltMD5');
var sequelize = require('../config');
var tokenUtil = require('../util/tokenUtil');
var co = require('co');
function meetingService(){
}
meetingService.prototype.createMeeting = async(meetingInfo) =>{
try {
let backMeeting = await meetingModel.create(meetingInfo);
return backMeeting
} catch (error) {
throw error
}
}
meetingService.prototype.getMeeting = async(queryData,page = 1,pageno =12) =>{
try {
let sql =`SELECT
id,
meeting_number AS meetingNumber,
meeting_name AS meetingName,
meeting_content AS meetingContent,
create_user,
create_time AS createTime,
begin_time AS beginTime,
end_time AS endTime,
invite_user AS inviteUser,
meeting_type AS meetingType,
meeting_status AS meetingStatus,
user_ip AS userIp,
meeting_key AS meetingKey,
host_password AS hostPassword,
presenter_password AS presenterPassword,
assistant_password AS assistantPassword,
attendee_password AS attendeePassword,
capacity,
top_node_id AS topNodeId,
top_node_addr AS topNodeAddr,
user_data AS userData,
site_id AS siteId,
classroom_number AS classroomNumber,
ui_language AS uiLanguage,
is_public AS isPublic,
control_mode AS controlMode,
mic_auto AS micAuto,
has_interaction AS hasInteraction,
auto_record AS autoRecord,
max_videoChannels AS maxVideoChannels,
max_audioChannels AS maxAudioChannels,
video_quality AS videoQuality,
pagenavi_Userprivilege AS pagenaviUserprivilege,
marker_Userprivilege AS markerUserprivilege,
chatToNormal_Userprivilege AS chatToNormalUserprivilege,
chatToHost_Userprivilege AS chatToHostUserprivilege,
doc_module AS docModule,
screen_module AS screenModule,
media_module AS mediaModule,
whiteboard_module AS whiteboardModule,
record_module AS recordModule,
video_module AS videoModule,
userList_module AS userListModule,
chat_module AS chatModule,
cycle,
repeatmode,
endmode,
finalenddate,
endcount,
repeatday,
repeatweek,
repeatmonthday,
repeatmonthweekweek,
repeatmonthweekday,
frequency,
month_type AS monthType,
inviter_radio AS inviterRadio,
ahead_time AS aheadTime,
chat_interval AS chatInterval,
h5_Module AS h5Module,
(
SELECT
COUNT(*)
FROM
3m_student_meeting
WHERE
3m_student_meeting.meeting_id = 3m_meeting.id
) reservationNumber
FROM
3m_meeting AS 3m_meeting
WHERE 3m_meeting.site_id = '` +queryData.siteId+"'";
if(queryData.create_user){
sql += " and 3m_meeting.create_user = '" + queryData.create_user+"'";
}
sql += ' ORDER BY 3m_meeting.create_time DESC LIMIT '+(page-1)*pageno+' , ' +pageno
let backMeeting = await sequelize.query(sql);
//let backMeeting = await meetingModel.findAll({where:queryData,order:[['createTime', 'DESC']], offset: (page-1)*pageno, limit: pageno});
let count = await meetingModel.count({where:queryData})
return {meetingInfo:backMeeting[0],count:count,page:page,pageno:pageno};
} catch (error) {
console.error(error)
throw error;
}
}
meetingService.prototype.delMeeting = async(meetingId) =>{
try {
let Meeting = await meetingModel.findOne({where:{id:meetingId}});
if(!Meeting){
return {code:11,msg:'课堂不存在'}
}
let backMeeting = await meetingModel.destroy({where:{id:meetingId}});
return backMeeting
} catch (error) {
throw error;
}
}
meetingService.prototype.updateMeeting = async(params,meetingId) =>{
try {
let Meeting = await meetingModel.findOne({where:{id:meetingId}});
if(!Meeting){
return {code:11,msg:'课堂不存在'}
}
let backMeeting = await meetingModel.update({where:{id:meetingId}});
return backMeeting
} catch (error) {
console.error(error);
throw error
}
}
module.exports = new meetingService();