mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-27 05:36:40 +08:00
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
'use strict';const _0x40e1d6=_0x5d8f;(function(_0xdcb614,_0x197d1d){const _0x10c800=_0x5d8f,_0x11bfcc=_0xdcb614();while(!![]){try{const _0x4d8bee=-parseInt(_0x10c800(0x96))/0x1+parseInt(_0x10c800(0xda))/0x2+parseInt(_0x10c800(0xeb))/0x3*(parseInt(_0x10c800(0xe1))/0x4)+parseInt(_0x10c800(0xd6))/0x5+-parseInt(_0x10c800(0xc7))/0x6+parseInt(_0x10c800(0xa1))/0x7+-parseInt(_0x10c800(0xdd))/0x8*(-parseInt(_0x10c800(0x8f))/0x9);if(_0x4d8bee===_0x197d1d)break;else _0x11bfcc['push'](_0x11bfcc['shift']());}catch(_0x1e1336){_0x11bfcc['push'](_0x11bfcc['shift']());}}}(_0x5e4d,0xc465c));function _0x5e4d(){const _0x6c4ae1=['super','4280490lEhGdB','userBalanceService','username','自定义卡密必须至少一项余额不为0️零!','717958BOgLMs','getOwnPropertyDescriptor','PACKAGE_GIFT','8fVNSqD','createCrami','使用卡密成功','当前套餐不存在、请检查你的输入参数!','208700CsBWzp','update','./cramiPackage.entity','find','findAndCount','user','./crami.entity','addBalanceToUser','design:paramtypes','queryAllPackage','3YxiNuU','delCrami','queryAllCrami','createPackage','delPackage','push','useId','MoreThan','7215219WGUtaZ','LessThanOrEqual','__param','Like','cramiPackageEntity','map','CramiPackageEntity','1130470fmjKAu','套餐名称或套餐等级重复、请检查!','generateCrami','Not','../../common/utils','assign','code','当前卡密已被使用、请确认您输入的卡密是否正确!','function','metadata','decorate','9133887eHgSwL','HttpStatus','batchDelCrami','Repository','当前卡密不存在、请确认您输入的卡密是否正确!','object','updatePackage','findOne','role','DESC','email','../../common/constants/balance.constant','typeorm','maskCrami','queryOnePackage','every','save','删除卡密失败、请重试!','packageName','generateCramiCode','../user/user.entity','delete','Injectable','error:\x20','length','log','当前套餐不存在、请确认您选择的套餐是否存在!','packageId','create','RechargeType','forEach','defineProperty','BAD_REQUEST','当前套餐下存在卡密、请先删除卡密后才可删除套餐!','更新套餐失败、请重试!','HttpException','当前卡密已被使用、已使用的卡密禁止删除!','更新套餐成功!','8633220TVWLSc','@nestjs/typeorm','CramiService','__esModule','InjectRepository','userEntity','count','__decorate','删除卡密成功!','name','UserEntity','cramiEntity','affected','maskEmail'];_0x5e4d=function(){return _0x6c4ae1;};return _0x5e4d();}var __decorate=this&&this[_0x40e1d6(0xce)]||function(_0x42e3eb,_0xa7f6a1,_0x298af6,_0x2b7f79){const _0xb5ecdd=_0x40e1d6;var _0xb6a696=arguments[_0xb5ecdd(0xb9)],_0x20576d=_0xb6a696<0x3?_0xa7f6a1:_0x2b7f79===null?_0x2b7f79=Object[_0xb5ecdd(0xdb)](_0xa7f6a1,_0x298af6):_0x2b7f79,_0x278064;if(typeof Reflect===_0xb5ecdd(0xa6)&&typeof Reflect['decorate']===_0xb5ecdd(0x9e))_0x20576d=Reflect[_0xb5ecdd(0xa0)](_0x42e3eb,_0xa7f6a1,_0x298af6,_0x2b7f79);else{for(var _0x16cfd6=_0x42e3eb[_0xb5ecdd(0xb9)]-0x1;_0x16cfd6>=0x0;_0x16cfd6--)if(_0x278064=_0x42e3eb[_0x16cfd6])_0x20576d=(_0xb6a696<0x3?_0x278064(_0x20576d):_0xb6a696>0x3?_0x278064(_0xa7f6a1,_0x298af6,_0x20576d):_0x278064(_0xa7f6a1,_0x298af6))||_0x20576d;}return _0xb6a696>0x3&&_0x20576d&&Object['defineProperty'](_0xa7f6a1,_0x298af6,_0x20576d),_0x20576d;},__metadata=this&&this['__metadata']||function(_0x36780a,_0x563e55){const _0x5139fb=_0x40e1d6;if(typeof Reflect===_0x5139fb(0xa6)&&typeof Reflect[_0x5139fb(0x9f)]===_0x5139fb(0x9e))return Reflect[_0x5139fb(0x9f)](_0x36780a,_0x563e55);},__param=this&&this[_0x40e1d6(0x91)]||function(_0x29a9c0,_0x12ba61){return function(_0x49a8d4,_0x3be830){_0x12ba61(_0x49a8d4,_0x3be830,_0x29a9c0);};};function _0x5d8f(_0x8b7e0a,_0x35a847){const _0x5e4d6b=_0x5e4d();return _0x5d8f=function(_0x5d8fad,_0x4967e3){_0x5d8fad=_0x5d8fad-0x8e;let _0x5207d6=_0x5e4d6b[_0x5d8fad];return _0x5207d6;},_0x5d8f(_0x8b7e0a,_0x35a847);}Object[_0x40e1d6(0xc0)](exports,_0x40e1d6(0xca),{'value':!![]}),exports[_0x40e1d6(0xc9)]=void 0x0;const common_1=require('@nestjs/common'),crami_entity_1=require(_0x40e1d6(0xe7)),typeorm_1=require(_0x40e1d6(0xc8)),typeorm_2=require(_0x40e1d6(0xad)),cramiPackage_entity_1=require(_0x40e1d6(0xe3)),utils_1=require(_0x40e1d6(0x9a)),user_entity_1=require(_0x40e1d6(0xb5)),userBalance_service_1=require('../userBalance/userBalance.service'),balance_constant_1=require(_0x40e1d6(0xac));let CramiService=class CramiService{constructor(_0x16c3a8,_0xabc210,_0x111b1a,_0x137939){const _0x353b6a=_0x40e1d6;this[_0x353b6a(0xd2)]=_0x16c3a8,this[_0x353b6a(0x93)]=_0xabc210,this['userEntity']=_0x111b1a,this[_0x353b6a(0xd7)]=_0x137939;}async[_0x40e1d6(0xaf)](_0xc9a8a9){const _0x32c374=_0x40e1d6;return await this[_0x32c374(0x93)][_0x32c374(0xa8)]({'where':{'id':_0xc9a8a9}});}async[_0x40e1d6(0xea)](_0xc82c3c){const _0xba29f4=_0x40e1d6;try{const {page:page=0x1,size:size=0xa,name:_0x4ca68b,status:_0x50851c,type:_0x370478}=_0xc82c3c,_0x270880={};_0x4ca68b&&Object[_0xba29f4(0x9b)](_0x270880,{'name':(0x0,typeorm_2[_0xba29f4(0x92)])('%'+_0x4ca68b+'%')}),_0x50851c&&Object[_0xba29f4(0x9b)](_0x270880,{'status':_0x50851c});_0x370478&&(_0x370478>0x0?Object['assign'](_0x270880,{'days':(0x0,typeorm_2[_0xba29f4(0x8e)])(0x0)}):Object[_0xba29f4(0x9b)](_0x270880,{'days':(0x0,typeorm_2[_0xba29f4(0x90)])(0x0)}));const [_0x4944a2,_0x3d83d1]=await this[_0xba29f4(0x93)][_0xba29f4(0xe5)]({'skip':(page-0x1)*size,'take':size,'where':_0x270880,'order':{'order':_0xba29f4(0xaa)}});return{'rows':_0x4944a2,'count':_0x3d83d1};}catch(_0x5e5c1d){console[_0xba29f4(0xba)](_0xba29f4(0xb8),_0x5e5c1d);}}async[_0x40e1d6(0xee)](_0x29c48f){const _0x42a3a8=_0x40e1d6,{name:_0x364af4,weight:_0x1d159a}=_0x29c48f,_0x12b660=await this[_0x42a3a8(0x93)]['findOne']({'where':[{'name':_0x364af4},{'weight':_0x1d159a}]});if(_0x12b660)throw new common_1[(_0x42a3a8(0xc4))](_0x42a3a8(0x97),common_1[_0x42a3a8(0xa2)][_0x42a3a8(0xc1)]);try{return await this[_0x42a3a8(0x93)]['save'](_0x29c48f);}catch(_0x333658){console['log'](_0x42a3a8(0xb8),_0x333658);throw new common_1[(_0x42a3a8(0xc4))](_0x333658,common_1[_0x42a3a8(0xa2)][_0x42a3a8(0xc1)]);}}async[_0x40e1d6(0xa7)](_0x831885){const _0x3b47b5=_0x40e1d6,{id:_0x4f123c,name:_0x54fe84,weight:_0x1d29b3}=_0x831885,_0x1ee4c5=await this['cramiPackageEntity'][_0x3b47b5(0xa8)]({'where':{'id':_0x4f123c}});if(!_0x1ee4c5)throw new common_1[(_0x3b47b5(0xc4))](_0x3b47b5(0xe0),common_1[_0x3b47b5(0xa2)]['BAD_REQUEST']);const _0x513cb9=await this['cramiPackageEntity'][_0x3b47b5(0xcd)]({'where':[{'name':_0x54fe84,'id':(0x0,typeorm_2[_0x3b47b5(0x99)])(_0x4f123c)},{'weight':_0x1d29b3,'id':(0x0,typeorm_2[_0x3b47b5(0x99)])(_0x4f123c)}]});if(_0x513cb9)throw new common_1[(_0x3b47b5(0xc4))](_0x3b47b5(0x97),common_1[_0x3b47b5(0xa2)][_0x3b47b5(0xc1)]);const _0x323884=await this[_0x3b47b5(0x93)][_0x3b47b5(0xe2)]({'id':_0x4f123c},_0x831885);if(_0x323884[_0x3b47b5(0xd3)]>0x0)return _0x3b47b5(0xc6);else throw new common_1[(_0x3b47b5(0xc4))](_0x3b47b5(0xc3),common_1['HttpStatus']['BAD_REQUEST']);}async[_0x40e1d6(0xef)](_0x5b77f5){const _0x3e618d=_0x40e1d6,{id:_0x348631}=_0x5b77f5,_0x5e4024=await this[_0x3e618d(0xd2)]['count']({'where':{'packageId':_0x348631}});if(_0x5e4024)throw new common_1[(_0x3e618d(0xc4))](_0x3e618d(0xc2),common_1['HttpStatus'][_0x3e618d(0xc1)]);return await this['cramiPackageEntity'][_0x3e618d(0xb6)]({'id':_0x348631});}async[_0x40e1d6(0xde)](_0x4a0011){const _0x515587=_0x40e1d6,{packageId:_0x5c0d4c,count:count=0x1}=_0x4a0011;if(_0x5c0d4c){const _0x49cef2=await this[_0x515587(0x93)]['findOne']({'where':{'id':_0x5c0d4c}});if(!_0x49cef2)throw new common_1[(_0x515587(0xc4))](_0x515587(0xbb),common_1[_0x515587(0xa2)][_0x515587(0xc1)]);const {days:days=-0x1,model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0}=_0x49cef2,_0x1131cb={'packageId':_0x5c0d4c,'days':days,'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount};return await this['generateCrami'](_0x1131cb,count);}if(!_0x5c0d4c){const {model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0}=_0x4a0011;if([model3Count,model4Count,drawMjCount][_0x515587(0xb0)](_0x5f02ee=>!_0x5f02ee))throw new common_1[(_0x515587(0xc4))](_0x515587(0xd9),common_1[_0x515587(0xa2)][_0x515587(0xc1)]);const _0x5a93be={'days':-0x1,'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount};return await this[_0x515587(0x98)](_0x5a93be,count);}}async[_0x40e1d6(0x98)](_0x32df0d,_0x27bba6){const _0x2aa7d9=_0x40e1d6,_0x57e899=[];for(let _0x25cdfa=0x0;_0x25cdfa<_0x27bba6;_0x25cdfa++){const _0x50b44b=(0x0,utils_1[_0x2aa7d9(0xb4)])(),_0x3cb811=this['cramiEntity'][_0x2aa7d9(0xbd)](Object[_0x2aa7d9(0x9b)](Object[_0x2aa7d9(0x9b)]({},_0x32df0d),{'code':_0x50b44b}));_0x57e899[_0x2aa7d9(0xf0)](_0x3cb811);}return await this[_0x2aa7d9(0xd2)][_0x2aa7d9(0xb1)](_0x57e899);}async['useCrami'](_0x1a6d25,_0x2cacef){const _0xff2042=_0x40e1d6,{id:_0x4e5006}=_0x1a6d25[_0xff2042(0xe6)],_0x50d44d=await this[_0xff2042(0xd2)]['findOne']({'where':{'code':_0x2cacef['code']}});if(!_0x50d44d)throw new common_1['HttpException'](_0xff2042(0xa5),common_1[_0xff2042(0xa2)][_0xff2042(0xc1)]);const {status:_0xf4c780,days:days=-0x1,model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0,packageId:_0x1110ae}=_0x50d44d;if(_0xf4c780===0x1)throw new common_1[(_0xff2042(0xc4))](_0xff2042(0x9d),common_1[_0xff2042(0xa2)][_0xff2042(0xc1)]);const _0x392017={'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount,'packageId':_0x1110ae};return await this[_0xff2042(0xd7)][_0xff2042(0xe8)](_0x4e5006,Object[_0xff2042(0x9b)]({},_0x392017),days),await this[_0xff2042(0xd7)]['saveRecordRechargeLog']({'userId':_0x4e5006,'rechargeType':balance_constant_1[_0xff2042(0xbe)][_0xff2042(0xdc)],'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount,'days':days}),await this[_0xff2042(0xd2)]['update']({'code':_0x2cacef[_0xff2042(0x9c)]},{'useId':_0x4e5006,'status':0x1}),_0xff2042(0xdf);}async[_0x40e1d6(0xed)](_0x42fe72,_0x270606){const _0x5e4097=_0x40e1d6,{page:page=0x1,size:size=0xa,status:_0x314dc9,useId:_0x4b8fe4}=_0x42fe72,_0x1cc0ec={};_0x314dc9&&Object[_0x5e4097(0x9b)](_0x1cc0ec,{'status':_0x314dc9}),_0x4b8fe4&&Object[_0x5e4097(0x9b)](_0x1cc0ec,{'useId':_0x4b8fe4});const [_0x3f9b95,_0x3938e8]=await this[_0x5e4097(0xd2)]['findAndCount']({'skip':(page-0x1)*size,'take':size,'order':{'createdAt':'DESC'},'where':_0x1cc0ec}),_0x4424e7=_0x3f9b95[_0x5e4097(0x94)](_0xad05a4=>_0xad05a4[_0x5e4097(0xf1)]),_0x2478a8=_0x3f9b95[_0x5e4097(0x94)](_0x465cc4=>_0x465cc4[_0x5e4097(0xbc)]),_0x518315=await this[_0x5e4097(0xcc)][_0x5e4097(0xe4)]({'where':{'id':(0x0,typeorm_2['In'])(_0x4424e7)}}),_0x5c901d=await this[_0x5e4097(0x93)][_0x5e4097(0xe4)]({'where':{'id':(0x0,typeorm_2['In'])(_0x2478a8)}});return _0x3f9b95[_0x5e4097(0xbf)](_0x4ee2ab=>{const _0x21d639=_0x5e4097;var _0x2e191e,_0x1dbd99,_0x28becf;_0x4ee2ab[_0x21d639(0xd8)]=(_0x2e191e=_0x518315['find'](_0x45fa9c=>_0x45fa9c['id']===_0x4ee2ab[_0x21d639(0xf1)]))===null||_0x2e191e===void 0x0?void 0x0:_0x2e191e[_0x21d639(0xd8)],_0x4ee2ab[_0x21d639(0xab)]=(_0x1dbd99=_0x518315['find'](_0x248c34=>_0x248c34['id']===_0x4ee2ab['useId']))===null||_0x1dbd99===void 0x0?void 0x0:_0x1dbd99[_0x21d639(0xab)],_0x4ee2ab[_0x21d639(0xb3)]=(_0x28becf=_0x5c901d['find'](_0x22cb3d=>_0x22cb3d['id']===_0x4ee2ab[_0x21d639(0xbc)]))===null||_0x28becf===void 0x0?void 0x0:_0x28becf[_0x21d639(0xd0)];}),_0x270606[_0x5e4097(0xe6)][_0x5e4097(0xa9)]!==_0x5e4097(0xd5)&&_0x3f9b95[_0x5e4097(0xbf)](_0x4f1446=>_0x4f1446['email']=(0x0,utils_1[_0x5e4097(0xd4)])(_0x4f1446['email'])),_0x270606['user'][_0x5e4097(0xa9)]!==_0x5e4097(0xd5)&&_0x3f9b95[_0x5e4097(0xbf)](_0x375ef8=>_0x375ef8[_0x5e4097(0x9c)]=(0x0,utils_1[_0x5e4097(0xae)])(_0x375ef8[_0x5e4097(0x9c)])),{'rows':_0x3f9b95,'count':_0x3938e8};}async[_0x40e1d6(0xec)](_0x49a1fe){const _0x3271de=_0x40e1d6,_0x4bbeed=await this[_0x3271de(0xd2)][_0x3271de(0xa8)]({'where':{'id':_0x49a1fe}});if(!_0x4bbeed)throw new common_1['HttpException']('当前卡密不存在、请确认您要删除的卡密是否存在!',common_1[_0x3271de(0xa2)][_0x3271de(0xc1)]);if(_0x4bbeed['status']===0x1)throw new common_1[(_0x3271de(0xc4))](_0x3271de(0xc5),common_1[_0x3271de(0xa2)][_0x3271de(0xc1)]);return await this['cramiEntity'][_0x3271de(0xb6)]({'id':_0x49a1fe});}async[_0x40e1d6(0xa3)](_0x4629b0){const _0x2a9e11=_0x40e1d6,{ids:_0x4e0b39}=_0x4629b0,_0x16c04a=await this[_0x2a9e11(0xd2)][_0x2a9e11(0xb6)](_0x4e0b39);if(_0x16c04a[_0x2a9e11(0xd3)]>0x0)return _0x2a9e11(0xcf);else throw new common_1['HttpException'](_0x2a9e11(0xb2),common_1[_0x2a9e11(0xa2)][_0x2a9e11(0xc1)]);}};CramiService=__decorate([(0x0,common_1[_0x40e1d6(0xb7)])(),__param(0x0,(0x0,typeorm_1[_0x40e1d6(0xcb)])(crami_entity_1['CramiEntity'])),__param(0x1,(0x0,typeorm_1[_0x40e1d6(0xcb)])(cramiPackage_entity_1[_0x40e1d6(0x95)])),__param(0x2,(0x0,typeorm_1['InjectRepository'])(user_entity_1[_0x40e1d6(0xd1)])),__metadata(_0x40e1d6(0xe9),[typeorm_2['Repository'],typeorm_2[_0x40e1d6(0xa4)],typeorm_2['Repository'],userBalance_service_1['UserBalanceService']])],CramiService),exports[_0x40e1d6(0xc9)]=CramiService; |