'use strict';const _0x548809=_0x5be7;(function(_0x283c4e,_0x447854){const _0xdc652b=_0x5be7,_0x48d1ef=_0x283c4e();while(!![]){try{const _0x3f37d4=-parseInt(_0xdc652b(0x198))/0x1*(-parseInt(_0xdc652b(0x192))/0x2)+-parseInt(_0xdc652b(0x19d))/0x3*(-parseInt(_0xdc652b(0x1d4))/0x4)+parseInt(_0xdc652b(0x1ac))/0x5*(-parseInt(_0xdc652b(0x1e0))/0x6)+parseInt(_0xdc652b(0x1ea))/0x7*(parseInt(_0xdc652b(0x1bc))/0x8)+-parseInt(_0xdc652b(0x1c5))/0x9*(-parseInt(_0xdc652b(0x1a6))/0xa)+parseInt(_0xdc652b(0x1da))/0xb*(-parseInt(_0xdc652b(0x19e))/0xc)+-parseInt(_0xdc652b(0x1b5))/0xd;if(_0x3f37d4===_0x447854)break;else _0x48d1ef['push'](_0x48d1ef['shift']());}catch(_0x235682){_0x48d1ef['push'](_0x48d1ef['shift']());}}}(_0x42c6,0xc0707));function _0x42c6(){const _0x4c0f85=['912306NiZHZL','useCrami','delPackage','../user/user.entity','createPackage','3Tkkgel','2124pSEgdN','./crami.entity','DESC','packageId','push','LessThanOrEqual','updatePackage','save','4067510LFosRS','当前套餐不存在、请确认您选择的套餐是否存在!','InjectRepository','../userBalance/userBalance.service','error:\x20','Not','659455HsBvSs','更新套餐失败、请重试!','自定义卡密必须至少一项余额不为0️零!','当前套餐不存在、请检查你的输入参数!','../../common/utils','./cramiPackage.entity','CramiPackageEntity','maskEmail','length','22384115cbmMKC','assign','object','当前卡密不存在、请确认您要删除的卡密是否存在!','RechargeType','__decorate','maskCrami','520ZHAkGY','删除卡密失败、请重试!','generateCrami','UserEntity','defineProperty','findOne','当前套餐下存在卡密、请先删除卡密后才可删除套餐!','status','CramiService','18ZKLjkC','createCrami','map','packageName','CramiEntity','userBalanceService','__param','Injectable','code','当前卡密已被使用、请确认您输入的卡密是否正确!','BAD_REQUEST','saveRecordRechargeLog','delete','update','__metadata','3980628nvoVSl','getOwnPropertyDescriptor','name','function','@nestjs/common','queryOnePackage','64779tbndli','generateCramiCode','PACKAGE_GIFT','delCrami','addBalanceToUser','MoreThan','6SYWTpF','role','HttpException','super','HttpStatus','email','当前卡密已被使用、已使用的卡密禁止删除!','metadata','forEach','套餐名称或套餐等级重复、请检查!','103747AMYqNP','Repository','find','../../common/constants/balance.constant','queryAllCrami','cramiPackageEntity','user','log','batchDelCrami','当前卡密不存在、请确认您输入的卡密是否正确!','2ViVLKm','username','cramiEntity','useId','count','decorate'];_0x42c6=function(){return _0x4c0f85;};return _0x42c6();}function _0x5be7(_0x5d2e81,_0x1e3b63){const _0x42c6aa=_0x42c6();return _0x5be7=function(_0x5be769,_0x5f0875){_0x5be769=_0x5be769-0x191;let _0x113bc3=_0x42c6aa[_0x5be769];return _0x113bc3;},_0x5be7(_0x5d2e81,_0x1e3b63);}var __decorate=this&&this[_0x548809(0x1ba)]||function(_0x37ed3a,_0x436db1,_0xdaa1cd,_0x1e9037){const _0x23e232=_0x548809;var _0x5b7e56=arguments[_0x23e232(0x1b4)],_0x4cfa77=_0x5b7e56<0x3?_0x436db1:_0x1e9037===null?_0x1e9037=Object[_0x23e232(0x1d5)](_0x436db1,_0xdaa1cd):_0x1e9037,_0xd83979;if(typeof Reflect===_0x23e232(0x1b7)&&typeof Reflect[_0x23e232(0x197)]===_0x23e232(0x1d7))_0x4cfa77=Reflect[_0x23e232(0x197)](_0x37ed3a,_0x436db1,_0xdaa1cd,_0x1e9037);else{for(var _0xd82adf=_0x37ed3a[_0x23e232(0x1b4)]-0x1;_0xd82adf>=0x0;_0xd82adf--)if(_0xd83979=_0x37ed3a[_0xd82adf])_0x4cfa77=(_0x5b7e56<0x3?_0xd83979(_0x4cfa77):_0x5b7e56>0x3?_0xd83979(_0x436db1,_0xdaa1cd,_0x4cfa77):_0xd83979(_0x436db1,_0xdaa1cd))||_0x4cfa77;}return _0x5b7e56>0x3&&_0x4cfa77&&Object['defineProperty'](_0x436db1,_0xdaa1cd,_0x4cfa77),_0x4cfa77;},__metadata=this&&this[_0x548809(0x1d3)]||function(_0xb9f59c,_0x1878f8){const _0x2e9b95=_0x548809;if(typeof Reflect==='object'&&typeof Reflect['metadata']==='function')return Reflect[_0x2e9b95(0x1e7)](_0xb9f59c,_0x1878f8);},__param=this&&this[_0x548809(0x1cb)]||function(_0xb13ec2,_0x40bd35){return function(_0x4f6698,_0x1cad78){_0x40bd35(_0x4f6698,_0x1cad78,_0xb13ec2);};};Object[_0x548809(0x1c0)](exports,'__esModule',{'value':!![]}),exports['CramiService']=void 0x0;const common_1=require(_0x548809(0x1d8)),crami_entity_1=require(_0x548809(0x19f)),typeorm_1=require('@nestjs/typeorm'),typeorm_2=require('typeorm'),cramiPackage_entity_1=require(_0x548809(0x1b1)),utils_1=require(_0x548809(0x1b0)),user_entity_1=require(_0x548809(0x19b)),userBalance_service_1=require(_0x548809(0x1a9)),balance_constant_1=require(_0x548809(0x1ed));let CramiService=class CramiService{constructor(_0x3fe28e,_0x575f40,_0x514076,_0x52fc42){const _0x5716e4=_0x548809;this[_0x5716e4(0x194)]=_0x3fe28e,this[_0x5716e4(0x1ef)]=_0x575f40,this['userEntity']=_0x514076,this[_0x5716e4(0x1ca)]=_0x52fc42;}async[_0x548809(0x1d9)](_0x233f3e){const _0x25c8f5=_0x548809;return await this[_0x25c8f5(0x1ef)][_0x25c8f5(0x1c1)]({'where':{'id':_0x233f3e}});}async['queryAllPackage'](_0x3d83de){const _0x2bd85d=_0x548809;try{const {page:page=0x1,size:size=0xa,name:_0x38ff60,status:_0x1c7aa5,type:_0x22c0a6}=_0x3d83de,_0x362759={};_0x38ff60&&Object[_0x2bd85d(0x1b6)](_0x362759,{'name':(0x0,typeorm_2['Like'])('%'+_0x38ff60+'%')}),_0x1c7aa5&&Object[_0x2bd85d(0x1b6)](_0x362759,{'status':_0x1c7aa5});_0x22c0a6&&(_0x22c0a6>0x0?Object['assign'](_0x362759,{'days':(0x0,typeorm_2[_0x2bd85d(0x1df)])(0x0)}):Object[_0x2bd85d(0x1b6)](_0x362759,{'days':(0x0,typeorm_2[_0x2bd85d(0x1a3)])(0x0)}));const [_0x15e911,_0x320cd3]=await this[_0x2bd85d(0x1ef)]['findAndCount']({'skip':(page-0x1)*size,'take':size,'where':_0x362759,'order':{'order':_0x2bd85d(0x1a0)}});return{'rows':_0x15e911,'count':_0x320cd3};}catch(_0x224d11){console[_0x2bd85d(0x1f1)](_0x2bd85d(0x1aa),_0x224d11);}}async[_0x548809(0x19c)](_0x1a5ab1){const _0x83299b=_0x548809,{name:_0x46f76d,weight:_0x22522b}=_0x1a5ab1,_0x516275=await this[_0x83299b(0x1ef)][_0x83299b(0x1c1)]({'where':[{'name':_0x46f76d},{'weight':_0x22522b}]});if(_0x516275)throw new common_1['HttpException'](_0x83299b(0x1e9),common_1['HttpStatus']['BAD_REQUEST']);try{return await this['cramiPackageEntity']['save'](_0x1a5ab1);}catch(_0x5906dc){console['log']('error:\x20',_0x5906dc);throw new common_1['HttpException'](_0x5906dc,common_1[_0x83299b(0x1e4)][_0x83299b(0x1cf)]);}}async[_0x548809(0x1a4)](_0x4dc33d){const _0x4b1fda=_0x548809,{id:_0xc870d8,name:_0x5c05c8,weight:_0x1a95ed}=_0x4dc33d,_0x25c352=await this[_0x4b1fda(0x1ef)]['findOne']({'where':{'id':_0xc870d8}});if(!_0x25c352)throw new common_1['HttpException'](_0x4b1fda(0x1af),common_1['HttpStatus'][_0x4b1fda(0x1cf)]);const _0x13f704=await this[_0x4b1fda(0x1ef)][_0x4b1fda(0x196)]({'where':[{'name':_0x5c05c8,'id':(0x0,typeorm_2[_0x4b1fda(0x1ab)])(_0xc870d8)},{'weight':_0x1a95ed,'id':(0x0,typeorm_2['Not'])(_0xc870d8)}]});if(_0x13f704)throw new common_1[(_0x4b1fda(0x1e2))](_0x4b1fda(0x1e9),common_1[_0x4b1fda(0x1e4)][_0x4b1fda(0x1cf)]);const _0x425fb3=await this['cramiPackageEntity']['update']({'id':_0xc870d8},_0x4dc33d);if(_0x425fb3['affected']>0x0)return'更新套餐成功!';else throw new common_1[(_0x4b1fda(0x1e2))](_0x4b1fda(0x1ad),common_1[_0x4b1fda(0x1e4)][_0x4b1fda(0x1cf)]);}async[_0x548809(0x19a)](_0x1237f4){const _0x2cdaa7=_0x548809,{id:_0x4b148f}=_0x1237f4,_0x17d64c=await this[_0x2cdaa7(0x194)][_0x2cdaa7(0x196)]({'where':{'packageId':_0x4b148f}});if(_0x17d64c)throw new common_1['HttpException'](_0x2cdaa7(0x1c2),common_1[_0x2cdaa7(0x1e4)][_0x2cdaa7(0x1cf)]);return await this[_0x2cdaa7(0x1ef)][_0x2cdaa7(0x1d1)]({'id':_0x4b148f});}async[_0x548809(0x1c6)](_0x16b863){const _0x3d4a31=_0x548809,{packageId:_0x35fd9f,count:count=0x1}=_0x16b863;if(_0x35fd9f){const _0x51ba6a=await this[_0x3d4a31(0x1ef)][_0x3d4a31(0x1c1)]({'where':{'id':_0x35fd9f}});if(!_0x51ba6a)throw new common_1[(_0x3d4a31(0x1e2))](_0x3d4a31(0x1a7),common_1['HttpStatus'][_0x3d4a31(0x1cf)]);const {days:days=-0x1,model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0}=_0x51ba6a,_0x59b94b={'packageId':_0x35fd9f,'days':days,'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount};return await this[_0x3d4a31(0x1be)](_0x59b94b,count);}if(!_0x35fd9f){const {model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0}=_0x16b863;if([model3Count,model4Count,drawMjCount]['every'](_0x28dfd6=>!_0x28dfd6))throw new common_1['HttpException'](_0x3d4a31(0x1ae),common_1['HttpStatus'][_0x3d4a31(0x1cf)]);const _0xb4b9d1={'days':-0x1,'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount};return await this['generateCrami'](_0xb4b9d1,count);}}async[_0x548809(0x1be)](_0x52f3c3,_0x1eff83){const _0x29281f=_0x548809,_0x27896a=[];for(let _0x2081c5=0x0;_0x2081c5<_0x1eff83;_0x2081c5++){const _0x1b5e0a=(0x0,utils_1[_0x29281f(0x1db)])(),_0x4f64bf=this[_0x29281f(0x194)]['create'](Object['assign'](Object['assign']({},_0x52f3c3),{'code':_0x1b5e0a}));_0x27896a[_0x29281f(0x1a2)](_0x4f64bf);}return await this['cramiEntity'][_0x29281f(0x1a5)](_0x27896a);}async[_0x548809(0x199)](_0x1e7264,_0x3f4f58){const _0xb3a19d=_0x548809,{id:_0x63fb27}=_0x1e7264[_0xb3a19d(0x1f0)],_0x4ad27d=await this[_0xb3a19d(0x194)]['findOne']({'where':{'code':_0x3f4f58[_0xb3a19d(0x1cd)]}});if(!_0x4ad27d)throw new common_1[(_0xb3a19d(0x1e2))](_0xb3a19d(0x191),common_1[_0xb3a19d(0x1e4)]['BAD_REQUEST']);const {status:_0x14f3c0,days:days=-0x1,model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0,packageId:_0xec01af}=_0x4ad27d;if(_0x14f3c0===0x1)throw new common_1[(_0xb3a19d(0x1e2))](_0xb3a19d(0x1ce),common_1['HttpStatus'][_0xb3a19d(0x1cf)]);const _0x473a35={'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount,'packageId':_0xec01af};return await this['userBalanceService'][_0xb3a19d(0x1de)](_0x63fb27,Object['assign']({},_0x473a35),days),await this[_0xb3a19d(0x1ca)][_0xb3a19d(0x1d0)]({'userId':_0x63fb27,'rechargeType':balance_constant_1[_0xb3a19d(0x1b9)][_0xb3a19d(0x1dc)],'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount,'days':days}),await this[_0xb3a19d(0x194)][_0xb3a19d(0x1d2)]({'code':_0x3f4f58['code']},{'useId':_0x63fb27,'status':0x1}),'使用卡密成功';}async[_0x548809(0x1ee)](_0x593b2d,_0x1ab061){const _0x954235=_0x548809,{page:page=0x1,size:size=0xa,status:_0xeac7d4,useId:_0x59b8eb}=_0x593b2d,_0x216778={};_0xeac7d4&&Object[_0x954235(0x1b6)](_0x216778,{'status':_0xeac7d4}),_0x59b8eb&&Object[_0x954235(0x1b6)](_0x216778,{'useId':_0x59b8eb});const [_0x208f5a,_0x4dc9d3]=await this[_0x954235(0x194)]['findAndCount']({'skip':(page-0x1)*size,'take':size,'order':{'createdAt':_0x954235(0x1a0)},'where':_0x216778}),_0x4b9f3f=_0x208f5a[_0x954235(0x1c7)](_0x26262d=>_0x26262d[_0x954235(0x195)]),_0xec3997=_0x208f5a[_0x954235(0x1c7)](_0x2a36f4=>_0x2a36f4[_0x954235(0x1a1)]),_0x41771d=await this['userEntity'][_0x954235(0x1ec)]({'where':{'id':(0x0,typeorm_2['In'])(_0x4b9f3f)}}),_0x4fe3f4=await this[_0x954235(0x1ef)][_0x954235(0x1ec)]({'where':{'id':(0x0,typeorm_2['In'])(_0xec3997)}});return _0x208f5a[_0x954235(0x1e8)](_0x2b3c98=>{const _0x215f55=_0x954235;var _0x17956d,_0x240f18,_0x1a116f;_0x2b3c98[_0x215f55(0x193)]=(_0x17956d=_0x41771d[_0x215f55(0x1ec)](_0x53557a=>_0x53557a['id']===_0x2b3c98[_0x215f55(0x195)]))===null||_0x17956d===void 0x0?void 0x0:_0x17956d[_0x215f55(0x193)],_0x2b3c98[_0x215f55(0x1e5)]=(_0x240f18=_0x41771d['find'](_0x55a4f5=>_0x55a4f5['id']===_0x2b3c98[_0x215f55(0x195)]))===null||_0x240f18===void 0x0?void 0x0:_0x240f18[_0x215f55(0x1e5)],_0x2b3c98[_0x215f55(0x1c8)]=(_0x1a116f=_0x4fe3f4[_0x215f55(0x1ec)](_0x1c86a8=>_0x1c86a8['id']===_0x2b3c98[_0x215f55(0x1a1)]))===null||_0x1a116f===void 0x0?void 0x0:_0x1a116f[_0x215f55(0x1d6)];}),_0x1ab061['user']['role']!==_0x954235(0x1e3)&&_0x208f5a['forEach'](_0x5bc591=>_0x5bc591[_0x954235(0x1e5)]=(0x0,utils_1[_0x954235(0x1b3)])(_0x5bc591['email'])),_0x1ab061[_0x954235(0x1f0)][_0x954235(0x1e1)]!==_0x954235(0x1e3)&&_0x208f5a['forEach'](_0x28f1b6=>_0x28f1b6['code']=(0x0,utils_1[_0x954235(0x1bb)])(_0x28f1b6['code'])),{'rows':_0x208f5a,'count':_0x4dc9d3};}async[_0x548809(0x1dd)](_0x5607fd){const _0x18f032=_0x548809,_0x2f6d21=await this[_0x18f032(0x194)][_0x18f032(0x1c1)]({'where':{'id':_0x5607fd}});if(!_0x2f6d21)throw new common_1[(_0x18f032(0x1e2))](_0x18f032(0x1b8),common_1[_0x18f032(0x1e4)]['BAD_REQUEST']);if(_0x2f6d21[_0x18f032(0x1c3)]===0x1)throw new common_1['HttpException'](_0x18f032(0x1e6),common_1[_0x18f032(0x1e4)][_0x18f032(0x1cf)]);return await this[_0x18f032(0x194)]['delete']({'id':_0x5607fd});}async[_0x548809(0x1f2)](_0x2dabff){const _0x5d254d=_0x548809,{ids:_0x1774df}=_0x2dabff,_0x2c370e=await this[_0x5d254d(0x194)][_0x5d254d(0x1d1)](_0x1774df);if(_0x2c370e['affected']>0x0)return'删除卡密成功!';else throw new common_1[(_0x5d254d(0x1e2))](_0x5d254d(0x1bd),common_1[_0x5d254d(0x1e4)][_0x5d254d(0x1cf)]);}};CramiService=__decorate([(0x0,common_1[_0x548809(0x1cc)])(),__param(0x0,(0x0,typeorm_1['InjectRepository'])(crami_entity_1[_0x548809(0x1c9)])),__param(0x1,(0x0,typeorm_1[_0x548809(0x1a8)])(cramiPackage_entity_1[_0x548809(0x1b2)])),__param(0x2,(0x0,typeorm_1[_0x548809(0x1a8)])(user_entity_1[_0x548809(0x1bf)])),__metadata('design:paramtypes',[typeorm_2[_0x548809(0x1eb)],typeorm_2['Repository'],typeorm_2[_0x548809(0x1eb)],userBalance_service_1['UserBalanceService']])],CramiService),exports[_0x548809(0x1c4)]=CramiService;