mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-24 12:16:38 +08:00
1 line
8.0 KiB
JavaScript
1 line
8.0 KiB
JavaScript
'use strict';const _0x12b0ac=_0xc397;(function(_0x36a5cc,_0x4f751a){const _0x3c3777=_0xc397,_0x143528=_0x36a5cc();while(!![]){try{const _0x5e1cca=-parseInt(_0x3c3777(0xcd))/0x1*(parseInt(_0x3c3777(0xbf))/0x2)+parseInt(_0x3c3777(0x9f))/0x3+-parseInt(_0x3c3777(0xbd))/0x4*(-parseInt(_0x3c3777(0xa3))/0x5)+-parseInt(_0x3c3777(0xbb))/0x6*(parseInt(_0x3c3777(0xc1))/0x7)+parseInt(_0x3c3777(0x99))/0x8*(parseInt(_0x3c3777(0xa6))/0x9)+parseInt(_0x3c3777(0xb9))/0xa*(-parseInt(_0x3c3777(0x96))/0xb)+parseInt(_0x3c3777(0xba))/0xc*(parseInt(_0x3c3777(0xce))/0xd);if(_0x5e1cca===_0x4f751a)break;else _0x143528['push'](_0x143528['shift']());}catch(_0x15ab75){_0x143528['push'](_0x143528['shift']());}}}(_0x4e28,0x2d96a));var __decorate=this&&this[_0x12b0ac(0xc0)]||function(_0x480842,_0x579ce6,_0x4a9310,_0x18c863){const _0x44b8c5=_0x12b0ac;var _0xc201e1=arguments[_0x44b8c5(0x92)],_0x86dd3d=_0xc201e1<0x3?_0x579ce6:_0x18c863===null?_0x18c863=Object['getOwnPropertyDescriptor'](_0x579ce6,_0x4a9310):_0x18c863,_0x572c22;if(typeof Reflect===_0x44b8c5(0xb6)&&typeof Reflect[_0x44b8c5(0xb0)]==='function')_0x86dd3d=Reflect[_0x44b8c5(0xb0)](_0x480842,_0x579ce6,_0x4a9310,_0x18c863);else{for(var _0x56b36d=_0x480842[_0x44b8c5(0x92)]-0x1;_0x56b36d>=0x0;_0x56b36d--)if(_0x572c22=_0x480842[_0x56b36d])_0x86dd3d=(_0xc201e1<0x3?_0x572c22(_0x86dd3d):_0xc201e1>0x3?_0x572c22(_0x579ce6,_0x4a9310,_0x86dd3d):_0x572c22(_0x579ce6,_0x4a9310))||_0x86dd3d;}return _0xc201e1>0x3&&_0x86dd3d&&Object['defineProperty'](_0x579ce6,_0x4a9310,_0x86dd3d),_0x86dd3d;},__metadata=this&&this[_0x12b0ac(0x9e)]||function(_0x769d78,_0x2e424a){const _0x6ed221=_0x12b0ac;if(typeof Reflect===_0x6ed221(0xb6)&&typeof Reflect['metadata']==='function')return Reflect[_0x6ed221(0xd3)](_0x769d78,_0x2e424a);},__param=this&&this['__param']||function(_0x1b11af,_0x20c541){return function(_0x3ae2c3,_0x3f349d){_0x20c541(_0x3ae2c3,_0x3f349d,_0x1b11af);};};Object[_0x12b0ac(0xae)](exports,'__esModule',{'value':!![]}),exports[_0x12b0ac(0xaf)]=void 0x0;const globalConfig_service_1=require(_0x12b0ac(0x95)),status_constant_1=require(_0x12b0ac(0x9a)),typeorm_1=require(_0x12b0ac(0xd1)),typeorm_2=require('typeorm'),verifycation_entity_1=require(_0x12b0ac(0x97)),common_1=require(_0x12b0ac(0xa5)),utils_1=require(_0x12b0ac(0xa0)),redisCache_service_1=require(_0x12b0ac(0xa1)),Core=require('@alicloud/pop-core');function _0xc397(_0x5a0ad7,_0x485c8b){const _0x4e2876=_0x4e28();return _0xc397=function(_0xc397e9,_0x282a8e){_0xc397e9=_0xc397e9-0x8f;let _0x48e3a1=_0x4e2876[_0xc397e9];return _0x48e3a1;},_0xc397(_0x5a0ad7,_0x485c8b);}function _0x4e28(){const _0xcef75f=['Message','@nestjs/common','1672101dMyvOd','HttpException','createdAt','getTime','createRandomCode','code','POST','globalConfigService','defineProperty','VerificationService','decorate','S内不得重新发送','图形验证码错误、请检查填写!','used','update','verifycationEntity','object','验证码错误','确实必要参数错误!','19270mwWfPb','72lgpfjF','48hhJXaz','findOne','428YDQOVT','save','2FQxeza','__decorate','22456wQcNRH','图形验证码已过期、请重新输入!','VerifycationEntity','get','DESC','BAD_REQUEST','redisCacheService','RedisCacheService','https://dysmsapi.aliyuncs.com','2017-05-25','sendPhoneCode','USED','217202choKmd','466973ePSTdj','Injectable','design:paramtypes','@nestjs/typeorm','Repository','metadata','HttpStatus','验证码不存在','InjectRepository','now','验证码发送失败!',':CAPTCHA:','GlobalConfigService','createVerification','length','验证码已过期','SendSms','../globalConfig/globalConfig.service','1683ywvKTt','./verifycation.entity','stringify','8VLJQjq','../../common/constants/status.constant','getNamespace','getPhoneVerifyConfig','ceil','__metadata','240666dXLjwV','../../common/utils','../redisCache/redisCache.service','VerificationUseStatusEnum','11350GsAnYj'];_0x4e28=function(){return _0xcef75f;};return _0x4e28();}let VerificationService=class VerificationService{constructor(_0x44b123,_0x4cc8f3,_0x51b7f3){const _0x364e72=_0x12b0ac;this[_0x364e72(0xb5)]=_0x44b123,this[_0x364e72(0xad)]=_0x4cc8f3,this[_0x364e72(0xc7)]=_0x51b7f3;}async[_0x12b0ac(0x91)](_0x394152,_0x566463,_0x4592b9=0x1e*0x3c){const _0x3c3635=_0x12b0ac,_0x7934a9=await this[_0x3c3635(0xb5)][_0x3c3635(0xbc)]({'where':{'userId':_0x394152['id'],'type':_0x566463},'order':{'createdAt':_0x3c3635(0xc5)}});if(_0x7934a9&&_0x7934a9['createdAt'][_0x3c3635(0xa9)]()+0x1*0x3c*0x3e8>Date[_0x3c3635(0xd7)]()){const _0x475944=Math[_0x3c3635(0x9d)]((_0x7934a9[_0x3c3635(0xa8)][_0x3c3635(0xa9)]()+0x1*0x3c*0x3e8-Date[_0x3c3635(0xd7)]())/0x3e8);throw new common_1[(_0x3c3635(0xa7))](_0x475944+_0x3c3635(0xb1),common_1['HttpStatus'][_0x3c3635(0xc6)]);}const _0x1fd985=(0x0,utils_1[_0x3c3635(0xaa)])(),_0x7a94c8=new Date(Date[_0x3c3635(0xd7)]()+_0x4592b9*0x3e8),{id:_0x570b5d,email:_0x3d5bb1}=_0x394152,_0x1b07c4={'userId':_0x570b5d,'type':_0x566463,'code':_0x1fd985,'expiresAt':_0x7a94c8,'email':_0x3d5bb1};return await this[_0x3c3635(0xb5)][_0x3c3635(0xbe)](_0x1b07c4);}async['verifyCode']({code:_0xf5a34c,id:_0x10fb32},_0x1e6e54){const _0x122462=_0x12b0ac,_0x1d5453=await this[_0x122462(0xb5)][_0x122462(0xbc)]({'where':{'id':_0x10fb32,'type':_0x1e6e54},'order':{'createdAt':'DESC'}});if(!_0x1d5453)throw new common_1['HttpException'](_0x122462(0xd5),common_1[_0x122462(0xd4)][_0x122462(0xc6)]);if(_0x1d5453[_0x122462(0xb3)]===status_constant_1[_0x122462(0xa2)][_0x122462(0xcc)])throw new common_1[(_0x122462(0xa7))]('当前验证码已被使用!',common_1[_0x122462(0xd4)][_0x122462(0xc6)]);else _0x1d5453[_0x122462(0xb3)]=status_constant_1[_0x122462(0xa2)][_0x122462(0xcc)],await this[_0x122462(0xb5)][_0x122462(0xb4)]({'id':_0x10fb32},_0x1d5453);if(Number(_0x1d5453[_0x122462(0xab)])!==Number(_0xf5a34c))throw new common_1[(_0x122462(0xa7))](_0x122462(0xb7),common_1[_0x122462(0xd4)][_0x122462(0xc6)]);if(_0x1d5453['expiresAt']<new Date())throw new common_1['HttpException'](_0x122462(0x93),common_1[_0x122462(0xd4)][_0x122462(0xc6)]);return _0x1d5453;}async['verifyCaptcha'](_0x3b1b81){const _0x406b5d=_0x12b0ac,{captchaId:_0x22eff5,captchaCode:_0x5f1198}=_0x3b1b81,_0x40a4d8=await this[_0x406b5d(0xad)][_0x406b5d(0x9b)](),_0x2fa491=_0x40a4d8+_0x406b5d(0x8f)+_0x22eff5,_0x3e8510=await this[_0x406b5d(0xc7)][_0x406b5d(0xc4)]({'key':_0x2fa491});await this[_0x406b5d(0xc7)]['del']({'key':_0x2fa491});if(!_0x3e8510)throw new common_1['HttpException'](_0x406b5d(0xc2),common_1[_0x406b5d(0xd4)][_0x406b5d(0xc6)]);if(!_0x3e8510||_0x3e8510!==_0x5f1198)throw new common_1[(_0x406b5d(0xa7))](_0x406b5d(0xb2),common_1[_0x406b5d(0xd4)][_0x406b5d(0xc6)]);}async[_0x12b0ac(0xcb)](_0x407bdc){const _0x4d8d70=_0x12b0ac;var _0x586cb2;const {accessKeyId:_0x2ca5b5,accessKeySecret:_0x796323,SignName:_0xd3e16a,TemplateCode:_0x5ba84a}=await this['globalConfigService'][_0x4d8d70(0x9c)](),{phone:_0x459352,code:_0x148712}=_0x407bdc;if(!_0x459352||!_0x148712)throw new common_1[(_0x4d8d70(0xa7))](_0x4d8d70(0xb8),common_1['HttpStatus']['BAD_REQUEST']);const _0x579fdd=new Core({'accessKeyId':_0x2ca5b5,'accessKeySecret':_0x796323,'endpoint':_0x4d8d70(0xc9),'apiVersion':_0x4d8d70(0xca)}),_0x49bb0e={'PhoneNumbers':_0x459352,'SignName':_0xd3e16a,'TemplateCode':_0x5ba84a,'TemplateParam':JSON[_0x4d8d70(0x98)]({'code':_0x148712})},_0x1ab0f1={'method':_0x4d8d70(0xac),'formatParams':![]};try{const _0x32c695=await _0x579fdd['request'](_0x4d8d70(0x94),_0x49bb0e,_0x1ab0f1);if(_0x32c695['Code']==='OK')return!![];else throw new common_1[(_0x4d8d70(0xa7))](_0x32c695[_0x4d8d70(0xa4)]||_0x4d8d70(0xd8),common_1[_0x4d8d70(0xd4)][_0x4d8d70(0xc6)]);}catch(_0x438fd2){throw new common_1[(_0x4d8d70(0xa7))](((_0x586cb2=_0x438fd2===null||_0x438fd2===void 0x0?void 0x0:_0x438fd2['data'])===null||_0x586cb2===void 0x0?void 0x0:_0x586cb2[_0x4d8d70(0xa4)])||_0x4d8d70(0xd8),common_1[_0x4d8d70(0xd4)][_0x4d8d70(0xc6)]);}}};VerificationService=__decorate([(0x0,common_1[_0x12b0ac(0xcf)])(),__param(0x0,(0x0,typeorm_1[_0x12b0ac(0xd6)])(verifycation_entity_1[_0x12b0ac(0xc3)])),__metadata(_0x12b0ac(0xd0),[typeorm_2[_0x12b0ac(0xd2)],globalConfig_service_1[_0x12b0ac(0x90)],redisCache_service_1[_0x12b0ac(0xc8)]])],VerificationService),exports[_0x12b0ac(0xaf)]=VerificationService; |