Built motion from commit f0b1811d.|2.6.6
[motion2.git] / server / api / chatInteraction / chatInteraction.rpc.js
index 46a7806..4a12b40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1570=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','find','addTags','body'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1570,0xd6));var _0x0157=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x1570[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0157('0x0'));var util=require(_0x0157('0x1'));var moment=require(_0x0157('0x2'));var BPromise=require(_0x0157('0x3'));var rs=require(_0x0157('0x4'));var fs=require('fs');var Redis=require(_0x0157('0x5'));var db=require(_0x0157('0x6'))['db'];var utils=require(_0x0157('0x7'));var logger=require('../../config/logger')(_0x0157('0x8'));var config=require(_0x0157('0x9'));var jayson=require(_0x0157('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0157('0xb')](config['redis'],{'host':_0x0157('0xc'),'port':0x18eb});var socket=require(_0x0157('0xd'))(new Redis(config[_0x0157('0xe')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1309eb,_0x3fbf3a,_0xfc6e06){return new BPromise(function(_0x55b362,_0x3909ba){return client[_0x0157('0xf')](_0x1309eb,_0xfc6e06)[_0x0157('0x10')](function(_0x4e28f9){logger[_0x0157('0x11')](_0x0157('0x12'),_0x3fbf3a,_0x0157('0x13'));logger[_0x0157('0x14')](_0x0157('0x15'),_0x3fbf3a,_0x0157('0x13'),JSON[_0x0157('0x16')](_0x4e28f9));if(_0x4e28f9[_0x0157('0x17')]){if(_0x4e28f9['error'][_0x0157('0x18')]===0x1f4){logger['error'](_0x0157('0x12'),_0x3fbf3a,_0x4e28f9[_0x0157('0x17')]['message']);return _0x3909ba(_0x4e28f9[_0x0157('0x17')]['message']);}logger[_0x0157('0x17')](_0x0157('0x12'),_0x3fbf3a,_0x4e28f9[_0x0157('0x17')][_0x0157('0x19')]);return _0x55b362(_0x4e28f9[_0x0157('0x17')]['message']);}else{logger[_0x0157('0x11')](_0x0157('0x12'),_0x3fbf3a,_0x0157('0x13'));_0x55b362(_0x4e28f9[_0x0157('0x1a')][_0x0157('0x19')]);}})[_0x0157('0x1b')](function(_0x309cf7){logger[_0x0157('0x17')](_0x0157('0x12'),_0x3fbf3a,_0x309cf7);_0x3909ba(_0x309cf7);});});}exports[_0x0157('0x1c')]=function(_0x2c1d29){var _0x51e5ef=this;return new Promise(function(_0xfd4fb6,_0x3cf22c){return db[_0x0157('0x1d')][_0x0157('0x1e')](_0x2c1d29['body'],{'raw':_0x2c1d29['options']?_0x2c1d29[_0x0157('0x1f')][_0x0157('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1d29[_0x0157('0x1f')]?_0x2c1d29[_0x0157('0x1f')][_0x0157('0x21')]||null:null,'attributes':_0x2c1d29[_0x0157('0x1f')]?_0x2c1d29[_0x0157('0x1f')][_0x0157('0x22')]||null:null,'limit':_0x2c1d29[_0x0157('0x1f')]?_0x2c1d29[_0x0157('0x1f')]['limit']||null:null})[_0x0157('0x10')](function(_0xcb75ab){logger[_0x0157('0x11')]('UpdateChatInteraction',_0x2c1d29);logger[_0x0157('0x14')](_0x0157('0x1c'),_0x2c1d29,JSON[_0x0157('0x16')](_0xcb75ab));_0xfd4fb6(_0xcb75ab);})['catch'](function(_0x2a8249){logger[_0x0157('0x17')](_0x0157('0x1c'),_0x2a8249[_0x0157('0x19')],_0x2c1d29);_0x3cf22c(_0x51e5ef[_0x0157('0x17')](0x1f4,_0x2a8249[_0x0157('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x4a1f3c){return new Promise(function(_0x232cd2,_0x1a6106){return db[_0x0157('0x1d')][_0x0157('0x23')]({'where':_0x4a1f3c[_0x0157('0x1f')]?_0x4a1f3c['options'][_0x0157('0x21')]||null:null})[_0x0157('0x10')](function(_0x1e6dda){if(_0x1e6dda){return _0x1e6dda[_0x0157('0x24')](_0x4a1f3c[_0x0157('0x25')][_0x0157('0x26')],_[_0x0157('0x27')](_0x4a1f3c[_0x0157('0x25')],['ids','id'])||{});}})[_0x0157('0x28')](function(_0x448b81){logger['info'](_0x0157('0x29'),_0x4a1f3c);logger[_0x0157('0x14')]('AddTags',_0x4a1f3c,JSON[_0x0157('0x16')](_0x448b81));_0x232cd2(_0x448b81);})['catch'](function(_0xb0afc8){logger[_0x0157('0x17')](_0x0157('0x29'),_0xb0afc8[_0x0157('0x19')],_0x4a1f3c);_0x1a6106(_this[_0x0157('0x17')](0x1f4,_0xb0afc8[_0x0157('0x19')]));});});};
\ No newline at end of file
+var _0x8765=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','code','error','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','options','where','attributes','limit','stringify','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','debug'];(function(_0x168466,_0x5f37e5){var _0xcf8a4=function(_0x48cf99){while(--_0x48cf99){_0x168466['push'](_0x168466['shift']());}};_0xcf8a4(++_0x5f37e5);}(_0x8765,0x7e));var _0x5876=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8765[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5876('0x0'));var util=require(_0x5876('0x1'));var moment=require(_0x5876('0x2'));var BPromise=require(_0x5876('0x3'));var rs=require(_0x5876('0x4'));var fs=require('fs');var Redis=require(_0x5876('0x5'));var db=require(_0x5876('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5876('0x7'));var config=require(_0x5876('0x8'));var jayson=require(_0x5876('0x9'));var client=jayson[_0x5876('0xa')][_0x5876('0xb')]({'port':0x232a});config[_0x5876('0xc')]=_[_0x5876('0xd')](config['redis'],{'host':_0x5876('0xe'),'port':0x18eb});var socket=require(_0x5876('0xf'))(new Redis(config[_0x5876('0xc')]));require(_0x5876('0x10'))[_0x5876('0x11')](socket);function respondWithRpcPromise(_0x201cda,_0x5ca96a,_0x14f43a){return new BPromise(function(_0x32d23c,_0x2b40aa){return client[_0x5876('0x12')](_0x201cda,_0x14f43a)[_0x5876('0x13')](function(_0x33dc43){logger[_0x5876('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5ca96a,_0x5876('0x15'));logger['debug'](_0x5876('0x16'),_0x5ca96a,'request\x20sent',JSON['stringify'](_0x33dc43));if(_0x33dc43['error']){if(_0x33dc43['error'][_0x5876('0x17')]===0x1f4){logger[_0x5876('0x18')](_0x5876('0x19'),_0x5ca96a,_0x33dc43[_0x5876('0x18')][_0x5876('0x1a')]);return _0x2b40aa(_0x33dc43[_0x5876('0x18')][_0x5876('0x1a')]);}logger[_0x5876('0x18')](_0x5876('0x19'),_0x5ca96a,_0x33dc43['error'][_0x5876('0x1a')]);return _0x32d23c(_0x33dc43[_0x5876('0x18')][_0x5876('0x1a')]);}else{logger[_0x5876('0x14')](_0x5876('0x19'),_0x5ca96a,'request\x20sent');_0x32d23c(_0x33dc43['result'][_0x5876('0x1a')]);}})[_0x5876('0x1b')](function(_0xe7cf54){logger[_0x5876('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5ca96a,_0xe7cf54);_0x2b40aa(_0xe7cf54);});});}exports[_0x5876('0x1c')]=function(_0x58b040){var _0x46ccb5=this;return new Promise(function(_0x160ad4,_0x12588c){return db['ChatInteraction']['update'](_0x58b040['body'],{'raw':_0x58b040[_0x5876('0x1d')]?_0x58b040[_0x5876('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b040[_0x5876('0x1d')]?_0x58b040['options'][_0x5876('0x1e')]||null:null,'attributes':_0x58b040[_0x5876('0x1d')]?_0x58b040[_0x5876('0x1d')][_0x5876('0x1f')]||null:null,'limit':_0x58b040['options']?_0x58b040[_0x5876('0x1d')][_0x5876('0x20')]||null:null})[_0x5876('0x13')](function(_0x6d30da){logger['info'](_0x5876('0x1c'),_0x58b040);logger['debug']('UpdateChatInteraction',_0x58b040,JSON[_0x5876('0x21')](_0x6d30da));_0x160ad4(_0x6d30da);})[_0x5876('0x1b')](function(_0x43cd80){logger[_0x5876('0x18')](_0x5876('0x1c'),_0x43cd80[_0x5876('0x1a')],_0x58b040);_0x12588c(_0x46ccb5['error'](0x1f4,_0x43cd80[_0x5876('0x1a')]));});});};exports[_0x5876('0x22')]=function(_0x3f8186){return new Promise(function(_0x7b4aeb,_0x31e3df){return db['ChatInteraction'][_0x5876('0x23')]({'where':_0x3f8186['options']?_0x3f8186[_0x5876('0x1d')][_0x5876('0x1e')]||null:null})[_0x5876('0x13')](function(_0x597447){if(_0x597447){return _0x597447['addTags'](_0x3f8186[_0x5876('0x24')][_0x5876('0x25')],_[_0x5876('0x26')](_0x3f8186[_0x5876('0x24')],[_0x5876('0x25'),'id'])||{});}})[_0x5876('0x27')](function(_0x555a48){logger[_0x5876('0x14')](_0x5876('0x28'),_0x3f8186);logger[_0x5876('0x29')](_0x5876('0x28'),_0x3f8186,JSON[_0x5876('0x21')](_0x555a48));_0x7b4aeb(_0x555a48);})[_0x5876('0x1b')](function(_0x1dbea6){logger[_0x5876('0x18')](_0x5876('0x28'),_0x1dbea6['message'],_0x3f8186);_0x31e3df(_this['error'](0x1f4,_0x1dbea6[_0x5876('0x1a')]));});});};
\ No newline at end of file