Built motion from commit 56b8093a.|2.6.29
[motion2.git] / server / api / chatInteraction / chatInteraction.rpc.js
index b854d0b..1a5ae5e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4590=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','body','options','raw','where','attributes','limit','UpdateChatInteraction','stringify','catch','AddTagsToChatInteraction','ChatInteraction','addTags','ids','omit','AddTags','lodash','util'];(function(_0x3c929e,_0x55dea5){var _0x42adbb=function(_0x4d97ca){while(--_0x4d97ca){_0x3c929e['push'](_0x3c929e['shift']());}};_0x42adbb(++_0x55dea5);}(_0x4590,0x198));var _0x0459=function(_0x4d36a4,_0x303dd0){_0x4d36a4=_0x4d36a4-0x0;var _0x8d4548=_0x4590[_0x4d36a4];return _0x8d4548;};'use strict';var _=require(_0x0459('0x0'));var util=require(_0x0459('0x1'));var moment=require(_0x0459('0x2'));var BPromise=require(_0x0459('0x3'));var rs=require(_0x0459('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0459('0x5'))['db'];var utils=require(_0x0459('0x6'));var logger=require(_0x0459('0x7'))('rpc');var config=require(_0x0459('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0459('0x9')]['http']({'port':0x232a});config[_0x0459('0xa')]=_[_0x0459('0xb')](config[_0x0459('0xa')],{'host':_0x0459('0xc'),'port':0x18eb});var socket=require(_0x0459('0xd'))(new Redis(config[_0x0459('0xa')]));require('./chatInteraction.socket')[_0x0459('0xe')](socket);function respondWithRpcPromise(_0x39f3fa,_0x28dc30,_0x1eb4bb){return new BPromise(function(_0x44f20e,_0x197faf){return client[_0x0459('0xf')](_0x39f3fa,_0x1eb4bb)[_0x0459('0x10')](function(_0x3dc0cd){logger['info'](_0x0459('0x11'),_0x28dc30,'request\x20sent');logger[_0x0459('0x12')](_0x0459('0x13'),_0x28dc30,_0x0459('0x14'),JSON['stringify'](_0x3dc0cd));if(_0x3dc0cd['error']){if(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x16')]===0x1f4){logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);return _0x197faf(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);}logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);return _0x44f20e(_0x3dc0cd[_0x0459('0x15')][_0x0459('0x17')]);}else{logger[_0x0459('0x18')](_0x0459('0x11'),_0x28dc30,_0x0459('0x14'));_0x44f20e(_0x3dc0cd[_0x0459('0x19')]['message']);}})['catch'](function(_0x4a20f2){logger[_0x0459('0x15')](_0x0459('0x11'),_0x28dc30,_0x4a20f2);_0x197faf(_0x4a20f2);});});}exports['UpdateChatInteraction']=function(_0x24a7d2){var _0x18db53=this;return new Promise(function(_0x1cc1da,_0x217392){return db['ChatInteraction']['update'](_0x24a7d2[_0x0459('0x1a')],{'raw':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2[_0x0459('0x1b')][_0x0459('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24a7d2['options']?_0x24a7d2['options'][_0x0459('0x1d')]||null:null,'attributes':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2['options'][_0x0459('0x1e')]||null:null,'limit':_0x24a7d2[_0x0459('0x1b')]?_0x24a7d2[_0x0459('0x1b')][_0x0459('0x1f')]||null:null})['then'](function(_0x6d59f8){logger['info'](_0x0459('0x20'),_0x24a7d2);logger[_0x0459('0x12')](_0x0459('0x20'),_0x24a7d2,JSON[_0x0459('0x21')](_0x6d59f8));_0x1cc1da(_0x6d59f8);})[_0x0459('0x22')](function(_0x4aba61){logger['error'](_0x0459('0x20'),_0x4aba61['message'],_0x24a7d2);_0x217392(_0x18db53[_0x0459('0x15')](0x1f4,_0x4aba61[_0x0459('0x17')]));});});};exports[_0x0459('0x23')]=function(_0xc21bd5){return new Promise(function(_0x1ebf5c,_0x49e6e4){return db[_0x0459('0x24')]['find']({'where':_0xc21bd5[_0x0459('0x1b')]?_0xc21bd5[_0x0459('0x1b')][_0x0459('0x1d')]||null:null})[_0x0459('0x10')](function(_0x4843b4){if(_0x4843b4){return _0x4843b4[_0x0459('0x25')](_0xc21bd5['body'][_0x0459('0x26')],_[_0x0459('0x27')](_0xc21bd5[_0x0459('0x1a')],['ids','id'])||{});}})['spread'](function(_0x58690d){logger[_0x0459('0x18')](_0x0459('0x28'),_0xc21bd5);logger[_0x0459('0x12')](_0x0459('0x28'),_0xc21bd5,JSON[_0x0459('0x21')](_0x58690d));_0x1ebf5c(_0x58690d);})[_0x0459('0x22')](function(_0x52de7d){logger[_0x0459('0x15')](_0x0459('0x28'),_0x52de7d['message'],_0xc21bd5);_0x49e6e4(_this[_0x0459('0x15')](0x1f4,_0x52de7d['message']));});});};
\ No newline at end of file
+var _0x3f9f=['message','result','UpdateChatInteraction','update','body','options','raw','where','then','AddTagsToChatInteraction','ChatInteraction','omit','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5ec2b1,_0x45b985){var _0x5966a1=function(_0x4251a7){while(--_0x4251a7){_0x5ec2b1['push'](_0x5ec2b1['shift']());}};_0x5966a1(++_0x45b985);}(_0x3f9f,0xd3));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf3f9('0x0'));var util=require(_0xf3f9('0x1'));var moment=require(_0xf3f9('0x2'));var BPromise=require(_0xf3f9('0x3'));var rs=require(_0xf3f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf3f9('0x5'));var logger=require('../../config/logger')(_0xf3f9('0x6'));var config=require(_0xf3f9('0x7'));var jayson=require(_0xf3f9('0x8'));var client=jayson[_0xf3f9('0x9')][_0xf3f9('0xa')]({'port':0x232a});config[_0xf3f9('0xb')]=_[_0xf3f9('0xc')](config['redis'],{'host':_0xf3f9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3f9('0xb')]));require(_0xf3f9('0xe'))[_0xf3f9('0xf')](socket);function respondWithRpcPromise(_0x22542a,_0x20a8e0,_0x3db040){return new BPromise(function(_0x505a78,_0xc72294){return client['request'](_0x22542a,_0x3db040)['then'](function(_0x373f81){logger[_0xf3f9('0x10')](_0xf3f9('0x11'),_0x20a8e0,_0xf3f9('0x12'));logger[_0xf3f9('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x20a8e0,_0xf3f9('0x12'),JSON[_0xf3f9('0x14')](_0x373f81));if(_0x373f81['error']){if(_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x16')]===0x1f4){logger[_0xf3f9('0x15')](_0xf3f9('0x11'),_0x20a8e0,_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x17')]);return _0xc72294(_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x17')]);}logger['error'](_0xf3f9('0x11'),_0x20a8e0,_0x373f81[_0xf3f9('0x15')][_0xf3f9('0x17')]);return _0x505a78(_0x373f81[_0xf3f9('0x15')]['message']);}else{logger[_0xf3f9('0x10')](_0xf3f9('0x11'),_0x20a8e0,_0xf3f9('0x12'));_0x505a78(_0x373f81[_0xf3f9('0x18')][_0xf3f9('0x17')]);}})['catch'](function(_0x10273c){logger['error'](_0xf3f9('0x11'),_0x20a8e0,_0x10273c);_0xc72294(_0x10273c);});});}exports[_0xf3f9('0x19')]=function(_0x4a44ec){var _0x3ff0d9=this;return new Promise(function(_0x58aa55,_0x3157e3){return db['ChatInteraction'][_0xf3f9('0x1a')](_0x4a44ec[_0xf3f9('0x1b')],{'raw':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec['options'][_0xf3f9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec[_0xf3f9('0x1c')][_0xf3f9('0x1e')]||null:null,'attributes':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec['options']['attributes']||null:null,'limit':_0x4a44ec[_0xf3f9('0x1c')]?_0x4a44ec['options']['limit']||null:null})[_0xf3f9('0x1f')](function(_0x28da3a){logger['info'](_0xf3f9('0x19'),_0x4a44ec);logger[_0xf3f9('0x13')](_0xf3f9('0x19'),_0x4a44ec,JSON['stringify'](_0x28da3a));_0x58aa55(_0x28da3a);})['catch'](function(_0x56e6b8){logger['error'](_0xf3f9('0x19'),_0x56e6b8[_0xf3f9('0x17')],_0x4a44ec);_0x3157e3(_0x3ff0d9[_0xf3f9('0x15')](0x1f4,_0x56e6b8[_0xf3f9('0x17')]));});});};exports[_0xf3f9('0x20')]=function(_0x5f3bb5){return new Promise(function(_0x5f0638,_0x383e80){return db[_0xf3f9('0x21')]['find']({'where':_0x5f3bb5[_0xf3f9('0x1c')]?_0x5f3bb5['options'][_0xf3f9('0x1e')]||null:null})[_0xf3f9('0x1f')](function(_0x35557e){if(_0x35557e){return _0x35557e['addTags'](_0x5f3bb5[_0xf3f9('0x1b')]['ids'],_[_0xf3f9('0x22')](_0x5f3bb5[_0xf3f9('0x1b')],[_0xf3f9('0x23'),'id'])||{});}})[_0xf3f9('0x24')](function(_0x58c3e2){logger['info']('AddTags',_0x5f3bb5);logger[_0xf3f9('0x13')](_0xf3f9('0x25'),_0x5f3bb5,JSON['stringify'](_0x58c3e2));_0x5f0638(_0x58c3e2);})[_0xf3f9('0x26')](function(_0x17d548){logger[_0xf3f9('0x15')](_0xf3f9('0x25'),_0x17d548['message'],_0x5f3bb5);_0x383e80(_this[_0xf3f9('0x15')](0x1f4,_0x17d548['message']));});});};
\ No newline at end of file