Commit 8a56c7cf by Chavee Issariyapat

update

parent 5c1f7201
......@@ -24,36 +24,22 @@ module.exports = function(options={}) {
console.log(req.body);
}
var data = req.body;
console.log(123);
console.log(data.topic.substring(0,5));
//1----
console.log('amqp://'+config.get('rabbitmq_username')+':'+config.get('rabbitmq_password')+'@'+config.get('rabbitmq_host')+':'+config.get('rabbitmq_port'));
if (data.topic.substring(0,5) == '$exec') {
console.log(555);
var stopic = data.topic.substr(6);
var a = stopic.split('/');
var ptext = Buffer.from(data.payload, 'base64').toString();
console.log(stopic);
console.log(ptext);
if (stopic && ptext) {
console.log(a);
switch (a[0]) {
case 'wf' :
case 'writefeed' :
var wfmsg = [{
var wfmsg = {
"topic": stopic,
"payload":ptext,
"ts": Date.now(),
"cid": data.client_id
}];
console.log(1111);
console.log(wfmsg);
};
client.act('cmd:wf', {
message: JSON.stringify(wfmsg)
}, (err, res) => {
......@@ -65,12 +51,12 @@ console.log(wfmsg);
break;
case 'push' :
var pushmsg = [{
var pushmsg = {
"topic": stopic,
"payload":ptext,
"ts": Date.now(),
"cid": data.client_id,
}];
};
client.act('ms:kbpush,cmd:push', {
message: JSON.stringify(pushmsg)
}, (err, res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment