'use strict';const _0x1b5df4=_0x3a43;(function(_0xd01be5,_0x1cdef3){const _0x5d85d9=_0x3a43,_0x9c92f1=_0xd01be5();while(!![]){try{const _0x2c132f=-parseInt(_0x5d85d9(0x121))/0x1+parseInt(_0x5d85d9(0x11e))/0x2+parseInt(_0x5d85d9(0x135))/0x3+parseInt(_0x5d85d9(0x12d))/0x4*(parseInt(_0x5d85d9(0x139))/0x5)+-parseInt(_0x5d85d9(0x147))/0x6*(parseInt(_0x5d85d9(0x10f))/0x7)+parseInt(_0x5d85d9(0x143))/0x8+parseInt(_0x5d85d9(0x130))/0x9*(parseInt(_0x5d85d9(0x11a))/0xa);if(_0x2c132f===_0x1cdef3)break;else _0x9c92f1['push'](_0x9c92f1['shift']());}catch(_0x54dfe5){_0x9c92f1['push'](_0x9c92f1['shift']());}}}(_0x36d6,0x9fb9c));function _0x3a43(_0x28368f,_0x143fcc){const _0x36d69c=_0x36d6();return _0x3a43=function(_0x3a43b9,_0x10077a){_0x3a43b9=_0x3a43b9-0x105;let _0x425f68=_0x36d69c[_0x3a43b9];return _0x425f68;},_0x3a43(_0x28368f,_0x143fcc);}var __decorate=this&&this['__decorate']||function(_0x2fdd33,_0x15202f,_0x4898ba,_0x373a18){const _0x78c730=_0x3a43;var _0x6b46a0=arguments[_0x78c730(0x107)],_0x200c8b=_0x6b46a0<0x3?_0x15202f:_0x373a18===null?_0x373a18=Object[_0x78c730(0x123)](_0x15202f,_0x4898ba):_0x373a18,_0x3fa162;if(typeof Reflect===_0x78c730(0x115)&&typeof Reflect['decorate']===_0x78c730(0x146))_0x200c8b=Reflect[_0x78c730(0x119)](_0x2fdd33,_0x15202f,_0x4898ba,_0x373a18);else{for(var _0x3e3c0d=_0x2fdd33[_0x78c730(0x107)]-0x1;_0x3e3c0d>=0x0;_0x3e3c0d--)if(_0x3fa162=_0x2fdd33[_0x3e3c0d])_0x200c8b=(_0x6b46a0<0x3?_0x3fa162(_0x200c8b):_0x6b46a0>0x3?_0x3fa162(_0x15202f,_0x4898ba,_0x200c8b):_0x3fa162(_0x15202f,_0x4898ba))||_0x200c8b;}return _0x6b46a0>0x3&&_0x200c8b&&Object['defineProperty'](_0x15202f,_0x4898ba,_0x200c8b),_0x200c8b;},__metadata=this&&this[_0x1b5df4(0x138)]||function(_0x169ea9,_0x1b422b){const _0x57493c=_0x1b5df4;if(typeof Reflect===_0x57493c(0x115)&&typeof Reflect[_0x57493c(0x125)]===_0x57493c(0x146))return Reflect['metadata'](_0x169ea9,_0x1b422b);},__param=this&&this['__param']||function(_0x13141f,_0x34e4a6){return function(_0x3d59fe,_0x21ea8a){_0x34e4a6(_0x3d59fe,_0x21ea8a,_0x13141f);};};Object['defineProperty'](exports,_0x1b5df4(0x10a),{'value':!![]}),exports['VerificationService']=void 0x0;function _0x36d6(){const _0x224d99=['design:paramtypes','metadata','verifycationEntity','https://dysmsapi.aliyuncs.com','VerificationService','createRandomCode','VerifycationEntity','BAD_REQUEST','data','20sagniA','Message','USED','9EREKJn','SendSms','当前验证码已被使用!','getTime','验证码错误','359226lURswt','Repository','findOne','__metadata','508445tAEoxd','图形验证码已过期、请重新输入!','update',':CAPTCHA:','getNamespace','图形验证码错误、请检查填写!','./verifycation.entity','request','verifyCaptcha','sendPhoneCode','8221560ZwTBzD','ceil','Injectable','function','258ntnMDp','HttpException','stringify','redisCacheService','length','createdAt','验证码发送失败!','__esModule','HttpStatus','@nestjs/common','RedisCacheService','getPhoneVerifyConfig','163604VIYUYz','DESC','@alicloud/pop-core','get','验证码已过期','expiresAt','object','globalConfigService','确实必要参数错误!','验证码不存在','decorate','464680UPTJlX','del','used','typeorm','1335078xquVqI','now','VerificationUseStatusEnum','710657biobmJ','createVerification','getOwnPropertyDescriptor'];_0x36d6=function(){return _0x224d99;};return _0x36d6();}const globalConfig_service_1=require('../globalConfig/globalConfig.service'),status_constant_1=require('../../common/constants/status.constant'),typeorm_1=require('@nestjs/typeorm'),typeorm_2=require(_0x1b5df4(0x11d)),verifycation_entity_1=require(_0x1b5df4(0x13f)),common_1=require(_0x1b5df4(0x10c)),utils_1=require('../../common/utils'),redisCache_service_1=require('../redisCache/redisCache.service'),Core=require(_0x1b5df4(0x111));let VerificationService=class VerificationService{constructor(_0x1fe17d,_0x758c3,_0x10e077){const _0x92619c=_0x1b5df4;this[_0x92619c(0x126)]=_0x1fe17d,this[_0x92619c(0x116)]=_0x758c3,this['redisCacheService']=_0x10e077;}async[_0x1b5df4(0x122)](_0x2c6169,_0x43c1d8,_0x506dd1=0x1e*0x3c){const _0x537440=_0x1b5df4,_0x5a9c12=await this['verifycationEntity'][_0x537440(0x137)]({'where':{'userId':_0x2c6169['id'],'type':_0x43c1d8},'order':{'createdAt':_0x537440(0x110)}});if(_0x5a9c12&&_0x5a9c12[_0x537440(0x108)][_0x537440(0x133)]()+0x1*0x3c*0x3e8>Date['now']()){const _0x2adfdd=Math[_0x537440(0x144)]((_0x5a9c12[_0x537440(0x108)][_0x537440(0x133)]()+0x1*0x3c*0x3e8-Date[_0x537440(0x11f)]())/0x3e8);throw new common_1[(_0x537440(0x148))](_0x2adfdd+'S内不得重新发送',common_1[_0x537440(0x10b)][_0x537440(0x12b)]);}const _0x20c9dc=(0x0,utils_1[_0x537440(0x129)])(),_0x47e440=new Date(Date['now']()+_0x506dd1*0x3e8),{id:_0x82e12,email:_0x5e4159}=_0x2c6169,_0x4feb7e={'userId':_0x82e12,'type':_0x43c1d8,'code':_0x20c9dc,'expiresAt':_0x47e440,'email':_0x5e4159};return await this[_0x537440(0x126)]['save'](_0x4feb7e);}async['verifyCode']({code:_0x193f86,id:_0x41fcf9},_0x4b7bd4){const _0x851ed3=_0x1b5df4,_0x3e2256=await this[_0x851ed3(0x126)][_0x851ed3(0x137)]({'where':{'id':_0x41fcf9,'type':_0x4b7bd4},'order':{'createdAt':'DESC'}});if(!_0x3e2256)throw new common_1['HttpException'](_0x851ed3(0x118),common_1[_0x851ed3(0x10b)][_0x851ed3(0x12b)]);if(_0x3e2256[_0x851ed3(0x11c)]===status_constant_1[_0x851ed3(0x120)][_0x851ed3(0x12f)])throw new common_1[(_0x851ed3(0x148))](_0x851ed3(0x132),common_1[_0x851ed3(0x10b)][_0x851ed3(0x12b)]);else _0x3e2256[_0x851ed3(0x11c)]=status_constant_1[_0x851ed3(0x120)][_0x851ed3(0x12f)],await this[_0x851ed3(0x126)][_0x851ed3(0x13b)]({'id':_0x41fcf9},_0x3e2256);if(Number(_0x3e2256['code'])!==Number(_0x193f86))throw new common_1[(_0x851ed3(0x148))](_0x851ed3(0x134),common_1[_0x851ed3(0x10b)][_0x851ed3(0x12b)]);if(_0x3e2256[_0x851ed3(0x114)]