'use strict';function _0x45ac(_0x6f2534,_0x282616){const _0x161c79=_0x161c();return _0x45ac=function(_0x45ac42,_0x4addb3){_0x45ac42=_0x45ac42-0xf5;let _0x51c3b4=_0x161c79[_0x45ac42];return _0x51c3b4;},_0x45ac(_0x6f2534,_0x282616);}function _0x161c(){const _0x23a02d=['forEach','registerVerifyExpir','qureyUserInfoByInviteCode','生成邀请码失败,请重新试一次吧!','用户名或者邮箱已被注册!','getInviteRecord','DESC','metadata','createUserFromOpenId','userEntity','您的账户已被永久加入黑名单、如有疑问、请联系管理员!',']成功!','configMap:\x20','addBalanceToNewUser','queryOneUserInfo','saveRecordRechargeLog','__esModule','@nestjs-modules/mailer','用户不存在!','../../common/utils','../chatgpt/whiteList.entity','savaLoginIp','user','../../common/constants/user.constant','registerVerifyEmailDesc','当前密码错误!','queryUserInfoById','绑定微信失败、请联系管理员!','status','createdAt','email','generateRandomString','BAD_REQUEST','createRandomUid','../../common/constants/verification.constant','UserStatusEnum','isVerifyEmail','$2b$','Connection','inviteLink','checkUserStatus','globalConfigService','Like','update','updateStatus','当前绑定用户不存在!','getUserOpenId','visitor','5167211ZwQviN','__decorate','whiteListEntity','9903792mZtoaT','4895584QptAbg','../../common/constants/balance.constant','balanceInfo','sign','verificationService','123456','当前账户不存在!','修改用户信息成功!','无效的邀请码!','UserService','map','openId','isBindWx','verifyUserRegisterByPhone','修改用户状态成功!','该微信已绑定其他账号!','maskIpAddress','queryUserBalance','UNAUTHORIZED','queryOne','$2y$','的账号激活','651770XUuUNs','getOwnPropertyDescriptor','PENDING','当前手机号已注册、请勿重复注册!','userBalanceService','__metadata','addBalanceToUser','formatCreateOrUpdateDate','defineProperty','assign','密码重置为[','userDefautlAvatar','avatar','不可将用户置为未激活状态!','未激活用户不可手动变更状态!','bindWx','HttpException','修改用户状态失败!','sendMail','110PgxPBo','createVerification','md5','当前用户不存在!','client','LOCKED','genInviteCode','registerVerifyEmailTitle','inviteCode','affected','findOne','ACTIVE','ConfigEntity','password','Not','function','log','createUser','compareSync','BLACKLISTED','hex','VerificationEnum','configVal','InjectRepository','digest','UserEntity','../globalConfig/globalConfig.service','Repository','resetUserPass','startsWith','consecutiveDays','object','maskEmail','split','updateInfo','UserStatusErrMsg','length','error:\x20','getClientIp','已生成过邀请码、请勿重复生成','../userBalance/userBalance.service','HttpStatus','超级管理员不可被操作!','没有变更,无需更改!','username','typeorm','decorate','GlobalConfigService','hashSync','VerificationService','getConfigs','----,','./user.entity','findAndCount','2818uBjebw','ADMIN_GIFT','当前用户信息失效、请重新登录!','$2a$','@default.com','queryAll','registerBaseUrl','修改用户信息失败!','save','queryUserBalanceByIds','super','@nestjs/common','createHash','email\x20response\x20\x20->\x20:\x20','963WUvPdO','getUserById','reduce','mailerService','userRecharge','configKey','design:paramtypes','lastLoginIp','getUserStatus','updateUserStatus','9820pmhGun','UserBalanceService','6966YcZWrl','167016zKqBbX','find','phone','role','RechargeType','verifyUserPassword'];_0x161c=function(){return _0x23a02d;};return _0x161c();}const _0x31de8c=_0x45ac;(function(_0x452c0a,_0x43597e){const _0x1403f4=_0x45ac,_0x3dd461=_0x452c0a();while(!![]){try{const _0x1819b5=-parseInt(_0x1403f4(0x151))/0x1+-parseInt(_0x1403f4(0x19a))/0x2*(-parseInt(_0x1403f4(0x1a8))/0x3)+parseInt(_0x1403f4(0x13b))/0x4+-parseInt(_0x1403f4(0x164))/0x5*(parseInt(_0x1403f4(0x101))/0x6)+parseInt(_0x1403f4(0x137))/0x7+-parseInt(_0x1403f4(0x13a))/0x8+-parseInt(_0x1403f4(0x100))/0x9*(-parseInt(_0x1403f4(0xfe))/0xa);if(_0x1819b5===_0x43597e)break;else _0x3dd461['push'](_0x3dd461['shift']());}catch(_0x1294d1){_0x3dd461['push'](_0x3dd461['shift']());}}}(_0x161c,0xa4222));var __decorate=this&&this[_0x31de8c(0x138)]||function(_0x33c534,_0x4407df,_0x2be73c,_0x49ae5d){const _0xd7dccf=_0x31de8c;var _0x8169eb=arguments[_0xd7dccf(0x188)],_0x5a8eff=_0x8169eb<0x3?_0x4407df:_0x49ae5d===null?_0x49ae5d=Object[_0xd7dccf(0x152)](_0x4407df,_0x2be73c):_0x49ae5d,_0xf524e0;if(typeof Reflect===_0xd7dccf(0x183)&&typeof Reflect[_0xd7dccf(0x192)]===_0xd7dccf(0x173))_0x5a8eff=Reflect[_0xd7dccf(0x192)](_0x33c534,_0x4407df,_0x2be73c,_0x49ae5d);else{for(var _0x357a6d=_0x33c534[_0xd7dccf(0x188)]-0x1;_0x357a6d>=0x0;_0x357a6d--)if(_0xf524e0=_0x33c534[_0x357a6d])_0x5a8eff=(_0x8169eb<0x3?_0xf524e0(_0x5a8eff):_0x8169eb>0x3?_0xf524e0(_0x4407df,_0x2be73c,_0x5a8eff):_0xf524e0(_0x4407df,_0x2be73c))||_0x5a8eff;}return _0x8169eb>0x3&&_0x5a8eff&&Object[_0xd7dccf(0x159)](_0x4407df,_0x2be73c,_0x5a8eff),_0x5a8eff;},__metadata=this&&this[_0x31de8c(0x156)]||function(_0x3bd85f,_0x19c6aa){const _0x357f31=_0x31de8c;if(typeof Reflect===_0x357f31(0x183)&&typeof Reflect[_0x357f31(0x10e)]===_0x357f31(0x173))return Reflect[_0x357f31(0x10e)](_0x3bd85f,_0x19c6aa);},__param=this&&this['__param']||function(_0x178238,_0x48e9a5){return function(_0x4b24e0,_0x18d7db){_0x48e9a5(_0x4b24e0,_0x18d7db,_0x178238);};};Object[_0x31de8c(0x159)](exports,_0x31de8c(0x117),{'value':!![]}),exports['UserService']=void 0x0;const globalConfig_service_1=require(_0x31de8c(0x17e)),user_constant_1=require(_0x31de8c(0x11e)),mailer_1=require(_0x31de8c(0x118)),verification_service_1=require('../verification/verification.service'),common_1=require(_0x31de8c(0x1a5)),typeorm_1=require('@nestjs/typeorm'),typeorm_2=require(_0x31de8c(0x191)),user_entity_1=require(_0x31de8c(0x198)),bcrypt=require('bcryptjs'),crypto=require('crypto'),_=require('lodash'),verification_constant_1=require(_0x31de8c(0x129)),userBalance_service_1=require(_0x31de8c(0x18c)),utils_1=require(_0x31de8c(0x11a)),balance_constant_1=require(_0x31de8c(0x13c)),config_entity_1=require('../globalConfig/config.entity'),whiteList_entity_1=require(_0x31de8c(0x11b));let UserService=class UserService{constructor(_0x5813b4,_0x24fc34,_0x24bec9,_0x56a56c,_0x1a13f9,_0x5899be,_0x51e0f1,_0x282499){const _0x162f2f=_0x31de8c;this['userEntity']=_0x5813b4,this[_0x162f2f(0x139)]=_0x24fc34,this['connection']=_0x24bec9,this[_0x162f2f(0x13f)]=_0x56a56c,this['mailerService']=_0x1a13f9,this[_0x162f2f(0x155)]=_0x5899be,this[_0x162f2f(0x130)]=_0x51e0f1,this['configEntity']=_0x282499;}async['createUserAndVerifycation'](_0x227ed2,_0x528a8e){const _0x1fbe04=_0x31de8c,{username:_0x152dec,email:_0x3af2c2,password:_0x2409cd,invitedBy:_0x508dee,client:client=0x0}=_0x227ed2;if(_0x508dee){const _0x2ac616=await this[_0x1fbe04(0x110)][_0x1fbe04(0x16e)]({'where':{'inviteCode':_0x508dee}});if(!_0x2ac616)throw new common_1[(_0x1fbe04(0x161))](_0x1fbe04(0x143),common_1['HttpStatus']['BAD_REQUEST']);}const _0x380395=[{'username':_0x152dec},{'email':_0x3af2c2}],_0x1eabe4=await this['userEntity']['findOne']({'where':_0x380395});if(_0x1eabe4&&_0x1eabe4[_0x1fbe04(0x123)]!==user_constant_1['UserStatusEnum']['PENDING'])throw new common_1[(_0x1fbe04(0x161))](_0x1fbe04(0x10b),common_1[_0x1fbe04(0x18d)][_0x1fbe04(0x127)]);try{const _0x12d0c6=_['cloneDeep'](_0x227ed2),_0x5c993b=bcrypt[_0x1fbe04(0x194)](_0x2409cd,0xa),_0xa196e=(0x0,utils_1[_0x1fbe04(0x18a)])(_0x528a8e);_0x12d0c6[_0x1fbe04(0x171)]=_0x5c993b,_0x12d0c6['registerIp']=_0xa196e,_0x12d0c6[_0x1fbe04(0x168)]=client;let _0x2eff83;if(!_0x1eabe4){const _0x333908=await this[_0x1fbe04(0x130)][_0x1fbe04(0x196)]([_0x1fbe04(0x15c)]);_0x12d0c6[_0x1fbe04(0x15d)]=_0x333908,_0x2eff83=await this[_0x1fbe04(0x110)]['save'](_0x12d0c6);}else _0x2eff83=_0x1eabe4;const _0x4273ab=await this['configEntity'][_0x1fbe04(0x102)]({'where':{'configKey':(0x0,typeorm_2['In'])(['isVerifyEmail',_0x1fbe04(0x1a0),_0x1fbe04(0x16b),_0x1fbe04(0x11f),'registerVerifyEmailFrom',_0x1fbe04(0x108)])}}),_0x1c5d36=_0x4273ab[_0x1fbe04(0xf6)]((_0x235e03,_0x41f741)=>{const _0x3e4152=_0x1fbe04;return _0x235e03[_0x41f741[_0x3e4152(0xf9)]]=_0x41f741[_0x3e4152(0x17a)],_0x235e03;},{}),_0x581823=_0x1c5d36[_0x1fbe04(0x12b)]?Number(_0x1c5d36[_0x1fbe04(0x12b)]):0x1;if(_0x581823){const _0x11e122=_0x1c5d36[_0x1fbe04(0x108)]?Number(_0x1c5d36[_0x1fbe04(0x108)]):0x1e*0x3c,_0x3a2edd=await this[_0x1fbe04(0x13f)][_0x1fbe04(0x165)](_0x2eff83,verification_constant_1[_0x1fbe04(0x179)]['Registration'],_0x11e122),{code:_0x4f24fd,email:_0x14be0f,id:_0xe3151d}=_0x3a2edd,{registerVerifyEmailFrom:_0x4f1f9c}=_0x1c5d36;console[_0x1fbe04(0x174)](_0x1fbe04(0x113),_0x1c5d36);const _0x50c0dd=await this[_0x1fbe04(0xf7)][_0x1fbe04(0x163)]({'to':_0x14be0f,'subject':'来自'+_0x4f1f9c+_0x1fbe04(0x150),'template':'register','context':Object['assign']({'baseUrl':_0x1c5d36[_0x1fbe04(0x1a0)],'code':_0x4f24fd,'id':_0xe3151d},_0x1c5d36)});console[_0x1fbe04(0x174)](_0x1fbe04(0x1a7),_0x50c0dd);}else{const {username:_0x39e2f9,email:_0xac5889,id:_0x543317,invitedBy:_0x4cfe9a}=_0x2eff83;await this[_0x1fbe04(0xfd)](_0x543317,user_constant_1[_0x1fbe04(0x12a)][_0x1fbe04(0x16f)]);let _0x408437;_0x4cfe9a&&(_0x408437=await this[_0x1fbe04(0x109)](_0x4cfe9a)),await this[_0x1fbe04(0x155)][_0x1fbe04(0x114)](_0x543317,_0x408437===null||_0x408437===void 0x0?void 0x0:_0x408437['id']);}return _0x2eff83;}catch(_0x5b8f24){console['log'](_0x1fbe04(0x189),_0x5b8f24);throw _0x5b8f24;}}async['getSuper'](){const _0x1c13c9=_0x31de8c,_0x10c72f=await this[_0x1c13c9(0x110)]['findOne']({'where':{'role':_0x1c13c9(0x1a4)}});return _0x10c72f;}async['verifyUserCredentials'](_0x2ef60a){const _0x51d7c9=_0x31de8c,{username:_0x567816,password:_0x3c6558,uid:uid=0x0,phone:_0x6051b8}=_0x2ef60a;let _0xb2a345=null;if(uid>0x0){_0xb2a345=await this[_0x51d7c9(0x110)][_0x51d7c9(0x16e)]({'where':{'id':uid}});if(!_0xb2a345)throw new common_1[(_0x51d7c9(0x161))]('当前账户不存在!',common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);if(_0xb2a345[_0x51d7c9(0x171)][_0x51d7c9(0x181)](_0x51d7c9(0x19d))||_0xb2a345[_0x51d7c9(0x171)][_0x51d7c9(0x181)]('$2b$')||_0xb2a345[_0x51d7c9(0x171)]['startsWith']('$2y$')){if(!bcrypt[_0x51d7c9(0x176)](_0x3c6558,_0xb2a345['password']))throw new common_1[(_0x51d7c9(0x161))](_0x51d7c9(0x120),common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);}else{console[_0x51d7c9(0x174)]('----,');const _0x143352=crypto[_0x51d7c9(0x1a6)]('md5')['update'](_0x3c6558)[_0x51d7c9(0x17c)](_0x51d7c9(0x178));console[_0x51d7c9(0x174)](_0x51d7c9(0x197),_0x143352);if(_0x143352!==_0xb2a345[_0x51d7c9(0x171)])throw new common_1[(_0x51d7c9(0x161))](_0x51d7c9(0x120),common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);}}if(_0x567816&&_0x3c6558){const _0x18346c=[{'username':_0x567816},{'email':_0x567816}];_0xb2a345=await this[_0x51d7c9(0x110)]['findOne']({'where':_0x18346c});if(!_0xb2a345)throw new common_1[(_0x51d7c9(0x161))](_0x51d7c9(0x141),common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);if(_0xb2a345[_0x51d7c9(0x171)][_0x51d7c9(0x181)]('$2a$')||_0xb2a345[_0x51d7c9(0x171)]['startsWith'](_0x51d7c9(0x12c))||_0xb2a345[_0x51d7c9(0x171)][_0x51d7c9(0x181)](_0x51d7c9(0x14f))){if(!bcrypt['compareSync'](_0x3c6558,_0xb2a345[_0x51d7c9(0x171)]))throw new common_1['HttpException'](_0x51d7c9(0x120),common_1['HttpStatus'][_0x51d7c9(0x127)]);}else{console[_0x51d7c9(0x174)](_0x51d7c9(0x197));const _0x47b244=crypto[_0x51d7c9(0x1a6)](_0x51d7c9(0x166))[_0x51d7c9(0x132)](_0x3c6558)[_0x51d7c9(0x17c)](_0x51d7c9(0x178));console['log'](_0x51d7c9(0x197),_0x47b244);if(_0x47b244!==_0xb2a345['password'])throw new common_1[(_0x51d7c9(0x161))](_0x51d7c9(0x120),common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);}}if(_0x6051b8&&_0x3c6558){const _0x1b7b6b=[{'phone':_0x6051b8}];_0xb2a345=await this[_0x51d7c9(0x110)]['findOne']({'where':_0x1b7b6b});if(!_0xb2a345)throw new common_1[(_0x51d7c9(0x161))](_0x51d7c9(0x141),common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);if(_0xb2a345[_0x51d7c9(0x171)][_0x51d7c9(0x181)](_0x51d7c9(0x19d))||_0xb2a345[_0x51d7c9(0x171)][_0x51d7c9(0x181)](_0x51d7c9(0x12c))||_0xb2a345[_0x51d7c9(0x171)]['startsWith'](_0x51d7c9(0x14f))){if(!bcrypt[_0x51d7c9(0x176)](_0x3c6558,_0xb2a345[_0x51d7c9(0x171)]))throw new common_1[(_0x51d7c9(0x161))](_0x51d7c9(0x120),common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);}else{console[_0x51d7c9(0x174)](_0x51d7c9(0x197));const _0x656882=crypto[_0x51d7c9(0x1a6)](_0x51d7c9(0x166))[_0x51d7c9(0x132)](_0x3c6558)[_0x51d7c9(0x17c)]('hex');console['log'](_0x51d7c9(0x197),_0x656882);if(_0x656882!==_0xb2a345[_0x51d7c9(0x171)])throw new common_1[(_0x51d7c9(0x161))]('当前密码错误!',common_1[_0x51d7c9(0x18d)][_0x51d7c9(0x127)]);}}if(!_0xb2a345)throw new common_1[(_0x51d7c9(0x161))]('当前账户不存在!',common_1[_0x51d7c9(0x18d)]['BAD_REQUEST']);if(_0xb2a345[_0x51d7c9(0x123)]!==user_constant_1[_0x51d7c9(0x12a)][_0x51d7c9(0x16f)])throw new common_1['HttpException'](user_constant_1[_0x51d7c9(0x187)][_0xb2a345[_0x51d7c9(0x123)]],common_1['HttpStatus'][_0x51d7c9(0x127)]);return _0xb2a345;}async[_0x31de8c(0x106)](_0x4e8c17,_0x2e089f){const _0x5f0833=_0x31de8c,_0x44f48d=await this[_0x5f0833(0x110)][_0x5f0833(0x16e)]({'where':{'id':_0x4e8c17}});if(_0x44f48d[_0x5f0833(0x171)][_0x5f0833(0x181)](_0x5f0833(0x19d))||_0x44f48d[_0x5f0833(0x171)]['startsWith']('$2b$')||_0x44f48d[_0x5f0833(0x171)][_0x5f0833(0x181)]('$2y$'))return bcrypt['compareSync'](_0x2e089f,_0x44f48d[_0x5f0833(0x171)]);else{const _0x70da04=crypto[_0x5f0833(0x1a6)](_0x5f0833(0x166))['update'](_0x2e089f)[_0x5f0833(0x17c)](_0x5f0833(0x178));return console[_0x5f0833(0x174)](_0x5f0833(0x197),_0x70da04),_0x70da04===_0x44f48d[_0x5f0833(0x171)];}}async[_0x31de8c(0xfd)](_0x33ed7d,_0x4fd3d7){const _0x413235=_0x31de8c,_0x49344a=await this[_0x413235(0x110)]['update']({'id':_0x33ed7d},{'status':_0x4fd3d7});return _0x49344a[_0x413235(0x16d)]>0x0;}async[_0x31de8c(0xfc)](_0x37c54e){const _0x483eb2=_0x31de8c,_0x5999f1=await this[_0x483eb2(0x110)]['findOne']({'where':{'id':_0x37c54e}});return _0x5999f1['status'];}async[_0x31de8c(0x121)](_0x128a45){const _0x21c42e=_0x31de8c;return await this[_0x21c42e(0x110)][_0x21c42e(0x16e)]({'where':{'id':_0x128a45}});}async[_0x31de8c(0x115)](_0x3e7d9e){const _0x115526=_0x31de8c;return await this[_0x115526(0x110)][_0x115526(0x16e)]({'where':{'id':_0x3e7d9e}});}async[_0x31de8c(0x12f)](_0x53f41b){const _0x2e7b21=_0x31de8c,{id:_0x164107,role:_0x4d7cfb}=_0x53f41b;if(_0x4d7cfb===_0x2e7b21(0x136))return!![];const _0x410977=await this[_0x2e7b21(0x110)]['findOne']({'where':{'id':_0x164107}});if(!_0x410977)throw new common_1[(_0x2e7b21(0x161))](_0x2e7b21(0x19c),common_1['HttpStatus'][_0x2e7b21(0x14d)]);if(_0x410977['status']===user_constant_1[_0x2e7b21(0x12a)][_0x2e7b21(0x177)])throw new common_1[(_0x2e7b21(0x161))](_0x2e7b21(0x111),common_1['HttpStatus'][_0x2e7b21(0x127)]);if(_0x410977[_0x2e7b21(0x123)]===user_constant_1[_0x2e7b21(0x12a)][_0x2e7b21(0x169)])throw new common_1[(_0x2e7b21(0x161))]('您的账户已被封禁、如有疑问、请联系管理员!',common_1[_0x2e7b21(0x18d)][_0x2e7b21(0x127)]);}async['getUserInfo'](_0x32f50a){const _0xae1b4f=_0x31de8c,_0x4ed263=await this['userEntity'][_0xae1b4f(0x16e)]({'where':{'id':_0x32f50a},'select':['username',_0xae1b4f(0x15d),_0xae1b4f(0x104),_0xae1b4f(0x125),'sign','inviteCode','openId',_0xae1b4f(0x182)]});if(!_0x4ed263)throw new common_1[(_0xae1b4f(0x161))]('当前用户信息失效、请重新登录!',common_1[_0xae1b4f(0x18d)][_0xae1b4f(0x14d)]);_0x4ed263[_0xae1b4f(0x147)]=!!(_0x4ed263===null||_0x4ed263===void 0x0?void 0x0:_0x4ed263['openId']),delete _0x4ed263[_0xae1b4f(0x146)];const _0x455326=await this['userBalanceService'][_0xae1b4f(0x14c)](_0x32f50a);return{'userInfo':_0x4ed263,'userBalance':Object[_0xae1b4f(0x15a)]({},_0x455326)};}async[_0x31de8c(0xf5)](_0x2d770d){const _0x20191a=_0x31de8c;return await this['userEntity'][_0x20191a(0x16e)]({'where':{'id':_0x2d770d}});}async[_0x31de8c(0x135)](_0x3f2c1d){const _0x3fcab9=_0x31de8c;return await this[_0x3fcab9(0x110)]['findOne']({'where':{'openId':_0x3f2c1d}});}async[_0x31de8c(0x186)](_0x443eaa,_0x19051c){const _0x279b78=_0x31de8c,{id:_0xc08218}=_0x19051c[_0x279b78(0x11d)],_0x318751=await this[_0x279b78(0x110)]['findOne']({'where':{'id':_0xc08218}});if(!_0x318751)throw new common_1[(_0x279b78(0x161))](_0x279b78(0x167),common_1[_0x279b78(0x18d)]['BAD_REQUEST']);if(_0x443eaa[_0x279b78(0x190)]&&_0x318751[_0x279b78(0x190)]===_0x443eaa[_0x279b78(0x190)])throw new common_1['HttpException'](_0x279b78(0x18f),common_1[_0x279b78(0x18d)]['BAD_REQUEST']);if(_0x443eaa[_0x279b78(0x190)]){const _0x5e7a5=await this[_0x279b78(0x110)]['findOne']({'where':{'username':_0x443eaa['username'],'id':(0x0,typeorm_2[_0x279b78(0x172)])(_0xc08218)}});if(_0x5e7a5)throw new common_1[(_0x279b78(0x161))]('用户名已存在!',common_1['HttpStatus'][_0x279b78(0x127)]);}const _0x471da8=await this[_0x279b78(0x110)][_0x279b78(0x132)]({'id':_0xc08218},_0x443eaa);if(_0x471da8[_0x279b78(0x16d)]<=0x0)throw new common_1[(_0x279b78(0x161))](_0x279b78(0x1a1),common_1[_0x279b78(0x18d)][_0x279b78(0x127)]);return _0x279b78(0x142);}async['updateUserPassword'](_0x446946,_0x979505){const _0x4dde94=_0x31de8c,_0x3a8bf1=bcrypt[_0x4dde94(0x194)](_0x979505,0xa),_0x5cb9c2=await this[_0x4dde94(0x110)]['update']({'id':_0x446946},{'password':_0x3a8bf1});if(_0x5cb9c2[_0x4dde94(0x16d)]<=0x0)throw new common_1[(_0x4dde94(0x161))]('修改密码失败、请重新试试吧。',common_1[_0x4dde94(0x18d)][_0x4dde94(0x127)]);}async[_0x31de8c(0x16a)](_0x3e3f6e){const _0x54899b=_0x31de8c,{id:_0x5ed27f}=_0x3e3f6e[_0x54899b(0x11d)],_0x260087=await this[_0x54899b(0x110)][_0x54899b(0x16e)]({'where':{'id':_0x5ed27f}});if(!_0x260087||_0x260087[_0x54899b(0x16c)])throw new common_1[(_0x54899b(0x161))](_0x54899b(0x18b),common_1[_0x54899b(0x18d)][_0x54899b(0x127)]);const _0x12bf8c=(0x0,utils_1[_0x54899b(0x126)])(),_0x5eae55=await this[_0x54899b(0x110)][_0x54899b(0x16e)]({'where':{'inviteCode':_0x12bf8c}});if(_0x5eae55)throw new common_1['HttpException'](_0x54899b(0x10a),common_1[_0x54899b(0x18d)][_0x54899b(0x127)]);const _0x237c5e=await this[_0x54899b(0x110)][_0x54899b(0x132)]({'id':_0x5ed27f},{'inviteCode':_0x12bf8c});if(_0x237c5e[_0x54899b(0x16d)]<=0x0)throw new common_1[(_0x54899b(0x161))](_0x54899b(0x10a),common_1[_0x54899b(0x18d)][_0x54899b(0x127)]);return _0x12bf8c;}async[_0x31de8c(0x10c)](_0x2dd6db,_0x4b914c){const _0x219b42=_0x31de8c;try{const {id:_0x5736b2}=_0x2dd6db[_0x219b42(0x11d)],{page:page=0x1,size:size=0xa}=_0x4b914c,_0x3277d6=await this[_0x219b42(0x110)][_0x219b42(0x16e)]({'where':{'id':_0x5736b2}}),{inviteCode:_0x408479}=_0x3277d6;if(!_0x408479)return[];const [_0x43a38b,_0x2bced6]=await this[_0x219b42(0x110)][_0x219b42(0x199)]({'where':{'inviteCode':_0x408479},'order':{'id':_0x219b42(0x10d)},'select':[_0x219b42(0x190),_0x219b42(0x125),_0x219b42(0x124),_0x219b42(0x123),_0x219b42(0x15d)],'take':size,'skip':(page-0x1)*size});return(0x0,utils_1[_0x219b42(0x158)])(_0x43a38b)[_0x219b42(0x145)](_0x232277=>{const _0x3e63bb=_0x219b42;return _0x232277[_0x3e63bb(0x125)]=(0x0,utils_1[_0x3e63bb(0x184)])(_0x232277[_0x3e63bb(0x125)]),_0x232277;}),{'rows':_0x43a38b,'count':_0x2bced6};}catch(_0x3051fd){console[_0x219b42(0x174)](_0x219b42(0x189),_0x3051fd);throw new common_1['HttpException']('获取邀请记录失败!',common_1['HttpStatus'][_0x219b42(0x127)]);}}async[_0x31de8c(0x12e)](_0x5d7356){const _0x25d542=_0x31de8c,_0x5f2fdc=await this['userEntity'][_0x25d542(0x16e)]({'where':{'inviteCode':_0x5d7356}});if(!_0x5f2fdc)return 0x1;const {inviteLinkCount:inviteLinkCount=0x0}=_0x5f2fdc,_0x300aa4=await this[_0x25d542(0x110)][_0x25d542(0x132)]({'inviteCode':_0x5d7356},{'inviteLinkCount':inviteLinkCount+0x1});return _0x300aa4[_0x25d542(0x16d)]?0x1:0x0;}async['qureyUserInfoByInviteCode'](_0x500515){const _0x27e71e=_0x31de8c;return await this[_0x27e71e(0x110)][_0x27e71e(0x16e)]({'where':{'inviteCode':_0x500515}});}async[_0x31de8c(0xf8)](_0x2fcb9d){const _0x3a19d0=_0x31de8c,{userId:_0x1a1663,model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0}=_0x2fcb9d;await this['userBalanceService'][_0x3a19d0(0x157)](_0x1a1663,{'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount});const _0x326a2f=await this['userBalanceService'][_0x3a19d0(0x116)]({'userId':_0x1a1663,'rechargeType':balance_constant_1[_0x3a19d0(0x105)][_0x3a19d0(0x19b)],'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount,'extent':''});return _0x326a2f;}async[_0x31de8c(0x19f)](_0x39d743,_0x5e7645){const _0x27d352=_0x31de8c,{page:page=0x1,size:size=0xa,username:_0x4ba2ba,email:_0x1eb22d,status:_0x5b1379,keyword:_0x93b1d8,phone:_0x56a4b4}=_0x39d743;let _0x91633e={};_0x4ba2ba&&Object[_0x27d352(0x15a)](_0x91633e,{'username':(0x0,typeorm_2[_0x27d352(0x131)])('%'+_0x4ba2ba+'%')}),_0x1eb22d&&Object[_0x27d352(0x15a)](_0x91633e,{'email':(0x0,typeorm_2[_0x27d352(0x131)])('%'+_0x1eb22d+'%')}),_0x56a4b4&&Object[_0x27d352(0x15a)](_0x91633e,{'phone':(0x0,typeorm_2[_0x27d352(0x131)])('%'+_0x56a4b4+'%')}),_0x5b1379&&Object[_0x27d352(0x15a)](_0x91633e,{'status':_0x5b1379});_0x93b1d8&&(_0x91633e=[{'username':(0x0,typeorm_2[_0x27d352(0x131)])('%'+_0x93b1d8+'%')},{'email':(0x0,typeorm_2['Like'])('%'+_0x93b1d8+'%')},{'phone':(0x0,typeorm_2['Like'])('%'+_0x93b1d8+'%')}]);const [_0x1095f1,_0x1174e2]=await this[_0x27d352(0x110)][_0x27d352(0x199)]({'skip':(page-0x1)*size,'where':_0x91633e,'take':size,'order':{'createdAt':_0x27d352(0x10d)},'cache':!![],'select':[_0x27d352(0x190),_0x27d352(0x15d),_0x27d352(0x16c),_0x27d352(0x104),_0x27d352(0x13e),_0x27d352(0x123),'id',_0x27d352(0x125),'createdAt',_0x27d352(0xfb),_0x27d352(0x103)]}),_0x1f29e9=_0x1095f1[_0x27d352(0x145)](_0x333f52=>_0x333f52['id']),_0x2ebd77=await this[_0x27d352(0x155)][_0x27d352(0x1a3)](_0x1f29e9);return _0x1095f1[_0x27d352(0x107)](_0x5a3c2b=>_0x5a3c2b[_0x27d352(0x13d)]=_0x2ebd77['find'](_0x44b763=>_0x44b763['userId']===_0x5a3c2b['id'])),_0x5e7645[_0x27d352(0x11d)][_0x27d352(0x104)]!==_0x27d352(0x1a4)&&_0x1095f1['forEach'](_0x51b5d8=>_0x51b5d8['email']=(0x0,utils_1['maskEmail'])(_0x51b5d8[_0x27d352(0x125)])),_0x5e7645[_0x27d352(0x11d)][_0x27d352(0x104)]!==_0x27d352(0x1a4)&&_0x1095f1[_0x27d352(0x107)](_0x2d84e0=>_0x2d84e0[_0x27d352(0xfb)]=(0x0,utils_1[_0x27d352(0x14b)])(_0x2d84e0[_0x27d352(0xfb)])),_0x5e7645[_0x27d352(0x11d)][_0x27d352(0x104)]!=='super'&&_0x1095f1['forEach'](_0x18ba3a=>_0x18ba3a['phone']=(0x0,utils_1[_0x27d352(0x14b)])(_0x18ba3a[_0x27d352(0x103)])),{'rows':_0x1095f1,'count':_0x1174e2};}async[_0x31de8c(0x14e)]({id:_0x14c8b0}){const _0x5c2699=_0x31de8c;return await this[_0x5c2699(0x110)]['findOne']({'where':{'id':_0x14c8b0},'select':[_0x5c2699(0x190),'avatar',_0x5c2699(0x16c),_0x5c2699(0x104),_0x5c2699(0x13e),'status']});}async[_0x31de8c(0x133)](_0x426c3d){const _0x2028a9=_0x31de8c,{id:_0x150ffd,status:_0x76710c}=_0x426c3d,_0x3c5ea1=await this['userEntity'][_0x2028a9(0x16e)]({'where':{'id':_0x150ffd}});if(!_0x3c5ea1)throw new common_1['HttpException']('用户不存在!',common_1['HttpStatus'][_0x2028a9(0x127)]);if(_0x3c5ea1[_0x2028a9(0x104)]==='super')throw new common_1[(_0x2028a9(0x161))]('超级管理员不可被操作!',common_1[_0x2028a9(0x18d)]['BAD_REQUEST']);if(_0x3c5ea1[_0x2028a9(0x123)]===user_constant_1['UserStatusEnum'][_0x2028a9(0x153)])throw new common_1['HttpException'](_0x2028a9(0x15f),common_1[_0x2028a9(0x18d)][_0x2028a9(0x127)]);if(_0x3c5ea1[_0x2028a9(0x104)]===_0x2028a9(0x1a4))throw new common_1[(_0x2028a9(0x161))](_0x2028a9(0x18e),common_1[_0x2028a9(0x18d)][_0x2028a9(0x127)]);if(_0x76710c===user_constant_1['UserStatusEnum']['PENDING'])throw new common_1[(_0x2028a9(0x161))](_0x2028a9(0x15e),common_1[_0x2028a9(0x18d)][_0x2028a9(0x127)]);const _0x59aa86=await this['userEntity']['update']({'id':_0x150ffd},{'status':_0x76710c});if(_0x59aa86[_0x2028a9(0x16d)]<=0x0)throw new common_1[(_0x2028a9(0x161))](_0x2028a9(0x162),common_1[_0x2028a9(0x18d)][_0x2028a9(0x127)]);return _0x2028a9(0x149);}async[_0x31de8c(0x180)](_0x23e92d){const _0x35b95e=_0x31de8c,{id:_0x33da18}=_0x23e92d,_0x39b274=await this['userEntity'][_0x35b95e(0x16e)]({'where':{'id':_0x33da18}});if(!_0x39b274)throw new common_1['HttpException'](_0x35b95e(0x119),common_1[_0x35b95e(0x18d)][_0x35b95e(0x127)]);const _0xd3cb31=_0x35b95e(0x140),_0x1efd2a=bcrypt[_0x35b95e(0x194)](_0xd3cb31,0xa),_0x261e15=await this[_0x35b95e(0x110)][_0x35b95e(0x132)]({'id':_0x33da18},{'password':_0x1efd2a});if(_0x261e15['affected']<=0x0)throw new common_1[(_0x35b95e(0x161))]('重置密码失败!',common_1[_0x35b95e(0x18d)][_0x35b95e(0x127)]);return _0x35b95e(0x15b)+_0xd3cb31+_0x35b95e(0x112);}async[_0x31de8c(0x11c)](_0x17941b,_0x174e78){const _0x4e5ac9=_0x31de8c;return await this[_0x4e5ac9(0x110)]['update']({'id':_0x17941b},{'lastLoginIp':_0x174e78});}async['getUserFromOpenId'](_0x89762c,_0x4c7a8c){const _0x1bede0=_0x31de8c,_0x34d072=await this[_0x1bede0(0x110)]['findOne']({'where':{'openId':_0x89762c}});if(!_0x34d072){const _0xebcc01=_0x4c7a8c?_0x4c7a8c[_0x1bede0(0x185)](':')[0x1]:'',_0x1b0780=await this['qureyUserInfoByInviteCode'](_0xebcc01),_0x523a45=await this[_0x1bede0(0x10f)](_0x89762c,_0xebcc01);return await this[_0x1bede0(0x155)][_0x1bede0(0x114)](_0x523a45['id'],_0xebcc01?_0x1b0780===null||_0x1b0780===void 0x0?void 0x0:_0x1b0780['id']:null),_0x523a45;}return _0x34d072;}async['createUserFromOpenId'](_0x50b7e4,_0x5a36f5){const _0x5b8c7a=_0x31de8c,_0x501945=await this[_0x5b8c7a(0x130)][_0x5b8c7a(0x196)]([_0x5b8c7a(0x15c)]),_0x34df01={'avatar':_0x501945,'username':'用户'+(0x0,utils_1[_0x5b8c7a(0x128)])(),'status':user_constant_1[_0x5b8c7a(0x12a)][_0x5b8c7a(0x16f)],'sex':0x0,'email':(0x0,utils_1[_0x5b8c7a(0x128)])()+_0x5b8c7a(0x19e),'invitedBy':_0x5a36f5,'openId':_0x50b7e4},_0x37097d=await this[_0x5b8c7a(0x110)][_0x5b8c7a(0x1a2)](_0x34df01);return _0x37097d;}async[_0x31de8c(0x160)](_0x51ebec,_0x4c0d0e){const _0x96cae6=_0x31de8c;try{const _0x2d19bc=await this[_0x96cae6(0x110)][_0x96cae6(0x16e)]({'where':{'id':_0x4c0d0e}});if(!_0x2d19bc)return{'status':![],'msg':_0x96cae6(0x134)};const _0x26c78b=await this[_0x96cae6(0x110)][_0x96cae6(0x16e)]({'where':{'openId':_0x51ebec}});if(_0x26c78b)return{'status':![],'msg':_0x96cae6(0x14a)};const _0x53dac0=await this[_0x96cae6(0x110)][_0x96cae6(0x132)]({'id':_0x4c0d0e},{'openId':_0x51ebec});if(_0x53dac0[_0x96cae6(0x16d)]<=0x0)return{'status':![],'msg':_0x96cae6(0x122)};return{'status':!![],'msg':'恭喜您绑定成功、后续可直接扫码登录了!'};}catch(_0x45be95){return{'status':![],'msg':_0x96cae6(0x122)};}}async['getOpenIdByUserId'](_0x160b98){const _0x1891fb=_0x31de8c,_0x483b7c=await this[_0x1891fb(0x110)]['findOne']({'where':{'id':_0x160b98}});return _0x483b7c===null||_0x483b7c===void 0x0?void 0x0:_0x483b7c['openId'];}async[_0x31de8c(0x148)](_0x2495ce){const _0x1ac934=_0x31de8c,{username:_0x1656f6,password:_0x4529c4,phone:_0x4d34a8,phoneCode:_0x2cf050}=_0x2495ce,_0xc7cc9c=await this[_0x1ac934(0x110)][_0x1ac934(0x16e)]({'where':[{'username':_0x1656f6},{'phone':_0x4d34a8}]});if(_0xc7cc9c&&_0xc7cc9c[_0x1ac934(0x190)]===_0x1656f6)throw new common_1[(_0x1ac934(0x161))]('用户名已存在、请更换用户名!',common_1['HttpStatus'][_0x1ac934(0x127)]);if(_0xc7cc9c&&_0xc7cc9c['phone']===_0x4d34a8)throw new common_1[(_0x1ac934(0x161))](_0x1ac934(0x154),common_1[_0x1ac934(0x18d)][_0x1ac934(0x127)]);}async[_0x31de8c(0x175)](_0x2afdbb){const _0x33df8f=_0x31de8c;return await this[_0x33df8f(0x110)][_0x33df8f(0x1a2)](_0x2afdbb);}};UserService=__decorate([(0x0,common_1['Injectable'])(),__param(0x0,(0x0,typeorm_1[_0x31de8c(0x17b)])(user_entity_1[_0x31de8c(0x17d)])),__param(0x1,(0x0,typeorm_1[_0x31de8c(0x17b)])(whiteList_entity_1['WhiteListEntity'])),__param(0x7,(0x0,typeorm_1[_0x31de8c(0x17b)])(config_entity_1[_0x31de8c(0x170)])),__metadata(_0x31de8c(0xfa),[typeorm_2[_0x31de8c(0x17f)],typeorm_2[_0x31de8c(0x17f)],typeorm_2[_0x31de8c(0x12d)],verification_service_1[_0x31de8c(0x195)],mailer_1['MailerService'],userBalance_service_1[_0x31de8c(0xff)],globalConfig_service_1[_0x31de8c(0x193)],typeorm_2[_0x31de8c(0x17f)]])],UserService),exports[_0x31de8c(0x144)]=UserService;