e3099febe3040ad883f727af6161eb713156a7b3
[motion.git] / server / api / chat_website / chat_website.controller.js
1 var _0x390c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x6D\x75\x73\x74\x61\x63\x68\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x55\x73\x65\x72","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x73\x46\x69\x65\x6C\x64","\x73\x6E\x69\x70\x70\x65\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x78\x63\x68\x61\x74\x74\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x6C\x6F\x67","\x6C\x65\x6E\x67\x74\x68","\x6E\x61\x6D\x65","\x6D\x65\x72\x67\x65","\x67\x65\x74\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x67\x65\x74\x53\x6E\x69\x70\x70\x65\x74\x43\x6F\x64\x65","\x72\x65\x6D\x6F\x74\x65","\x72\x65\x6E\x64\x65\x72","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x70\x72\x69\x6F\x72\x69\x74\x79","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x64\x65\x73\x74\x72\x6F\x79","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x77\x65\x62\x73\x69\x74\x65\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x69\x64\x73","\x64\x65\x73\x74\x72\x6F\x79\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x61\x70\x70\x49\x64","\x67\x65\x74\x46\x6F\x72\x6D\x73","\x6A\x73\x6F\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x74\x79\x70\x65","\x73\x63\x6F\x70\x65","\x75\x70\x64\x61\x74\x65\x46\x6F\x72\x6D\x73","\x6F\x6E\x6C\x69\x6E\x65","\x4F\x6E\x6C\x69\x6E\x65\x49\x64","\x6F\x66\x66\x6C\x69\x6E\x65","\x4F\x66\x66\x6C\x69\x6E\x65\x49\x64"];_0x390c[0];var _=require(_0x390c[1]);var util=require(_0x390c[2]);var async=require(_0x390c[3]);var Mustache=require(_0x390c[4]);var Util=require(_0x390c[5]);var sequelize=require(_0x390c[7])[_0x390c[6]];var ChatWebsite=require(_0x390c[7])[_0x390c[8]];var ChatQueue=require(_0x390c[7])[_0x390c[9]];var User=require(_0x390c[7])[_0x390c[10]];var ChatApplication=require(_0x390c[7])[_0x390c[11]];var ChatWebsitesField=require(_0x390c[7])[_0x390c[12]];var snippet=require(_0x390c[14])[_0x390c[13]];exports[_0x390c[15]]=function(_0xb0d1xd,_0xb0d1xe,_0xb0d1xf){return ChatWebsite[_0x390c[22]](Util[_0x390c[21]](_0xb0d1xd[_0x390c[20]]))[_0x390c[19]](function(_0xb0d1x11){_0xb0d1xe[_0x390c[18]](200)[_0x390c[17]](_0xb0d1x11)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[23]]=function(_0xb0d1xd,_0xb0d1xe){return ChatWebsite[_0x390c[27]](_0xb0d1xd[_0x390c[26]][_0x390c[25]])[_0x390c[19]](function(_0xb0d1x12){if(!_0xb0d1x12){return _0xb0d1xe[_0x390c[24]](404)};return _0xb0d1xe[_0x390c[17]](_0xb0d1x12)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[28]]=function(_0xb0d1xd,_0xb0d1xe,_0xb0d1xf){return ChatWebsite[_0x390c[27]](_0xb0d1xd[_0x390c[26]][_0x390c[25]])[_0x390c[19]](function(_0xb0d1x14){if(!_0xb0d1x14){return _0xb0d1xe[_0x390c[24]](404)};return _0xb0d1x14[_0x390c[33]](_[_0x390c[32]](Util[_0x390c[21]](_0xb0d1xd[_0x390c[20]]),{include:[{model:ChatQueue,attributes:[_0x390c[25],_0x390c[31]]},{model:User,attributes:[_0x390c[25],_0x390c[31]]}]}))})[_0x390c[19]](function(_0xb0d1x13){return _0xb0d1xe[_0x390c[17]]({count:_0xb0d1x13[_0x390c[30]],rows:_0xb0d1x13})})[_0x390c[16]](function(_0xb0d1x10){console[_0x390c[29]](_0xb0d1x10);return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[34]]=function(_0xb0d1xd,_0xb0d1xe){return ChatWebsite[_0x390c[27]](_0xb0d1xd[_0x390c[26]][_0x390c[25]])[_0x390c[19]](function(_0xb0d1x12){var _0xb0d1x15={remote:_0xb0d1x12[_0x390c[35]],websiteId:_0xb0d1xd[_0x390c[26]][_0x390c[25]]};var _0xb0d1x16=Mustache[_0x390c[36]](snippet,_0xb0d1x15);return _0xb0d1xe[_0x390c[18]](200)[_0x390c[17]]({html:_0xb0d1x16})})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[37]]=function(_0xb0d1xd,_0xb0d1xe){return ChatWebsite[_0x390c[37]](_0xb0d1xd[_0x390c[38]])[_0x390c[19]](function(_0xb0d1x12){return _0xb0d1xe[_0x390c[18]](201)[_0x390c[17]](_0xb0d1x12)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[39]]=function(_0xb0d1xd,_0xb0d1xe){if(_0xb0d1xd[_0x390c[38]][_0x390c[25]]){delete _0xb0d1xd[_0x390c[38]][_0x390c[25]]};return ChatWebsite[_0x390c[27]](_0xb0d1xd[_0x390c[26]][_0x390c[25]])[_0x390c[19]](function(_0xb0d1x12){if(!_0xb0d1x12){return _0xb0d1xe[_0x390c[24]](404)};return _0xb0d1x12[_0x390c[39]](_0xb0d1xd[_0x390c[38]])[_0x390c[19]](function(_0xb0d1x12){return _0xb0d1xe[_0x390c[18]](200)[_0x390c[17]](_0xb0d1x12)})})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[40]]=function(_0xb0d1xd,_0xb0d1xe){var _0xb0d1x17=0;var _0xb0d1x18=_0xb0d1xd[_0x390c[38]];_0xb0d1x18[_0x390c[44]](function(_0xb0d1x19){delete _0xb0d1x19[_0x390c[25]];delete _0xb0d1x19[_0x390c[41]];delete _0xb0d1x19[_0x390c[42]];_0xb0d1x19[_0x390c[43]]= ++_0xb0d1x17});return sequelize[_0x390c[47]](function(_0xb0d1x1a){return ChatApplication[_0x390c[46]]({where:{ChatWebsiteId:_0xb0d1xd[_0x390c[26]][_0x390c[25]]},individualHooks:true,transaction:_0xb0d1x1a})[_0x390c[19]](function(){return ChatApplication[_0x390c[45]](_0xb0d1x18,{individualHooks:true,transaction:_0xb0d1x1a})})})[_0x390c[19]](function(_0xb0d1x13){return _0xb0d1xe[_0x390c[18]](200)[_0x390c[17]]({count:_0xb0d1x13[_0x390c[30]],rows:_0xb0d1x13})})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[46]]=function(_0xb0d1xd,_0xb0d1xe){return ChatWebsite[_0x390c[27]](_0xb0d1xd[_0x390c[26]][_0x390c[25]])[_0x390c[19]](function(_0xb0d1x12){if(!_0xb0d1x12){return _0xb0d1xe[_0x390c[24]](404)};return _0xb0d1x12[_0x390c[46]]()})[_0x390c[19]](function(){return _0xb0d1xe[_0x390c[24]](204)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[48]]=function(_0xb0d1xd,_0xb0d1xe){return ChatWebsite[_0x390c[46]]({where:{id:_0xb0d1xd[_0x390c[20]][_0x390c[49]]},individualHooks:true})[_0x390c[19]](function(){return _0xb0d1xe[_0x390c[24]](204)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[50]]=function(_0xb0d1xd,_0xb0d1xe){return ChatApplication[_0x390c[46]]({where:{id:_0xb0d1xd[_0x390c[20]][_0x390c[51]]},individualHooks:true})[_0x390c[19]](function(){return _0xb0d1xe[_0x390c[24]](204)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[52]]=function(_0xb0d1xd,_0xb0d1xe,_0xb0d1xf){return ChatApplication[_0x390c[27]](_0xb0d1xd[_0x390c[26]][_0x390c[53]])[_0x390c[19]](function(_0xb0d1x1b){if(!_0xb0d1x1b){return _0xb0d1xe[_0x390c[24]](404)};return _0xb0d1x1b[_0x390c[46]]()})[_0x390c[19]](function(){return _0xb0d1xe[_0x390c[24]](204)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[54]]=function(_0xb0d1xd,_0xb0d1xe){return ChatWebsitesField[_0x390c[58]]({method:[_0xb0d1xd[_0x390c[26]][_0x390c[57]],_0xb0d1xd[_0x390c[26]][_0x390c[25]]]})[_0x390c[56]]()[_0x390c[19]](function(_0xb0d1x1c){return _0xb0d1xe[_0x390c[18]](200)[_0x390c[55]](_0xb0d1x1c)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};exports[_0x390c[59]]=function(_0xb0d1xd,_0xb0d1xe,_0xb0d1xf){return ChatWebsitesField[_0x390c[46]]({where:_0xb0d1xd[_0x390c[26]][_0x390c[57]]===_0x390c[60]?{OnlineId:_0xb0d1xd[_0x390c[26]][_0x390c[25]]}:{OfflineId:_0xb0d1xd[_0x390c[26]][_0x390c[25]]}})[_0x390c[19]](function(){_[_0x390c[44]](_0xb0d1xd[_0x390c[38]],function(_0xb0d1x1e){if(_0xb0d1xd[_0x390c[26]][_0x390c[57]]===_0x390c[60]){_0xb0d1x1e[_0x390c[61]]=_0xb0d1xd[_0x390c[26]][_0x390c[25]]}else {if(_0xb0d1xd[_0x390c[26]][_0x390c[57]]===_0x390c[62]){_0xb0d1x1e[_0x390c[63]]=_0xb0d1xd[_0x390c[26]][_0x390c[25]]}}});return ChatWebsitesField[_0x390c[45]](_0xb0d1xd[_0x390c[38]])})[_0x390c[19]](function(_0xb0d1x1d){_0xb0d1xe[_0x390c[18]](201)[_0x390c[55]](_0xb0d1x1d)})[_0x390c[16]](function(_0xb0d1x10){return handleError(_0xb0d1xe,_0xb0d1x10)})};function handleError(_0xb0d1xe,_0xb0d1x10){return _0xb0d1xe[_0x390c[18]](500)[_0x390c[17]](_0xb0d1x10)}