Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / campaign / campaign.rpc.js
index b73c04c..4591c25 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d9e=['where','attributes','limit','include','model','map','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','findAll','options'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x540b50,_0x2e201b){_0x540b50=_0x540b50-0x0;var _0x5c9243=_0x4d9e[_0x540b50];return _0x5c9243;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('Campaign,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('Campaign,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});}exports[_0xe4d9('0x14')]=function(_0x112315){var _0x5ab3d1=this;return new Promise(function(_0x2e1490,_0x4f8dba){return db[_0xe4d9('0x15')][_0xe4d9('0x16')]({'raw':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x18')]||null:null,'attributes':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x19')]||null:null,'limit':_0x112315[_0xe4d9('0x17')]?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x1a')]||null:null,'include':_0x112315['options']?_0x112315[_0xe4d9('0x17')][_0xe4d9('0x1b')]?_['map'](_0x112315[_0xe4d9('0x17')]['include'],function(_0x14f3d7){return{'model':db[_0x14f3d7[_0xe4d9('0x1c')]],'as':_0x14f3d7['as'],'attributes':_0x14f3d7['attributes'],'include':_0x14f3d7[_0xe4d9('0x1b')]?_[_0xe4d9('0x1d')](_0x14f3d7['include'],function(_0xc5be1b){return{'model':db[_0xc5be1b[_0xe4d9('0x1c')]],'as':_0xc5be1b['as'],'attributes':_0xc5be1b[_0xe4d9('0x19')],'include':_0xc5be1b['include']?_['map'](_0xc5be1b[_0xe4d9('0x1b')],function(_0x2846e2){return{'model':db[_0x2846e2['model']],'as':_0x2846e2['as'],'attributes':_0x2846e2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x529e2b){logger[_0xe4d9('0xb')]('GetCampaign',_0x112315);logger[_0xe4d9('0xd')](_0xe4d9('0x14'),_0x112315,JSON[_0xe4d9('0xf')](_0x529e2b));_0x2e1490(_0x529e2b);})['catch'](function(_0xec8d64){logger[_0xe4d9('0x10')](_0xe4d9('0x14'),_0xec8d64[_0xe4d9('0x12')],_0x112315);_0x4f8dba(_0x5ab3d1[_0xe4d9('0x10')](0x1f4,_0xec8d64[_0xe4d9('0x12')]));});});};
\ No newline at end of file
+var _0xaf5a=['include','map','model','GetCampaign','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','Campaign','options','raw','where','attributes','limit'];(function(_0x4aa9aa,_0xc47ab4){var _0x1ef7b7=function(_0x3ddfca){while(--_0x3ddfca){_0x4aa9aa['push'](_0x4aa9aa['shift']());}};_0x1ef7b7(++_0xc47ab4);}(_0xaf5a,0x144));var _0xaaf5=function(_0x493503,_0x351993){_0x493503=_0x493503-0x0;var _0x1986d0=_0xaf5a[_0x493503];return _0x1986d0;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var moment=require('moment');var BPromise=require(_0xaaf5('0x1'));var rs=require(_0xaaf5('0x2'));var fs=require('fs');var Redis=require(_0xaaf5('0x3'));var db=require(_0xaaf5('0x4'))['db'];var utils=require(_0xaaf5('0x5'));var logger=require(_0xaaf5('0x6'))(_0xaaf5('0x7'));var config=require(_0xaaf5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaaf5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39dfd9,_0x34e141,_0x1160d2){return new BPromise(function(_0x2eee5e,_0x3582a5){return client['request'](_0x39dfd9,_0x1160d2)[_0xaaf5('0xa')](function(_0x32c5e6){logger[_0xaaf5('0xb')]('Campaign,\x20%s,\x20%s',_0x34e141,_0xaaf5('0xc'));logger[_0xaaf5('0xd')](_0xaaf5('0xe'),_0x34e141,_0xaaf5('0xc'),JSON[_0xaaf5('0xf')](_0x32c5e6));if(_0x32c5e6[_0xaaf5('0x10')]){if(_0x32c5e6[_0xaaf5('0x10')][_0xaaf5('0x11')]===0x1f4){logger[_0xaaf5('0x10')](_0xaaf5('0x12'),_0x34e141,_0x32c5e6['error'][_0xaaf5('0x13')]);return _0x3582a5(_0x32c5e6[_0xaaf5('0x10')][_0xaaf5('0x13')]);}logger[_0xaaf5('0x10')](_0xaaf5('0x12'),_0x34e141,_0x32c5e6[_0xaaf5('0x10')][_0xaaf5('0x13')]);return _0x2eee5e(_0x32c5e6[_0xaaf5('0x10')]['message']);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x34e141,_0xaaf5('0xc'));_0x2eee5e(_0x32c5e6[_0xaaf5('0x14')]['message']);}})[_0xaaf5('0x15')](function(_0x431f5e){logger[_0xaaf5('0x10')]('Campaign,\x20%s,\x20%s',_0x34e141,_0x431f5e);_0x3582a5(_0x431f5e);});});}exports['GetCampaign']=function(_0x236371){var _0x29d42a=this;return new Promise(function(_0x2f7bdc,_0x37b34a){return db[_0xaaf5('0x16')]['findAll']({'raw':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x18')]===undefined?!![]:![]:!![],'where':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x19')]||null:null,'attributes':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1a')]||null:null,'limit':_0x236371['options']?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1b')]||null:null,'include':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1c')]?_[_0xaaf5('0x1d')](_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1c')],function(_0x577761){return{'model':db[_0x577761[_0xaaf5('0x1e')]],'as':_0x577761['as'],'attributes':_0x577761[_0xaaf5('0x1a')],'include':_0x577761[_0xaaf5('0x1c')]?_[_0xaaf5('0x1d')](_0x577761[_0xaaf5('0x1c')],function(_0x46dacd){return{'model':db[_0x46dacd[_0xaaf5('0x1e')]],'as':_0x46dacd['as'],'attributes':_0x46dacd[_0xaaf5('0x1a')],'include':_0x46dacd[_0xaaf5('0x1c')]?_[_0xaaf5('0x1d')](_0x46dacd['include'],function(_0x8b417e){return{'model':db[_0x8b417e[_0xaaf5('0x1e')]],'as':_0x8b417e['as'],'attributes':_0x8b417e[_0xaaf5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaaf5('0xa')](function(_0x6915e6){logger[_0xaaf5('0xb')](_0xaaf5('0x1f'),_0x236371);logger['debug'](_0xaaf5('0x1f'),_0x236371,JSON[_0xaaf5('0xf')](_0x6915e6));_0x2f7bdc(_0x6915e6);})[_0xaaf5('0x15')](function(_0x49c7f2){logger['error'](_0xaaf5('0x1f'),_0x49c7f2['message'],_0x236371);_0x37b34a(_0x29d42a[_0xaaf5('0x10')](0x1f4,_0x49c7f2['message']));});});};
\ No newline at end of file