Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / api / campaign / campaign.rpc.js
index 20de104..9a38232 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7daf=['limit','map','include','model','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetCampaign','Campaign','findAll','options','raw','where','attributes'];(function(_0x46bfab,_0x29834f){var _0x298002=function(_0x3c2f10){while(--_0x3c2f10){_0x46bfab['push'](_0x46bfab['shift']());}};_0x298002(++_0x29834f);}(_0x7daf,0xaa));var _0xf7da=function(_0x4aab29,_0xe600b8){_0x4aab29=_0x4aab29-0x0;var _0x521231=_0x7daf[_0x4aab29];return _0x521231;};'use strict';var _=require('lodash');var util=require(_0xf7da('0x0'));var moment=require('moment');var BPromise=require(_0xf7da('0x1'));var rs=require(_0xf7da('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7da('0x3'))['db'];var utils=require(_0xf7da('0x4'));var logger=require(_0xf7da('0x5'))(_0xf7da('0x6'));var config=require(_0xf7da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf7da('0x8')][_0xf7da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b35ec,_0x110cad,_0x2c70ad){return new BPromise(function(_0x468ca3,_0x53d71f){return client[_0xf7da('0xa')](_0x1b35ec,_0x2c70ad)[_0xf7da('0xb')](function(_0x326ff5){logger[_0xf7da('0xc')](_0xf7da('0xd'),_0x110cad,_0xf7da('0xe'));logger[_0xf7da('0xf')](_0xf7da('0x10'),_0x110cad,_0xf7da('0xe'),JSON[_0xf7da('0x11')](_0x326ff5));if(_0x326ff5['error']){if(_0x326ff5['error'][_0xf7da('0x12')]===0x1f4){logger[_0xf7da('0x13')](_0xf7da('0xd'),_0x110cad,_0x326ff5[_0xf7da('0x13')][_0xf7da('0x14')]);return _0x53d71f(_0x326ff5[_0xf7da('0x13')]['message']);}logger[_0xf7da('0x13')](_0xf7da('0xd'),_0x110cad,_0x326ff5['error'][_0xf7da('0x14')]);return _0x468ca3(_0x326ff5[_0xf7da('0x13')][_0xf7da('0x14')]);}else{logger[_0xf7da('0xc')](_0xf7da('0xd'),_0x110cad,_0xf7da('0xe'));_0x468ca3(_0x326ff5['result']['message']);}})['catch'](function(_0x39d9c0){logger[_0xf7da('0x13')](_0xf7da('0xd'),_0x110cad,_0x39d9c0);_0x53d71f(_0x39d9c0);});});}exports[_0xf7da('0x15')]=function(_0x336fca){var _0x1f3d53=this;return new Promise(function(_0xb75a2c,_0x13cd4a){return db[_0xf7da('0x16')][_0xf7da('0x17')]({'raw':_0x336fca[_0xf7da('0x18')]?_0x336fca[_0xf7da('0x18')][_0xf7da('0x19')]===undefined?!![]:![]:!![],'where':_0x336fca[_0xf7da('0x18')]?_0x336fca['options'][_0xf7da('0x1a')]||null:null,'attributes':_0x336fca[_0xf7da('0x18')]?_0x336fca[_0xf7da('0x18')][_0xf7da('0x1b')]||null:null,'limit':_0x336fca[_0xf7da('0x18')]?_0x336fca[_0xf7da('0x18')][_0xf7da('0x1c')]||null:null,'include':_0x336fca[_0xf7da('0x18')]?_0x336fca[_0xf7da('0x18')]['include']?_[_0xf7da('0x1d')](_0x336fca[_0xf7da('0x18')][_0xf7da('0x1e')],function(_0x4b627e){return{'model':db[_0x4b627e[_0xf7da('0x1f')]],'as':_0x4b627e['as'],'attributes':_0x4b627e[_0xf7da('0x1b')],'include':_0x4b627e[_0xf7da('0x1e')]?_[_0xf7da('0x1d')](_0x4b627e[_0xf7da('0x1e')],function(_0x9d2da){return{'model':db[_0x9d2da['model']],'as':_0x9d2da['as'],'attributes':_0x9d2da[_0xf7da('0x1b')],'include':_0x9d2da[_0xf7da('0x1e')]?_[_0xf7da('0x1d')](_0x9d2da['include'],function(_0x13ace4){return{'model':db[_0x13ace4[_0xf7da('0x1f')]],'as':_0x13ace4['as'],'attributes':_0x13ace4[_0xf7da('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf7da('0xb')](function(_0x13dc9f){logger['info'](_0xf7da('0x15'),_0x336fca);logger['debug'](_0xf7da('0x15'),_0x336fca,JSON[_0xf7da('0x11')](_0x13dc9f));_0xb75a2c(_0x13dc9f);})[_0xf7da('0x20')](function(_0x23a27e){logger['error'](_0xf7da('0x15'),_0x23a27e[_0xf7da('0x14')],_0x336fca);_0x13cd4a(_0x1f3d53[_0xf7da('0x13')](0x1f4,_0x23a27e[_0xf7da('0x14')]));});});};
\ No newline at end of file
+var _0xe0b2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Campaign','options','raw','where','attributes','limit','include','map','model','GetCampaign','util','moment'];(function(_0x51a6af,_0x219d20){var _0x190e2c=function(_0x1f391b){while(--_0x1f391b){_0x51a6af['push'](_0x51a6af['shift']());}};_0x190e2c(++_0x219d20);}(_0xe0b2,0xec));var _0x2e0b=function(_0x9b7953,_0x27678e){_0x9b7953=_0x9b7953-0x0;var _0x32df61=_0xe0b2[_0x9b7953];return _0x32df61;};'use strict';var _=require('lodash');var util=require(_0x2e0b('0x0'));var moment=require(_0x2e0b('0x1'));var BPromise=require(_0x2e0b('0x2'));var rs=require(_0x2e0b('0x3'));var fs=require('fs');var Redis=require(_0x2e0b('0x4'));var db=require(_0x2e0b('0x5'))['db'];var utils=require(_0x2e0b('0x6'));var logger=require('../../config/logger')(_0x2e0b('0x7'));var config=require(_0x2e0b('0x8'));var jayson=require(_0x2e0b('0x9'));var client=jayson[_0x2e0b('0xa')][_0x2e0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264319,_0x4b62b7,_0x2e1e40){return new BPromise(function(_0x504ea6,_0x1afd43){return client[_0x2e0b('0xc')](_0x264319,_0x2e1e40)[_0x2e0b('0xd')](function(_0x3078eb){logger[_0x2e0b('0xe')](_0x2e0b('0xf'),_0x4b62b7,_0x2e0b('0x10'));logger[_0x2e0b('0x11')](_0x2e0b('0x12'),_0x4b62b7,'request\x20sent',JSON[_0x2e0b('0x13')](_0x3078eb));if(_0x3078eb[_0x2e0b('0x14')]){if(_0x3078eb['error']['code']===0x1f4){logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x1afd43(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x504ea6(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x4b62b7,'request\x20sent');_0x504ea6(_0x3078eb[_0x2e0b('0x16')]['message']);}})[_0x2e0b('0x17')](function(_0x426879){logger['error']('Campaign,\x20%s,\x20%s',_0x4b62b7,_0x426879);_0x1afd43(_0x426879);});});}exports['GetCampaign']=function(_0x1d6bf2){var _0x477af9=this;return new Promise(function(_0x1c86a6,_0xfa98b1){return db[_0x2e0b('0x18')]['findAll']({'raw':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2['options'][_0x2e0b('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2['options'][_0x2e0b('0x1b')]||null:null,'attributes':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2[_0x2e0b('0x19')][_0x2e0b('0x1c')]||null:null,'limit':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2['options'][_0x2e0b('0x1d')]||null:null,'include':_0x1d6bf2['options']?_0x1d6bf2['options'][_0x2e0b('0x1e')]?_[_0x2e0b('0x1f')](_0x1d6bf2[_0x2e0b('0x19')]['include'],function(_0x40e3e5){return{'model':db[_0x40e3e5[_0x2e0b('0x20')]],'as':_0x40e3e5['as'],'attributes':_0x40e3e5[_0x2e0b('0x1c')],'include':_0x40e3e5[_0x2e0b('0x1e')]?_[_0x2e0b('0x1f')](_0x40e3e5[_0x2e0b('0x1e')],function(_0x3109f4){return{'model':db[_0x3109f4[_0x2e0b('0x20')]],'as':_0x3109f4['as'],'attributes':_0x3109f4['attributes'],'include':_0x3109f4['include']?_['map'](_0x3109f4[_0x2e0b('0x1e')],function(_0x100770){return{'model':db[_0x100770[_0x2e0b('0x20')]],'as':_0x100770['as'],'attributes':_0x100770[_0x2e0b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2e0b('0xd')](function(_0x1260ab){logger[_0x2e0b('0xe')]('GetCampaign',_0x1d6bf2);logger[_0x2e0b('0x11')](_0x2e0b('0x21'),_0x1d6bf2,JSON[_0x2e0b('0x13')](_0x1260ab));_0x1c86a6(_0x1260ab);})[_0x2e0b('0x17')](function(_0x5e19c6){logger[_0x2e0b('0x14')]('GetCampaign',_0x5e19c6['message'],_0x1d6bf2);_0xfa98b1(_0x477af9[_0x2e0b('0x14')](0x1f4,_0x5e19c6[_0x2e0b('0x15')]));});});};
\ No newline at end of file