mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-26 13:16:39 +08:00
1 line
4.5 KiB
JavaScript
1 line
4.5 KiB
JavaScript
'use strict';function _0x2d45(_0x58115e,_0x2f759c){const _0x434f3a=_0x434f();return _0x2d45=function(_0x2d4542,_0x42f6d2){_0x2d4542=_0x2d4542-0x83;let _0x472eb0=_0x434f3a[_0x2d4542];return _0x472eb0;},_0x2d45(_0x58115e,_0x2f759c);}const _0x14d801=_0x2d45;(function(_0xcd0f34,_0xdf6f65){const _0x3d8010=_0x2d45,_0xcc10fe=_0xcd0f34();while(!![]){try{const _0x31b0ec=-parseInt(_0x3d8010(0x92))/0x1+parseInt(_0x3d8010(0x95))/0x2+parseInt(_0x3d8010(0x8e))/0x3+parseInt(_0x3d8010(0x8c))/0x4+-parseInt(_0x3d8010(0xa4))/0x5+-parseInt(_0x3d8010(0xa6))/0x6*(-parseInt(_0x3d8010(0x86))/0x7)+parseInt(_0x3d8010(0x8f))/0x8*(-parseInt(_0x3d8010(0x89))/0x9);if(_0x31b0ec===_0xdf6f65)break;else _0xcc10fe['push'](_0xcc10fe['shift']());}catch(_0x64be43){_0xcc10fe['push'](_0xcc10fe['shift']());}}}(_0x434f,0x8b2eb));function _0x434f(){const _0x1362b4=['Injectable','digest','baiduFanyiAppId','decorate','当前管理员还未开放翻译服务、请联系管理员开通吧!','dst','design:paramtypes','翻译失败[','object','toString','application/x-www-form-urlencoded','__esModule','请输入要翻译的内容!','FanyiService','4109460uWrBgT','now','6favHcY','data','axios','HttpStatus','getOwnPropertyDescriptor','update','createHash','function','globalConfigService','metadata','post','5823223nNaIQr','md5','hex','9gKcVYi','HttpException','BAD_REQUEST','3380480iYpWzA','GlobalConfigService','422082yRvIky','11002192jRwSIR','log','length','168940Yiyplr','res:\x20','defineProperty','2236988TTUZPa'];_0x434f=function(){return _0x1362b4;};return _0x434f();}var __decorate=this&&this['__decorate']||function(_0x168896,_0x216ca6,_0x448ac5,_0x894297){const _0x15676f=_0x2d45;var _0x196506=arguments[_0x15676f(0x91)],_0x2bdd10=_0x196506<0x3?_0x216ca6:_0x894297===null?_0x894297=Object[_0x15676f(0xaa)](_0x216ca6,_0x448ac5):_0x894297,_0x17e9f4;if(typeof Reflect===_0x15676f(0x9e)&&typeof Reflect[_0x15676f(0x99)]===_0x15676f(0xad))_0x2bdd10=Reflect[_0x15676f(0x99)](_0x168896,_0x216ca6,_0x448ac5,_0x894297);else{for(var _0x2cc243=_0x168896[_0x15676f(0x91)]-0x1;_0x2cc243>=0x0;_0x2cc243--)if(_0x17e9f4=_0x168896[_0x2cc243])_0x2bdd10=(_0x196506<0x3?_0x17e9f4(_0x2bdd10):_0x196506>0x3?_0x17e9f4(_0x216ca6,_0x448ac5,_0x2bdd10):_0x17e9f4(_0x216ca6,_0x448ac5))||_0x2bdd10;}return _0x196506>0x3&&_0x2bdd10&&Object[_0x15676f(0x94)](_0x216ca6,_0x448ac5,_0x2bdd10),_0x2bdd10;},__metadata=this&&this['__metadata']||function(_0x3dd1f2,_0x1c2c10){const _0x195cff=_0x2d45;if(typeof Reflect===_0x195cff(0x9e)&&typeof Reflect[_0x195cff(0x84)]==='function')return Reflect['metadata'](_0x3dd1f2,_0x1c2c10);};Object['defineProperty'](exports,_0x14d801(0xa1),{'value':!![]}),exports[_0x14d801(0xa3)]=void 0x0;const globalConfig_service_1=require('../globalConfig/globalConfig.service'),common_1=require('@nestjs/common'),axios_1=require(_0x14d801(0xa8)),crypto=require('crypto');let FanyiService=class FanyiService{constructor(_0x313d62){const _0x37145d=_0x14d801;this[_0x37145d(0x83)]=_0x313d62;}async['convertToEnglish'](_0x39959c){const _0x581129=_0x14d801;if(!_0x39959c)throw new common_1[(_0x581129(0x8a))](_0x581129(0xa2),common_1['HttpStatus']['BAD_REQUEST']);const {baiduFanyiAppId:_0x20475b,baiduFanyiSecret:_0x35d708}=await this[_0x581129(0x83)]['getConfigs']([_0x581129(0x98),'baiduFanyiSecret']);if(!_0x20475b||!_0x35d708)throw new common_1[(_0x581129(0x8a))](_0x581129(0x9a),common_1[_0x581129(0xa9)]['BAD_REQUEST']);const _0x4785dc=Date[_0x581129(0xa5)]()[_0x581129(0x9f)](),_0x52bed9=crypto[_0x581129(0xac)](_0x581129(0x87))[_0x581129(0xab)](_0x20475b+_0x39959c+_0x4785dc+_0x35d708)[_0x581129(0x97)](_0x581129(0x88)),_0x27743e='https://fanyi-api.baidu.com/api/trans/vip/translate',_0x8f4800={'q':_0x39959c['toString'](),'from':'auto','to':'en','appid':_0x20475b,'salt':_0x4785dc,'sign':_0x52bed9},_0xa91e0d=await axios_1['default'][_0x581129(0x85)](_0x27743e,_0x8f4800,{'headers':{'Content-Type':_0x581129(0xa0)}}),{from:_0x572578,to:_0x17a750,trans_result:_0x40e045,error_code:_0x2937a7,error_msg:_0x10a73e}=_0xa91e0d[_0x581129(0xa7)];if(_0x2937a7){console['log']('res:\x20',_0xa91e0d);throw new common_1[(_0x581129(0x8a))]('翻译失败['+_0x2937a7+']['+_0x10a73e+']!',common_1[_0x581129(0xa9)][_0x581129(0x8b)]);}if(!_0x40e045||!_0x40e045[_0x581129(0x91)]){console[_0x581129(0x90)](_0x581129(0x93),_0xa91e0d);throw new common_1[(_0x581129(0x8a))](_0x581129(0x9d)+_0x2937a7+']['+_0x10a73e+']!',common_1[_0x581129(0xa9)]['BAD_REQUEST']);}else{}return _0x40e045[0x0][_0x581129(0x9b)];}};FanyiService=__decorate([(0x0,common_1[_0x14d801(0x96)])(),__metadata(_0x14d801(0x9c),[globalConfig_service_1[_0x14d801(0x8d)]])],FanyiService),exports[_0x14d801(0xa3)]=FanyiService; |