Built motion from commit (unavailable).|2.4.3
[motion2.git] / server / api / chatInteraction / chatInteraction.rpc.js
index b58e10d..a23b6b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x670b=['lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToChatInteraction','omit','spread','AddTags'];(function(_0x557709,_0x306adf){var _0xd8c6c9=function(_0x291cbe){while(--_0x291cbe){_0x557709['push'](_0x557709['shift']());}};_0xd8c6c9(++_0x306adf);}(_0x670b,0x111));var _0xb670=function(_0x108484,_0x45b224){_0x108484=_0x108484-0x0;var _0x2c77a3=_0x670b[_0x108484];return _0x2c77a3;};'use strict';var _=require(_0xb670('0x0'));var util=require(_0xb670('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb670('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb670('0x3'))['db'];var utils=require(_0xb670('0x4'));var logger=require(_0xb670('0x5'))('rpc');var config=require(_0xb670('0x6'));var jayson=require(_0xb670('0x7'));var client=jayson[_0xb670('0x8')]['http']({'port':0x232a});config['redis']=_[_0xb670('0x9')](config[_0xb670('0xa')],{'host':_0xb670('0xb'),'port':0x18eb});var socket=require(_0xb670('0xc'))(new Redis(config['redis']));require(_0xb670('0xd'))[_0xb670('0xe')](socket);function respondWithRpcPromise(_0x156510,_0x28ed2d,_0x3d7475){return new BPromise(function(_0x465186,_0x33e121){return client[_0xb670('0xf')](_0x156510,_0x3d7475)[_0xb670('0x10')](function(_0x128dad){logger['info'](_0xb670('0x11'),_0x28ed2d,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x28ed2d,_0xb670('0x12'),JSON[_0xb670('0x13')](_0x128dad));if(_0x128dad[_0xb670('0x14')]){if(_0x128dad[_0xb670('0x14')][_0xb670('0x15')]===0x1f4){logger[_0xb670('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x28ed2d,_0x128dad[_0xb670('0x14')]['message']);return _0x33e121(_0x128dad[_0xb670('0x14')][_0xb670('0x16')]);}logger[_0xb670('0x14')](_0xb670('0x11'),_0x28ed2d,_0x128dad[_0xb670('0x14')][_0xb670('0x16')]);return _0x465186(_0x128dad['error'][_0xb670('0x16')]);}else{logger[_0xb670('0x17')](_0xb670('0x11'),_0x28ed2d,'request\x20sent');_0x465186(_0x128dad[_0xb670('0x18')][_0xb670('0x16')]);}})[_0xb670('0x19')](function(_0x324eb0){logger[_0xb670('0x14')](_0xb670('0x11'),_0x28ed2d,_0x324eb0);_0x33e121(_0x324eb0);});});}exports[_0xb670('0x1a')]=function(_0x3ef4b3){var _0x73fa20=this;return new Promise(function(_0x56ed59,_0xfe431d){return db[_0xb670('0x1b')]['update'](_0x3ef4b3[_0xb670('0x1c')],{'raw':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3[_0xb670('0x1d')][_0xb670('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3[_0xb670('0x1d')][_0xb670('0x1f')]||null:null,'attributes':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3['options'][_0xb670('0x20')]||null:null,'limit':_0x3ef4b3[_0xb670('0x1d')]?_0x3ef4b3[_0xb670('0x1d')][_0xb670('0x21')]||null:null})['then'](function(_0x4e60a3){logger['info']('UpdateChatInteraction',_0x3ef4b3);logger[_0xb670('0x22')](_0xb670('0x1a'),_0x3ef4b3,JSON['stringify'](_0x4e60a3));_0x56ed59(_0x4e60a3);})[_0xb670('0x19')](function(_0x7277f4){logger[_0xb670('0x14')]('UpdateChatInteraction',_0x7277f4[_0xb670('0x16')],_0x3ef4b3);_0xfe431d(_0x73fa20[_0xb670('0x14')](0x1f4,_0x7277f4[_0xb670('0x16')]));});});};exports[_0xb670('0x23')]=function(_0x2f92ab){return new Promise(function(_0x4f49f9,_0x51c17c){return db['ChatInteraction']['find']({'where':_0x2f92ab[_0xb670('0x1d')]?_0x2f92ab[_0xb670('0x1d')][_0xb670('0x1f')]||null:null})[_0xb670('0x10')](function(_0x2b0a35){if(_0x2b0a35){return _0x2b0a35['addTags'](_0x2f92ab[_0xb670('0x1c')]['ids'],_[_0xb670('0x24')](_0x2f92ab['body'],['ids','id'])||{});}})[_0xb670('0x25')](function(_0x5f423d){logger[_0xb670('0x17')](_0xb670('0x26'),_0x2f92ab);logger[_0xb670('0x22')]('AddTags',_0x2f92ab,JSON['stringify'](_0x5f423d));_0x4f49f9(_0x5f423d);})[_0xb670('0x19')](function(_0x452370){logger[_0xb670('0x14')]('AddTags',_0x452370[_0xb670('0x16')],_0x2f92ab);_0x51c17c(_this[_0xb670('0x14')](0x1f4,_0x452370[_0xb670('0x16')]));});});};
\ No newline at end of file
+var _0x73f0=['stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','ChatInteraction','update','options','where','attributes','limit','UpdateChatInteraction','debug','find','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./chatInteraction.socket','register','request','then','request\x20sent'];(function(_0x377c26,_0xb31a5a){var _0x581944=function(_0x209e61){while(--_0x209e61){_0x377c26['push'](_0x377c26['shift']());}};_0x581944(++_0xb31a5a);}(_0x73f0,0xe3));var _0x073f=function(_0x3d889c,_0x38b195){_0x3d889c=_0x3d889c-0x0;var _0x3e9559=_0x73f0[_0x3d889c];return _0x3e9559;};'use strict';var _=require(_0x073f('0x0'));var util=require('util');var moment=require(_0x073f('0x1'));var BPromise=require(_0x073f('0x2'));var rs=require(_0x073f('0x3'));var fs=require('fs');var Redis=require(_0x073f('0x4'));var db=require(_0x073f('0x5'))['db'];var utils=require(_0x073f('0x6'));var logger=require(_0x073f('0x7'))(_0x073f('0x8'));var config=require(_0x073f('0x9'));var jayson=require(_0x073f('0xa'));var client=jayson['client'][_0x073f('0xb')]({'port':0x232a});config[_0x073f('0xc')]=_[_0x073f('0xd')](config[_0x073f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x073f('0xc')]));require(_0x073f('0xe'))[_0x073f('0xf')](socket);function respondWithRpcPromise(_0x425b1f,_0x42dbad,_0x57e509){return new BPromise(function(_0x4a2476,_0x232d64){return client[_0x073f('0x10')](_0x425b1f,_0x57e509)[_0x073f('0x11')](function(_0xb1e813){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x42dbad,_0x073f('0x12'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x42dbad,_0x073f('0x12'),JSON[_0x073f('0x13')](_0xb1e813));if(_0xb1e813[_0x073f('0x14')]){if(_0xb1e813[_0x073f('0x14')][_0x073f('0x15')]===0x1f4){logger[_0x073f('0x14')](_0x073f('0x16'),_0x42dbad,_0xb1e813[_0x073f('0x14')][_0x073f('0x17')]);return _0x232d64(_0xb1e813[_0x073f('0x14')]['message']);}logger[_0x073f('0x14')](_0x073f('0x16'),_0x42dbad,_0xb1e813[_0x073f('0x14')][_0x073f('0x17')]);return _0x4a2476(_0xb1e813[_0x073f('0x14')][_0x073f('0x17')]);}else{logger[_0x073f('0x18')](_0x073f('0x16'),_0x42dbad,_0x073f('0x12'));_0x4a2476(_0xb1e813[_0x073f('0x19')]['message']);}})[_0x073f('0x1a')](function(_0xee598e){logger[_0x073f('0x14')](_0x073f('0x16'),_0x42dbad,_0xee598e);_0x232d64(_0xee598e);});});}exports['UpdateChatInteraction']=function(_0x4554a5){var _0x7d1315=this;return new Promise(function(_0x4ad96c,_0x44b85b){return db[_0x073f('0x1b')][_0x073f('0x1c')](_0x4554a5['body'],{'raw':_0x4554a5[_0x073f('0x1d')]?_0x4554a5[_0x073f('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4554a5['options']?_0x4554a5[_0x073f('0x1d')][_0x073f('0x1e')]||null:null,'attributes':_0x4554a5['options']?_0x4554a5[_0x073f('0x1d')][_0x073f('0x1f')]||null:null,'limit':_0x4554a5[_0x073f('0x1d')]?_0x4554a5[_0x073f('0x1d')][_0x073f('0x20')]||null:null})['then'](function(_0x5b4b81){logger['info'](_0x073f('0x21'),_0x4554a5);logger[_0x073f('0x22')](_0x073f('0x21'),_0x4554a5,JSON[_0x073f('0x13')](_0x5b4b81));_0x4ad96c(_0x5b4b81);})[_0x073f('0x1a')](function(_0x1fae3c){logger['error'](_0x073f('0x21'),_0x1fae3c[_0x073f('0x17')],_0x4554a5);_0x44b85b(_0x7d1315[_0x073f('0x14')](0x1f4,_0x1fae3c[_0x073f('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x36e070){return new Promise(function(_0x15075b,_0x5ab146){return db[_0x073f('0x1b')][_0x073f('0x23')]({'where':_0x36e070['options']?_0x36e070[_0x073f('0x1d')]['where']||null:null})['then'](function(_0x2189ae){if(_0x2189ae){return _0x2189ae['addTags'](_0x36e070[_0x073f('0x24')][_0x073f('0x25')],_[_0x073f('0x26')](_0x36e070[_0x073f('0x24')],[_0x073f('0x25'),'id'])||{});}})[_0x073f('0x27')](function(_0x41722d){logger[_0x073f('0x18')](_0x073f('0x28'),_0x36e070);logger[_0x073f('0x22')](_0x073f('0x28'),_0x36e070,JSON['stringify'](_0x41722d));_0x15075b(_0x41722d);})[_0x073f('0x1a')](function(_0x80e39f){logger['error']('AddTags',_0x80e39f[_0x073f('0x17')],_0x36e070);_0x5ab146(_this['error'](0x1f4,_0x80e39f[_0x073f('0x17')]));});});};
\ No newline at end of file