Built motion from commit c0cdc9d8.|2.6.28
[motion2.git] / server / api / chatInteraction / chatInteraction.rpc.js
index ff1aa22..333f42d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb765=['raw','where','then','stringify','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options'];(function(_0x4e04a8,_0x2f2d6a){var _0x6c3e6f=function(_0x806cf7){while(--_0x806cf7){_0x4e04a8['push'](_0x4e04a8['shift']());}};_0x6c3e6f(++_0x2f2d6a);}(_0xb765,0x1c1));var _0x5b76=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb765[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5b76('0x0'));var util=require(_0x5b76('0x1'));var moment=require(_0x5b76('0x2'));var BPromise=require(_0x5b76('0x3'));var rs=require(_0x5b76('0x4'));var fs=require('fs');var Redis=require(_0x5b76('0x5'));var db=require(_0x5b76('0x6'))['db'];var utils=require(_0x5b76('0x7'));var logger=require('../../config/logger')(_0x5b76('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b76('0x9'));var client=jayson['client'][_0x5b76('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5b76('0xb')],{'host':_0x5b76('0xc'),'port':0x18eb});var socket=require(_0x5b76('0xd'))(new Redis(config['redis']));require(_0x5b76('0xe'))['register'](socket);function respondWithRpcPromise(_0x284e7e,_0x26ab1b,_0xfc0fb9){return new BPromise(function(_0x1a2567,_0x3e1c09){return client[_0x5b76('0xf')](_0x284e7e,_0xfc0fb9)['then'](function(_0x470452){logger[_0x5b76('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x26ab1b,'request\x20sent');logger[_0x5b76('0x11')](_0x5b76('0x12'),_0x26ab1b,_0x5b76('0x13'),JSON['stringify'](_0x470452));if(_0x470452['error']){if(_0x470452[_0x5b76('0x14')][_0x5b76('0x15')]===0x1f4){logger[_0x5b76('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x26ab1b,_0x470452[_0x5b76('0x14')][_0x5b76('0x16')]);return _0x3e1c09(_0x470452[_0x5b76('0x14')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x26ab1b,_0x470452[_0x5b76('0x14')][_0x5b76('0x16')]);return _0x1a2567(_0x470452[_0x5b76('0x14')]['message']);}else{logger['info'](_0x5b76('0x17'),_0x26ab1b,_0x5b76('0x13'));_0x1a2567(_0x470452[_0x5b76('0x18')][_0x5b76('0x16')]);}})[_0x5b76('0x19')](function(_0x4b0e76){logger['error'](_0x5b76('0x17'),_0x26ab1b,_0x4b0e76);_0x3e1c09(_0x4b0e76);});});}exports[_0x5b76('0x1a')]=function(_0x43ed88){var _0x1bc0a1=this;return new Promise(function(_0x16bb4d,_0x579883){return db[_0x5b76('0x1b')][_0x5b76('0x1c')](_0x43ed88[_0x5b76('0x1d')],{'raw':_0x43ed88[_0x5b76('0x1e')]?_0x43ed88[_0x5b76('0x1e')][_0x5b76('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43ed88[_0x5b76('0x1e')]?_0x43ed88['options'][_0x5b76('0x20')]||null:null,'attributes':_0x43ed88[_0x5b76('0x1e')]?_0x43ed88[_0x5b76('0x1e')]['attributes']||null:null,'limit':_0x43ed88[_0x5b76('0x1e')]?_0x43ed88[_0x5b76('0x1e')]['limit']||null:null})[_0x5b76('0x21')](function(_0xab747c){logger[_0x5b76('0x10')](_0x5b76('0x1a'),_0x43ed88);logger[_0x5b76('0x11')](_0x5b76('0x1a'),_0x43ed88,JSON[_0x5b76('0x22')](_0xab747c));_0x16bb4d(_0xab747c);})[_0x5b76('0x19')](function(_0x48ed3c){logger[_0x5b76('0x14')](_0x5b76('0x1a'),_0x48ed3c[_0x5b76('0x16')],_0x43ed88);_0x579883(_0x1bc0a1[_0x5b76('0x14')](0x1f4,_0x48ed3c['message']));});});};exports['AddTagsToChatInteraction']=function(_0x43ea44){return new Promise(function(_0x508eaa,_0x54f536){return db[_0x5b76('0x1b')]['find']({'where':_0x43ea44[_0x5b76('0x1e')]?_0x43ea44[_0x5b76('0x1e')][_0x5b76('0x20')]||null:null})[_0x5b76('0x21')](function(_0x3014c8){if(_0x3014c8){return _0x3014c8[_0x5b76('0x23')](_0x43ea44[_0x5b76('0x1d')]['ids'],_[_0x5b76('0x24')](_0x43ea44[_0x5b76('0x1d')],[_0x5b76('0x25'),'id'])||{});}})[_0x5b76('0x26')](function(_0x17084a){logger['info']('AddTags',_0x43ea44);logger[_0x5b76('0x11')](_0x5b76('0x27'),_0x43ea44,JSON[_0x5b76('0x22')](_0x17084a));_0x508eaa(_0x17084a);})['catch'](function(_0x1e3777){logger[_0x5b76('0x14')](_0x5b76('0x27'),_0x1e3777['message'],_0x43ea44);_0x54f536(_this['error'](0x1f4,_0x1e3777[_0x5b76('0x16')]));});});};
\ No newline at end of file
+var _0x28df=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','body','options','raw','where','attributes','UpdateChatInteraction','AddTagsToChatInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x28df,0x1e6));var _0xf28d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x28df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf28d('0x0'));var util=require(_0xf28d('0x1'));var moment=require(_0xf28d('0x2'));var BPromise=require(_0xf28d('0x3'));var rs=require(_0xf28d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf28d('0x5'));var logger=require(_0xf28d('0x6'))(_0xf28d('0x7'));var config=require(_0xf28d('0x8'));var jayson=require(_0xf28d('0x9'));var client=jayson[_0xf28d('0xa')][_0xf28d('0xb')]({'port':0x232a});config[_0xf28d('0xc')]=_[_0xf28d('0xd')](config[_0xf28d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf28d('0xe'))(new Redis(config[_0xf28d('0xc')]));require(_0xf28d('0xf'))['register'](socket);function respondWithRpcPromise(_0x56f63a,_0x568d81,_0x3fc874){return new BPromise(function(_0x2e3fc9,_0x3a0bf4){return client['request'](_0x56f63a,_0x3fc874)[_0xf28d('0x10')](function(_0x4e83f6){logger[_0xf28d('0x11')](_0xf28d('0x12'),_0x568d81,_0xf28d('0x13'));logger[_0xf28d('0x14')](_0xf28d('0x15'),_0x568d81,_0xf28d('0x13'),JSON[_0xf28d('0x16')](_0x4e83f6));if(_0x4e83f6[_0xf28d('0x17')]){if(_0x4e83f6[_0xf28d('0x17')][_0xf28d('0x18')]===0x1f4){logger[_0xf28d('0x17')](_0xf28d('0x12'),_0x568d81,_0x4e83f6['error'][_0xf28d('0x19')]);return _0x3a0bf4(_0x4e83f6['error'][_0xf28d('0x19')]);}logger[_0xf28d('0x17')](_0xf28d('0x12'),_0x568d81,_0x4e83f6[_0xf28d('0x17')][_0xf28d('0x19')]);return _0x2e3fc9(_0x4e83f6[_0xf28d('0x17')][_0xf28d('0x19')]);}else{logger[_0xf28d('0x11')](_0xf28d('0x12'),_0x568d81,'request\x20sent');_0x2e3fc9(_0x4e83f6[_0xf28d('0x1a')][_0xf28d('0x19')]);}})[_0xf28d('0x1b')](function(_0x4ce1af){logger[_0xf28d('0x17')](_0xf28d('0x12'),_0x568d81,_0x4ce1af);_0x3a0bf4(_0x4ce1af);});});}exports['UpdateChatInteraction']=function(_0x59c552){var _0x5e3279=this;return new Promise(function(_0x290c04,_0x124c2b){return db[_0xf28d('0x1c')]['update'](_0x59c552[_0xf28d('0x1d')],{'raw':_0x59c552['options']?_0x59c552[_0xf28d('0x1e')][_0xf28d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59c552[_0xf28d('0x1e')]?_0x59c552[_0xf28d('0x1e')][_0xf28d('0x20')]||null:null,'attributes':_0x59c552[_0xf28d('0x1e')]?_0x59c552[_0xf28d('0x1e')][_0xf28d('0x21')]||null:null,'limit':_0x59c552[_0xf28d('0x1e')]?_0x59c552[_0xf28d('0x1e')]['limit']||null:null})['then'](function(_0xd21ff3){logger['info']('UpdateChatInteraction',_0x59c552);logger[_0xf28d('0x14')](_0xf28d('0x22'),_0x59c552,JSON[_0xf28d('0x16')](_0xd21ff3));_0x290c04(_0xd21ff3);})['catch'](function(_0xb65cea){logger['error']('UpdateChatInteraction',_0xb65cea[_0xf28d('0x19')],_0x59c552);_0x124c2b(_0x5e3279['error'](0x1f4,_0xb65cea[_0xf28d('0x19')]));});});};exports[_0xf28d('0x23')]=function(_0xa7e155){return new Promise(function(_0xeeea7d,_0x188f79){return db['ChatInteraction'][_0xf28d('0x24')]({'where':_0xa7e155[_0xf28d('0x1e')]?_0xa7e155[_0xf28d('0x1e')]['where']||null:null})[_0xf28d('0x10')](function(_0x24dea5){if(_0x24dea5){return _0x24dea5['addTags'](_0xa7e155[_0xf28d('0x1d')][_0xf28d('0x25')],_[_0xf28d('0x26')](_0xa7e155[_0xf28d('0x1d')],[_0xf28d('0x25'),'id'])||{});}})[_0xf28d('0x27')](function(_0x464fa4){logger[_0xf28d('0x11')]('AddTags',_0xa7e155);logger['debug'](_0xf28d('0x28'),_0xa7e155,JSON[_0xf28d('0x16')](_0x464fa4));_0xeeea7d(_0x464fa4);})[_0xf28d('0x1b')](function(_0x1aeab4){logger[_0xf28d('0x17')]('AddTags',_0x1aeab4[_0xf28d('0x19')],_0xa7e155);_0x188f79(_this[_0xf28d('0x17')](0x1f4,_0x1aeab4['message']));});});};
\ No newline at end of file