mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-26 13:16:39 +08:00
1 line
4.6 KiB
JavaScript
1 line
4.6 KiB
JavaScript
'use strict';const _0x40f52c=_0x8b3e;(function(_0xc22b15,_0x511c79){const _0x45ab3a=_0x8b3e,_0x19721e=_0xc22b15();while(!![]){try{const _0x3d224f=-parseInt(_0x45ab3a(0x16b))/0x1+-parseInt(_0x45ab3a(0x17d))/0x2+parseInt(_0x45ab3a(0x18a))/0x3*(-parseInt(_0x45ab3a(0x172))/0x4)+-parseInt(_0x45ab3a(0x181))/0x5+parseInt(_0x45ab3a(0x17b))/0x6*(-parseInt(_0x45ab3a(0x17c))/0x7)+-parseInt(_0x45ab3a(0x179))/0x8+parseInt(_0x45ab3a(0x16c))/0x9;if(_0x3d224f===_0x511c79)break;else _0x19721e['push'](_0x19721e['shift']());}catch(_0x3ed9bf){_0x19721e['push'](_0x19721e['shift']());}}}(_0x15eb,0x4552a));var __decorate=this&&this[_0x40f52c(0x17a)]||function(_0x27ef2c,_0x508644,_0x2cf298,_0xfa36f8){const _0x4d5330=_0x40f52c;var _0x2a014a=arguments['length'],_0x1821e8=_0x2a014a<0x3?_0x508644:_0xfa36f8===null?_0xfa36f8=Object[_0x4d5330(0x189)](_0x508644,_0x2cf298):_0xfa36f8,_0x197fbb;if(typeof Reflect===_0x4d5330(0x177)&&typeof Reflect[_0x4d5330(0x182)]===_0x4d5330(0x190))_0x1821e8=Reflect[_0x4d5330(0x182)](_0x27ef2c,_0x508644,_0x2cf298,_0xfa36f8);else{for(var _0xa03171=_0x27ef2c['length']-0x1;_0xa03171>=0x0;_0xa03171--)if(_0x197fbb=_0x27ef2c[_0xa03171])_0x1821e8=(_0x2a014a<0x3?_0x197fbb(_0x1821e8):_0x2a014a>0x3?_0x197fbb(_0x508644,_0x2cf298,_0x1821e8):_0x197fbb(_0x508644,_0x2cf298))||_0x1821e8;}return _0x2a014a>0x3&&_0x1821e8&&Object[_0x4d5330(0x171)](_0x508644,_0x2cf298,_0x1821e8),_0x1821e8;},__metadata=this&&this[_0x40f52c(0x186)]||function(_0x380e6b,_0x23f04e){const _0x3eb71e=_0x40f52c;if(typeof Reflect===_0x3eb71e(0x177)&&typeof Reflect['metadata']===_0x3eb71e(0x190))return Reflect[_0x3eb71e(0x178)](_0x380e6b,_0x23f04e);};Object[_0x40f52c(0x171)](exports,_0x40f52c(0x173),{'value':!![]}),exports['FanyiService']=void 0x0;const globalConfig_service_1=require('../globalConfig/globalConfig.service'),common_1=require(_0x40f52c(0x183)),axios_1=require('axios'),crypto=require('crypto');function _0x8b3e(_0x411562,_0x68099b){const _0x15eb50=_0x15eb();return _0x8b3e=function(_0x8b3e8b,_0x3a74eb){_0x8b3e8b=_0x8b3e8b-0x169;let _0x4a37a0=_0x15eb50[_0x8b3e8b];return _0x4a37a0;},_0x8b3e(_0x411562,_0x68099b);}function _0x15eb(){const _0x1800a2=['24918TsRayc','63nYPSqN','677120vlxadI','baiduFanyiAppId','application/x-www-form-urlencoded','HttpStatus','2226575PkxCmE','decorate','@nestjs/common','hex','data','__metadata','BAD_REQUEST','post','getOwnPropertyDescriptor','576588grjMIl','length','baiduFanyiSecret','toString','design:paramtypes','convertToEnglish','function','update','dst','GlobalConfigService','6410NsPpvQ','17039853ulzyKO','createHash','digest','default','res:\x20','defineProperty','8zUMukM','__esModule','log','globalConfigService','HttpException','object','metadata','3178536CVQBdf','__decorate'];_0x15eb=function(){return _0x1800a2;};return _0x15eb();}let FanyiService=class FanyiService{constructor(_0x3d6ed2){const _0x2e8a63=_0x40f52c;this[_0x2e8a63(0x175)]=_0x3d6ed2;}async[_0x40f52c(0x18f)](_0x3e85ae){const _0x200aa1=_0x40f52c;if(!_0x3e85ae)throw new common_1[(_0x200aa1(0x176))]('请输入要翻译的内容!',common_1[_0x200aa1(0x180)][_0x200aa1(0x187)]);const {baiduFanyiAppId:_0x47d9be,baiduFanyiSecret:_0x29ae5b}=await this[_0x200aa1(0x175)]['getConfigs']([_0x200aa1(0x17e),_0x200aa1(0x18c)]);if(!_0x47d9be||!_0x29ae5b)throw new common_1[(_0x200aa1(0x176))]('当前管理员还未开放翻译服务、请联系管理员开通吧!',common_1[_0x200aa1(0x180)][_0x200aa1(0x187)]);const _0x5c7bf8=Date['now']()[_0x200aa1(0x18d)](),_0x11b73d=crypto[_0x200aa1(0x16d)]('md5')[_0x200aa1(0x191)](_0x47d9be+_0x3e85ae+_0x5c7bf8+_0x29ae5b)[_0x200aa1(0x16e)](_0x200aa1(0x184)),_0x3a6bb2='https://fanyi-api.baidu.com/api/trans/vip/translate',_0x1f7b90={'q':_0x3e85ae[_0x200aa1(0x18d)](),'from':'auto','to':'en','appid':_0x47d9be,'salt':_0x5c7bf8,'sign':_0x11b73d},_0x114b52=await axios_1[_0x200aa1(0x16f)][_0x200aa1(0x188)](_0x3a6bb2,_0x1f7b90,{'headers':{'Content-Type':_0x200aa1(0x17f)}}),{from:_0x39009a,to:_0x530033,trans_result:_0x466c6e,error_code:_0xbc4db2,error_msg:_0x5389c1}=_0x114b52[_0x200aa1(0x185)];if(_0xbc4db2){console['log'](_0x200aa1(0x170),_0x114b52);throw new common_1[(_0x200aa1(0x176))]('翻译失败['+_0xbc4db2+']['+_0x5389c1+']!',common_1[_0x200aa1(0x180)][_0x200aa1(0x187)]);}if(!_0x466c6e||!_0x466c6e[_0x200aa1(0x18b)]){console[_0x200aa1(0x174)](_0x200aa1(0x170),_0x114b52);throw new common_1[(_0x200aa1(0x176))]('翻译失败['+_0xbc4db2+']['+_0x5389c1+']!',common_1['HttpStatus'][_0x200aa1(0x187)]);}else{}return _0x466c6e[0x0][_0x200aa1(0x169)];}};FanyiService=__decorate([(0x0,common_1['Injectable'])(),__metadata(_0x40f52c(0x18e),[globalConfig_service_1[_0x40f52c(0x16a)]])],FanyiService),exports['FanyiService']=FanyiService; |