Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / chatInteraction / chatInteraction.rpc.js
index bd07f4c..d5f1f96 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22f7=['ChatInteraction,\x20%s,\x20%s','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','AddTagsToChatInteraction','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3d0725,_0x3badb0){var _0x4237f0=function(_0x1e81b4){while(--_0x1e81b4){_0x3d0725['push'](_0x3d0725['shift']());}};_0x4237f0(++_0x3badb0);}(_0x22f7,0x11f));var _0x722f=function(_0x12a371,_0xae29d2){_0x12a371=_0x12a371-0x0;var _0x45af7b=_0x22f7[_0x12a371];return _0x45af7b;};'use strict';var _=require(_0x722f('0x0'));var util=require('util');var moment=require(_0x722f('0x1'));var BPromise=require(_0x722f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x722f('0x3'));var db=require(_0x722f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x722f('0x5'))(_0x722f('0x6'));var config=require(_0x722f('0x7'));var jayson=require(_0x722f('0x8'));var client=jayson[_0x722f('0x9')]['http']({'port':0x232a});config[_0x722f('0xa')]=_[_0x722f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x722f('0xc'))(new Redis(config['redis']));require(_0x722f('0xd'))[_0x722f('0xe')](socket);function respondWithRpcPromise(_0x4d31b2,_0xd75885,_0x14dfc5){return new BPromise(function(_0x1e75d5,_0x15706e){return client[_0x722f('0xf')](_0x4d31b2,_0x14dfc5)[_0x722f('0x10')](function(_0x2aa92b){logger[_0x722f('0x11')]('ChatInteraction,\x20%s,\x20%s',_0xd75885,_0x722f('0x12'));logger[_0x722f('0x13')](_0x722f('0x14'),_0xd75885,_0x722f('0x12'),JSON[_0x722f('0x15')](_0x2aa92b));if(_0x2aa92b[_0x722f('0x16')]){if(_0x2aa92b[_0x722f('0x16')][_0x722f('0x17')]===0x1f4){logger[_0x722f('0x16')]('ChatInteraction,\x20%s,\x20%s',_0xd75885,_0x2aa92b['error'][_0x722f('0x18')]);return _0x15706e(_0x2aa92b[_0x722f('0x16')]['message']);}logger[_0x722f('0x16')](_0x722f('0x19'),_0xd75885,_0x2aa92b[_0x722f('0x16')][_0x722f('0x18')]);return _0x1e75d5(_0x2aa92b[_0x722f('0x16')][_0x722f('0x18')]);}else{logger[_0x722f('0x11')](_0x722f('0x19'),_0xd75885,_0x722f('0x12'));_0x1e75d5(_0x2aa92b['result'][_0x722f('0x18')]);}})[_0x722f('0x1a')](function(_0x4c0a24){logger[_0x722f('0x16')](_0x722f('0x19'),_0xd75885,_0x4c0a24);_0x15706e(_0x4c0a24);});});}exports[_0x722f('0x1b')]=function(_0x4fb83d){var _0x42af77=this;return new Promise(function(_0x39756e,_0x140d87){return db[_0x722f('0x1c')][_0x722f('0x1d')](_0x4fb83d[_0x722f('0x1e')],{'raw':_0x4fb83d[_0x722f('0x1f')]?_0x4fb83d[_0x722f('0x1f')][_0x722f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fb83d[_0x722f('0x1f')]?_0x4fb83d['options'][_0x722f('0x21')]||null:null,'attributes':_0x4fb83d[_0x722f('0x1f')]?_0x4fb83d[_0x722f('0x1f')][_0x722f('0x22')]||null:null,'limit':_0x4fb83d[_0x722f('0x1f')]?_0x4fb83d['options']['limit']||null:null})[_0x722f('0x10')](function(_0x5eacdf){logger[_0x722f('0x11')](_0x722f('0x1b'),_0x4fb83d);logger['debug']('UpdateChatInteraction',_0x4fb83d,JSON[_0x722f('0x15')](_0x5eacdf));_0x39756e(_0x5eacdf);})[_0x722f('0x1a')](function(_0x47957b){logger[_0x722f('0x16')](_0x722f('0x1b'),_0x47957b['message'],_0x4fb83d);_0x140d87(_0x42af77['error'](0x1f4,_0x47957b['message']));});});};exports[_0x722f('0x23')]=function(_0x146d48){return new Promise(function(_0x4880b3,_0x1eaf75){return db[_0x722f('0x1c')]['find']({'where':_0x146d48['options']?_0x146d48[_0x722f('0x1f')]['where']||null:null})[_0x722f('0x10')](function(_0x1d33b3){if(_0x1d33b3){return _0x1d33b3['addTags'](_0x146d48[_0x722f('0x1e')][_0x722f('0x24')],_['omit'](_0x146d48[_0x722f('0x1e')],['ids','id'])||{});}})[_0x722f('0x25')](function(_0x5a18f9){logger['info'](_0x722f('0x26'),_0x146d48);logger[_0x722f('0x13')]('AddTags',_0x146d48,JSON[_0x722f('0x15')](_0x5a18f9));_0x4880b3(_0x5a18f9);})[_0x722f('0x1a')](function(_0x33dac0){logger['error']('AddTags',_0x33dac0[_0x722f('0x18')],_0x146d48);_0x1eaf75(_this[_0x722f('0x16')](0x1f4,_0x33dac0['message']));});});};
\ No newline at end of file
+var _0x2064=['../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','update','body','options','raw','where','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2064,0x6d));var _0x4206=function(_0x1e132a,_0x829341){_0x1e132a=_0x1e132a-0x0;var _0x16b110=_0x2064[_0x1e132a];return _0x16b110;};'use strict';var _=require(_0x4206('0x0'));var util=require(_0x4206('0x1'));var moment=require(_0x4206('0x2'));var BPromise=require('bluebird');var rs=require(_0x4206('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4206('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4206('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4206('0x6'));var client=jayson[_0x4206('0x7')][_0x4206('0x8')]({'port':0x232a});config[_0x4206('0x9')]=_['defaults'](config[_0x4206('0x9')],{'host':_0x4206('0xa'),'port':0x18eb});var socket=require(_0x4206('0xb'))(new Redis(config[_0x4206('0x9')]));require(_0x4206('0xc'))['register'](socket);function respondWithRpcPromise(_0x18176f,_0x28ed61,_0xf57942){return new BPromise(function(_0x29552d,_0x16ec7e){return client[_0x4206('0xd')](_0x18176f,_0xf57942)[_0x4206('0xe')](function(_0x2f3a3b){logger[_0x4206('0xf')](_0x4206('0x10'),_0x28ed61,_0x4206('0x11'));logger[_0x4206('0x12')](_0x4206('0x13'),_0x28ed61,'request\x20sent',JSON[_0x4206('0x14')](_0x2f3a3b));if(_0x2f3a3b[_0x4206('0x15')]){if(_0x2f3a3b[_0x4206('0x15')][_0x4206('0x16')]===0x1f4){logger[_0x4206('0x15')](_0x4206('0x10'),_0x28ed61,_0x2f3a3b['error'][_0x4206('0x17')]);return _0x16ec7e(_0x2f3a3b['error'][_0x4206('0x17')]);}logger[_0x4206('0x15')](_0x4206('0x10'),_0x28ed61,_0x2f3a3b[_0x4206('0x15')]['message']);return _0x29552d(_0x2f3a3b[_0x4206('0x15')][_0x4206('0x17')]);}else{logger['info'](_0x4206('0x10'),_0x28ed61,_0x4206('0x11'));_0x29552d(_0x2f3a3b['result']['message']);}})[_0x4206('0x18')](function(_0x51e342){logger[_0x4206('0x15')](_0x4206('0x10'),_0x28ed61,_0x51e342);_0x16ec7e(_0x51e342);});});}exports['UpdateChatInteraction']=function(_0x4618c8){var _0x3c3680=this;return new Promise(function(_0x58097c,_0x16ab30){return db['ChatInteraction'][_0x4206('0x19')](_0x4618c8[_0x4206('0x1a')],{'raw':_0x4618c8[_0x4206('0x1b')]?_0x4618c8[_0x4206('0x1b')][_0x4206('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4618c8[_0x4206('0x1b')]?_0x4618c8[_0x4206('0x1b')][_0x4206('0x1d')]||null:null,'attributes':_0x4618c8[_0x4206('0x1b')]?_0x4618c8['options']['attributes']||null:null,'limit':_0x4618c8[_0x4206('0x1b')]?_0x4618c8[_0x4206('0x1b')]['limit']||null:null})['then'](function(_0x3b9855){logger[_0x4206('0xf')](_0x4206('0x1e'),_0x4618c8);logger[_0x4206('0x12')](_0x4206('0x1e'),_0x4618c8,JSON[_0x4206('0x14')](_0x3b9855));_0x58097c(_0x3b9855);})[_0x4206('0x18')](function(_0x1bf54e){logger[_0x4206('0x15')](_0x4206('0x1e'),_0x1bf54e[_0x4206('0x17')],_0x4618c8);_0x16ab30(_0x3c3680[_0x4206('0x15')](0x1f4,_0x1bf54e['message']));});});};exports[_0x4206('0x1f')]=function(_0x27bacb){return new Promise(function(_0x1e8c74,_0x4af1f2){return db[_0x4206('0x20')][_0x4206('0x21')]({'where':_0x27bacb[_0x4206('0x1b')]?_0x27bacb[_0x4206('0x1b')][_0x4206('0x1d')]||null:null})['then'](function(_0x126482){if(_0x126482){return _0x126482[_0x4206('0x22')](_0x27bacb[_0x4206('0x1a')]['ids'],_[_0x4206('0x23')](_0x27bacb[_0x4206('0x1a')],['ids','id'])||{});}})[_0x4206('0x24')](function(_0x17e9ee){logger[_0x4206('0xf')](_0x4206('0x25'),_0x27bacb);logger['debug'](_0x4206('0x25'),_0x27bacb,JSON[_0x4206('0x14')](_0x17e9ee));_0x1e8c74(_0x17e9ee);})[_0x4206('0x18')](function(_0x434efc){logger[_0x4206('0x15')](_0x4206('0x25'),_0x434efc[_0x4206('0x17')],_0x27bacb);_0x4af1f2(_this['error'](0x1f4,_0x434efc[_0x4206('0x17')]));});});};
\ No newline at end of file