-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdeleteChannel.js
47 lines (43 loc) · 1.48 KB
/
deleteChannel.js
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
/*
* deleteChannel
* 删除频道
*/
function onRequest(request, response, modules) {
var channelObjectId = request.body.channelObjectId;
var db = modules.oData;
var rel = modules.oRelation;
rel.query({
"table":"ChannelSubscriber",
"where":{"channel":channelObjectId}
},function(err,data) {
var ChannelSubscribers = JSON.parse(data).results;
for(var i=0; i<ChannelSubscribers.length; i++) {
var ChannelSubscriber = ChannelSubscribers[i];
db.remove({
"table":"ChannelSubscriber", //表名
"objectId":ChannelSubscriber.objectId //记录的objectId
},function(err,data){ //回调函数
});
}
});
rel.query({
"table":"ChannelSigner",
"where":{"channel":channelObjectId}
},function(err,data) {
var ChannelSigners = JSON.parse(data).results;
for(var i=0; i<ChannelSigners.length; i++) {
var ChannelSigner = ChannelSigners[i];
db.remove({
"table":"ChannelSigner", //表名
"objectId":ChannelSigner.objectId //记录的objectId
},function(err,data){ //回调函数
});
}
});
db.remove({
"table":"Channel", //表名
"objectId":channelObjectId //记录的objectId
},function(err,data){ //回调函数
});
response.send("ok");
}