mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-26 05:06:39 +08:00
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
'use strict';const _0x18ea30=_0x5c49;(function(_0x1cdc7c,_0x400e49){const _0x6c1ebd=_0x5c49,_0x1b373f=_0x1cdc7c();while(!![]){try{const _0x579089=parseInt(_0x6c1ebd(0x223))/0x1+-parseInt(_0x6c1ebd(0x22d))/0x2*(parseInt(_0x6c1ebd(0x221))/0x3)+-parseInt(_0x6c1ebd(0x1e5))/0x4*(-parseInt(_0x6c1ebd(0x21e))/0x5)+parseInt(_0x6c1ebd(0x21b))/0x6*(-parseInt(_0x6c1ebd(0x201))/0x7)+parseInt(_0x6c1ebd(0x1eb))/0x8*(parseInt(_0x6c1ebd(0x233))/0x9)+parseInt(_0x6c1ebd(0x226))/0xa+parseInt(_0x6c1ebd(0x211))/0xb;if(_0x579089===_0x400e49)break;else _0x1b373f['push'](_0x1b373f['shift']());}catch(_0x149569){_0x1b373f['push'](_0x1b373f['shift']());}}}(_0x206f,0xaa184));var __decorate=this&&this[_0x18ea30(0x1fa)]||function(_0x48701f,_0x3f431a,_0x452bc8,_0x534d95){const _0x16a86f=_0x18ea30;var _0x57728e=arguments[_0x16a86f(0x234)],_0x595c59=_0x57728e<0x3?_0x3f431a:_0x534d95===null?_0x534d95=Object['getOwnPropertyDescriptor'](_0x3f431a,_0x452bc8):_0x534d95,_0x95f13f;if(typeof Reflect===_0x16a86f(0x22f)&&typeof Reflect[_0x16a86f(0x232)]===_0x16a86f(0x1fb))_0x595c59=Reflect[_0x16a86f(0x232)](_0x48701f,_0x3f431a,_0x452bc8,_0x534d95);else{for(var _0x2bd68a=_0x48701f[_0x16a86f(0x234)]-0x1;_0x2bd68a>=0x0;_0x2bd68a--)if(_0x95f13f=_0x48701f[_0x2bd68a])_0x595c59=(_0x57728e<0x3?_0x95f13f(_0x595c59):_0x57728e>0x3?_0x95f13f(_0x3f431a,_0x452bc8,_0x595c59):_0x95f13f(_0x3f431a,_0x452bc8))||_0x595c59;}return _0x57728e>0x3&&_0x595c59&&Object[_0x16a86f(0x20b)](_0x3f431a,_0x452bc8,_0x595c59),_0x595c59;},__metadata=this&&this['__metadata']||function(_0x4b6178,_0x2c94e8){const _0x45c7b8=_0x18ea30;if(typeof Reflect===_0x45c7b8(0x22f)&&typeof Reflect[_0x45c7b8(0x222)]===_0x45c7b8(0x1fb))return Reflect[_0x45c7b8(0x222)](_0x4b6178,_0x2c94e8);},__param=this&&this[_0x18ea30(0x204)]||function(_0x36d74,_0x34234c){return function(_0x4c4908,_0x1599f5){_0x34234c(_0x4c4908,_0x1599f5,_0x36d74);};};function _0x5c49(_0x23c003,_0x29c6b1){const _0x206fb0=_0x206f();return _0x5c49=function(_0x5c49f9,_0x382276){_0x5c49f9=_0x5c49f9-0x1e0;let _0x10f5d0=_0x206fb0[_0x5c49f9];return _0x10f5d0;},_0x5c49(_0x23c003,_0x29c6b1);}Object[_0x18ea30(0x20b)](exports,_0x18ea30(0x220),{'value':!![]}),exports[_0x18ea30(0x21c)]=void 0x0;const common_1=require('@nestjs/common'),crami_entity_1=require(_0x18ea30(0x20d)),typeorm_1=require(_0x18ea30(0x1ff)),typeorm_2=require('typeorm'),cramiPackage_entity_1=require(_0x18ea30(0x207)),utils_1=require(_0x18ea30(0x1f8)),user_entity_1=require(_0x18ea30(0x1e8)),userBalance_service_1=require(_0x18ea30(0x1fe)),balance_constant_1=require(_0x18ea30(0x237));function _0x206f(){const _0x342bf8=['当前套餐下存在卡密、请先删除卡密后才可删除套餐!','forEach','decorate','2221353LuOuuC','length','更新套餐成功!','当前卡密不存在、请确认您要删除的卡密是否存在!','../../common/constants/balance.constant','role','DESC','BAD_REQUEST','map','update','addBalanceToUser','useCrami','UserEntity','user','套餐名称或套餐等级重复、请检查!','689188PKJTST','assign','packageName','../user/user.entity','更新套餐失败、请重试!','当前套餐不存在、请检查你的输入参数!','16PaZVKC','create','userEntity','maskEmail','CramiPackageEntity','status','UserBalanceService','useId','LessThanOrEqual','HttpStatus','generateCrami','packageId','cramiEntity','../../common/utils','super','__decorate','function','find','RechargeType','../userBalance/userBalance.service','@nestjs/typeorm','自定义卡密必须至少一项余额不为0️零!','13909ZOwiZp','log','当前套餐不存在、请确认您选择的套餐是否存在!','__param','cramiPackageEntity','当前卡密已被使用、已使用的卡密禁止删除!','./cramiPackage.entity','findOne','affected','userBalanceService','defineProperty','push','./crami.entity','Not','HttpException','code','6042069VblmKK','maskCrami','findAndCount','删除卡密失败、请重试!','当前卡密已被使用、请确认您输入的卡密是否正确!','queryAllPackage','username','MoreThan','delCrami','queryOnePackage','144vyxsMh','CramiService','InjectRepository','5rKygmq','Repository','__esModule','419544RwpdJB','metadata','40651ygdRcI','Like','Injectable','7471670PNSRki','delete','使用卡密成功','error:\x20','删除卡密成功!','queryAllCrami','email','18LrMsOD','createCrami','object'];_0x206f=function(){return _0x342bf8;};return _0x206f();}let CramiService=class CramiService{constructor(_0x303b88,_0x2e652c,_0x13f563,_0x4e9fb4){const _0x258b82=_0x18ea30;this[_0x258b82(0x1f7)]=_0x303b88,this[_0x258b82(0x205)]=_0x2e652c,this[_0x258b82(0x1ed)]=_0x13f563,this[_0x258b82(0x20a)]=_0x4e9fb4;}async[_0x18ea30(0x21a)](_0x5e5b22){const _0x224eff=_0x18ea30;return await this[_0x224eff(0x205)][_0x224eff(0x208)]({'where':{'id':_0x5e5b22}});}async[_0x18ea30(0x216)](_0x55a0e2){const _0x500132=_0x18ea30;try{const {page:page=0x1,size:size=0xa,name:_0x6cc399,status:_0x303b93,type:_0xb7f978}=_0x55a0e2,_0x5dbfb4={};_0x6cc399&&Object[_0x500132(0x1e6)](_0x5dbfb4,{'name':(0x0,typeorm_2[_0x500132(0x224)])('%'+_0x6cc399+'%')}),_0x303b93&&Object[_0x500132(0x1e6)](_0x5dbfb4,{'status':_0x303b93});_0xb7f978&&(_0xb7f978>0x0?Object[_0x500132(0x1e6)](_0x5dbfb4,{'days':(0x0,typeorm_2[_0x500132(0x218)])(0x0)}):Object['assign'](_0x5dbfb4,{'days':(0x0,typeorm_2[_0x500132(0x1f3)])(0x0)}));const [_0x4576c0,_0x1d8da4]=await this['cramiPackageEntity'][_0x500132(0x213)]({'skip':(page-0x1)*size,'take':size,'where':_0x5dbfb4,'order':{'order':_0x500132(0x239)}});return{'rows':_0x4576c0,'count':_0x1d8da4};}catch(_0x51d9bf){console[_0x500132(0x202)](_0x500132(0x229),_0x51d9bf);}}async['createPackage'](_0x237a7f){const _0x1aecc7=_0x18ea30,{name:_0x3ad70a,weight:_0x290303}=_0x237a7f,_0x28fca0=await this[_0x1aecc7(0x205)][_0x1aecc7(0x208)]({'where':[{'name':_0x3ad70a},{'weight':_0x290303}]});if(_0x28fca0)throw new common_1[(_0x1aecc7(0x20f))](_0x1aecc7(0x1e4),common_1[_0x1aecc7(0x1f4)]['BAD_REQUEST']);try{return await this[_0x1aecc7(0x205)]['save'](_0x237a7f);}catch(_0x27e4ee){console[_0x1aecc7(0x202)]('error:\x20',_0x27e4ee);throw new common_1[(_0x1aecc7(0x20f))](_0x27e4ee,common_1[_0x1aecc7(0x1f4)][_0x1aecc7(0x23a)]);}}async['updatePackage'](_0x178802){const _0x599dd8=_0x18ea30,{id:_0x30db3d,name:_0x455b43,weight:_0x4999b4}=_0x178802,_0x4a9126=await this[_0x599dd8(0x205)]['findOne']({'where':{'id':_0x30db3d}});if(!_0x4a9126)throw new common_1[(_0x599dd8(0x20f))](_0x599dd8(0x1ea),common_1[_0x599dd8(0x1f4)][_0x599dd8(0x23a)]);const _0x5224c2=await this['cramiPackageEntity']['count']({'where':[{'name':_0x455b43,'id':(0x0,typeorm_2['Not'])(_0x30db3d)},{'weight':_0x4999b4,'id':(0x0,typeorm_2[_0x599dd8(0x20e)])(_0x30db3d)}]});if(_0x5224c2)throw new common_1[(_0x599dd8(0x20f))]('套餐名称或套餐等级重复、请检查!',common_1[_0x599dd8(0x1f4)][_0x599dd8(0x23a)]);const _0x2b3718=await this[_0x599dd8(0x205)][_0x599dd8(0x23c)]({'id':_0x30db3d},_0x178802);if(_0x2b3718[_0x599dd8(0x209)]>0x0)return _0x599dd8(0x235);else throw new common_1[(_0x599dd8(0x20f))](_0x599dd8(0x1e9),common_1[_0x599dd8(0x1f4)][_0x599dd8(0x23a)]);}async['delPackage'](_0x4775f1){const _0xc61479=_0x18ea30,{id:_0x3d78db}=_0x4775f1,_0xeca241=await this[_0xc61479(0x1f7)]['count']({'where':{'packageId':_0x3d78db}});if(_0xeca241)throw new common_1[(_0xc61479(0x20f))](_0xc61479(0x230),common_1['HttpStatus'][_0xc61479(0x23a)]);return await this[_0xc61479(0x205)][_0xc61479(0x227)]({'id':_0x3d78db});}async[_0x18ea30(0x22e)](_0x55c618){const _0x722cd2=_0x18ea30,{packageId:_0x23b403,count:count=0x1}=_0x55c618;if(_0x23b403){const _0x3c9dec=await this[_0x722cd2(0x205)][_0x722cd2(0x208)]({'where':{'id':_0x23b403}});if(!_0x3c9dec)throw new common_1['HttpException'](_0x722cd2(0x203),common_1[_0x722cd2(0x1f4)][_0x722cd2(0x23a)]);const {days:days=-0x1,model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0}=_0x3c9dec,_0x4be82b={'packageId':_0x23b403,'days':days,'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount};return await this[_0x722cd2(0x1f5)](_0x4be82b,count);}if(!_0x23b403){const {model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0}=_0x55c618;if([model3Count,model4Count,drawMjCount]['every'](_0x26905d=>!_0x26905d))throw new common_1['HttpException'](_0x722cd2(0x200),common_1['HttpStatus'][_0x722cd2(0x23a)]);const _0x267ba4={'days':-0x1,'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount};return await this['generateCrami'](_0x267ba4,count);}}async[_0x18ea30(0x1f5)](_0x36f124,_0x28d319){const _0x111b0f=_0x18ea30,_0x622af9=[];for(let _0x353fcf=0x0;_0x353fcf<_0x28d319;_0x353fcf++){const _0x2eb8a0=(0x0,utils_1['generateCramiCode'])(),_0x14b406=this[_0x111b0f(0x1f7)][_0x111b0f(0x1ec)](Object[_0x111b0f(0x1e6)](Object[_0x111b0f(0x1e6)]({},_0x36f124),{'code':_0x2eb8a0}));_0x622af9[_0x111b0f(0x20c)](_0x14b406);}return await this[_0x111b0f(0x1f7)]['save'](_0x622af9);}async[_0x18ea30(0x1e1)](_0x39c740,_0x357fcb){const _0x55aeeb=_0x18ea30,{id:_0x1166b9}=_0x39c740['user'],_0x3fc260=await this['cramiEntity'][_0x55aeeb(0x208)]({'where':{'code':_0x357fcb[_0x55aeeb(0x210)]}});if(!_0x3fc260)throw new common_1[(_0x55aeeb(0x20f))]('当前卡密不存在、请确认您输入的卡密是否正确!',common_1[_0x55aeeb(0x1f4)][_0x55aeeb(0x23a)]);const {status:_0x23b48d,days:days=-0x1,model3Count:model3Count=0x0,model4Count:model4Count=0x0,drawMjCount:drawMjCount=0x0,packageId:_0x24934b}=_0x3fc260;if(_0x23b48d===0x1)throw new common_1[(_0x55aeeb(0x20f))](_0x55aeeb(0x215),common_1['HttpStatus'][_0x55aeeb(0x23a)]);const _0x3a056e={'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount,'packageId':_0x24934b};return await this['userBalanceService'][_0x55aeeb(0x1e0)](_0x1166b9,Object[_0x55aeeb(0x1e6)]({},_0x3a056e),days),await this[_0x55aeeb(0x20a)]['saveRecordRechargeLog']({'userId':_0x1166b9,'rechargeType':balance_constant_1[_0x55aeeb(0x1fd)]['PACKAGE_GIFT'],'model3Count':model3Count,'model4Count':model4Count,'drawMjCount':drawMjCount,'days':days}),await this[_0x55aeeb(0x1f7)][_0x55aeeb(0x23c)]({'code':_0x357fcb[_0x55aeeb(0x210)]},{'useId':_0x1166b9,'status':0x1}),_0x55aeeb(0x228);}async[_0x18ea30(0x22b)](_0x1fb7b4,_0x43982e){const _0x501cc7=_0x18ea30,{page:page=0x1,size:size=0xa,status:_0x3bc85c,useId:_0x50ea05}=_0x1fb7b4,_0x3f6878={};_0x3bc85c&&Object[_0x501cc7(0x1e6)](_0x3f6878,{'status':_0x3bc85c}),_0x50ea05&&Object['assign'](_0x3f6878,{'useId':_0x50ea05});const [_0x1b9e0e,_0xe38639]=await this[_0x501cc7(0x1f7)][_0x501cc7(0x213)]({'skip':(page-0x1)*size,'take':size,'order':{'createdAt':_0x501cc7(0x239)},'where':_0x3f6878}),_0x3cacb7=_0x1b9e0e[_0x501cc7(0x23b)](_0x42568e=>_0x42568e[_0x501cc7(0x1f2)]),_0x130cd1=_0x1b9e0e['map'](_0x5c5a0c=>_0x5c5a0c[_0x501cc7(0x1f6)]),_0x526140=await this[_0x501cc7(0x1ed)][_0x501cc7(0x1fc)]({'where':{'id':(0x0,typeorm_2['In'])(_0x3cacb7)}}),_0xb2fa08=await this['cramiPackageEntity']['find']({'where':{'id':(0x0,typeorm_2['In'])(_0x130cd1)}});return _0x1b9e0e['forEach'](_0x2777c2=>{const _0x5bfb4=_0x501cc7;var _0xfe6cfa,_0x5ea0d9,_0x5ec081;_0x2777c2[_0x5bfb4(0x217)]=(_0xfe6cfa=_0x526140[_0x5bfb4(0x1fc)](_0xd2317c=>_0xd2317c['id']===_0x2777c2['useId']))===null||_0xfe6cfa===void 0x0?void 0x0:_0xfe6cfa[_0x5bfb4(0x217)],_0x2777c2['email']=(_0x5ea0d9=_0x526140[_0x5bfb4(0x1fc)](_0x722144=>_0x722144['id']===_0x2777c2[_0x5bfb4(0x1f2)]))===null||_0x5ea0d9===void 0x0?void 0x0:_0x5ea0d9[_0x5bfb4(0x22c)],_0x2777c2[_0x5bfb4(0x1e7)]=(_0x5ec081=_0xb2fa08[_0x5bfb4(0x1fc)](_0x28fae9=>_0x28fae9['id']===_0x2777c2[_0x5bfb4(0x1f6)]))===null||_0x5ec081===void 0x0?void 0x0:_0x5ec081['name'];}),_0x43982e[_0x501cc7(0x1e3)][_0x501cc7(0x238)]!==_0x501cc7(0x1f9)&&_0x1b9e0e[_0x501cc7(0x231)](_0x1f7cde=>_0x1f7cde[_0x501cc7(0x22c)]=(0x0,utils_1[_0x501cc7(0x1ee)])(_0x1f7cde[_0x501cc7(0x22c)])),_0x43982e[_0x501cc7(0x1e3)][_0x501cc7(0x238)]!==_0x501cc7(0x1f9)&&_0x1b9e0e[_0x501cc7(0x231)](_0x3985b8=>_0x3985b8['code']=(0x0,utils_1[_0x501cc7(0x212)])(_0x3985b8[_0x501cc7(0x210)])),{'rows':_0x1b9e0e,'count':_0xe38639};}async[_0x18ea30(0x219)](_0x1513fe){const _0x1af586=_0x18ea30,_0x87d3da=await this['cramiEntity'][_0x1af586(0x208)]({'where':{'id':_0x1513fe}});if(!_0x87d3da)throw new common_1[(_0x1af586(0x20f))](_0x1af586(0x236),common_1[_0x1af586(0x1f4)]['BAD_REQUEST']);if(_0x87d3da[_0x1af586(0x1f0)]===0x1)throw new common_1[(_0x1af586(0x20f))](_0x1af586(0x206),common_1[_0x1af586(0x1f4)][_0x1af586(0x23a)]);return await this[_0x1af586(0x1f7)][_0x1af586(0x227)]({'id':_0x1513fe});}async['batchDelCrami'](_0x12f45e){const _0xeca526=_0x18ea30,{ids:_0x3bde06}=_0x12f45e,_0x1c492d=await this[_0xeca526(0x1f7)][_0xeca526(0x227)](_0x3bde06);if(_0x1c492d[_0xeca526(0x209)]>0x0)return _0xeca526(0x22a);else throw new common_1['HttpException'](_0xeca526(0x214),common_1[_0xeca526(0x1f4)][_0xeca526(0x23a)]);}};CramiService=__decorate([(0x0,common_1[_0x18ea30(0x225)])(),__param(0x0,(0x0,typeorm_1[_0x18ea30(0x21d)])(crami_entity_1['CramiEntity'])),__param(0x1,(0x0,typeorm_1['InjectRepository'])(cramiPackage_entity_1[_0x18ea30(0x1ef)])),__param(0x2,(0x0,typeorm_1[_0x18ea30(0x21d)])(user_entity_1[_0x18ea30(0x1e2)])),__metadata('design:paramtypes',[typeorm_2[_0x18ea30(0x21f)],typeorm_2[_0x18ea30(0x21f)],typeorm_2[_0x18ea30(0x21f)],userBalance_service_1[_0x18ea30(0x1f1)]])],CramiService),exports[_0x18ea30(0x21c)]=CramiService; |