YiAi/YiAiQuickDeploy/dist/modules/midjourney/midjourney.service.js

1 line
23 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';const _0x5ed21f=_0x1f3a;function _0x5510(){const _0x5af2f1=['formatCreateOrUpdateDate','arraybuffer','../redisCache/redisCache.service','查询失败!','midjourneyEntity','action','user','from','getOwnPropertyDescriptor','Zoom\x20Out\x201.5x','rec','RedisCacheService','当前图片不存在!','midjourney:getList','SUCCESS','Logger','WAITING','redisCacheService','3578530dOIoRC','delLog','userInfo','mjPromptsEntity','UploadService','DRAWFAIL','sleep','10JYyXmV','drawFailed','getDrawList','UserBalanceService','VARIATION','GlobalConfigService','/fetch','1048MGeDwR','status','drawId','../../common/utils','updateDrawData','积分。','InjectRepository','base64','test','pollComparisonResultDraw','axios','mjPromptEntity','save','5988540oYDQqb','delPrompt','get','delete','Injectable','update','isDelete','userBalanceService','extraParam','globalConfigService','20699qOjWCI','存储图片失败,使用原始图片链接','获取我得绘制列表失败','IMAGINE','image-size','cleanQueue','UserEntity','getFullPrompt','setPrompt','REGENERATE','绘画完成,执行扣费,扣除费用:','.png','uploadService','userEntity','4970636IDuypn','createdAt','error:\x20','replace','imageUrl','getDrawActionDetail','drawUrl','当前管理员限制单用户同时最多能执行','email','drawRatio','/mj/submit/imagine','../userBalance/userBalance.service','findOne','ZOOM','Zoom\x20Out\x202x','../upload/upload.service','HttpException','count','role','typeorm','getImageSizeFromUrl','find','3251493MUdIaQ','length','getList','defineProperty','__decorate','发送绘图指令失败、请联系管理员检测绘画配置!','assign','未能获取结果数据','super','queryPrompt','绘制成功,\x20URL:\x20','parse','@nestjs/typeorm','更新绘画数据失败','绘制中的图片任务、禁止删除!','Repository','MJ::JOB::reroll::0::','个任务','删除失败!','startsWith','绘画超时,请稍后再试!','删除记录成功!','set','deleteDraw','MidjourneyStatusEnum','sendDrawCommand','MidjourneyEntity','map','BAD_REQUEST','MidjourneyService','filter','data','affected','now','------>\x20开始上传图片','13302kqVBqz','getConfigs','DRAWING','prompt','proxyImg','log','bindJobId','draw','application/x-www-form-urlencoded','stringify','fullPrompt','删除记录失败!','Error\x20in\x20addDrawQueue:','获取图片结果失败:\x20','6591483vzNQfe','操作成功!','removeEmoji','process','decorate','./../user/user.entity','uploadFileFromUrl','mjProxyUrl','metadata','删除成功!','HttpStatus','userId','drawSuccess','default','debug','所需绘画操作信息不存在!','updateDrawStatus','../globalConfig/globalConfig.service','error','179sytLIl','DESC','../../common/constants/midjourney.constant','绘画ID:\x20','mjLimitCount','label','findAndCount'];_0x5510=function(){return _0x5af2f1;};return _0x5510();}(function(_0x33a537,_0x4285a6){const _0x99ac04=_0x1f3a,_0x95846b=_0x33a537();while(!![]){try{const _0x36c5e7=parseInt(_0x99ac04(0xf1))/0x1*(-parseInt(_0x99ac04(0xd0))/0x2)+parseInt(_0x99ac04(0xad))/0x3+-parseInt(_0x99ac04(0x97))/0x4+parseInt(_0x99ac04(0x10a))/0x5+parseInt(_0x99ac04(0x125))/0x6+parseInt(_0x99ac04(0x12f))/0x7*(-parseInt(_0x99ac04(0x118))/0x8)+-parseInt(_0x99ac04(0xde))/0x9*(-parseInt(_0x99ac04(0x111))/0xa);if(_0x36c5e7===_0x4285a6)break;else _0x95846b['push'](_0x95846b['shift']());}catch(_0x28c1df){_0x95846b['push'](_0x95846b['shift']());}}}(_0x5510,0xad353));var __decorate=this&&this[_0x5ed21f(0xb1)]||function(_0x43b28e,_0x2952f9,_0x18a93a,_0x190d31){const _0x4eb125=_0x5ed21f;var _0x10c046=arguments[_0x4eb125(0xae)],_0x3817b1=_0x10c046<0x3?_0x2952f9:_0x190d31===null?_0x190d31=Object[_0x4eb125(0x100)](_0x2952f9,_0x18a93a):_0x190d31,_0x45fd8e;if(typeof Reflect==='object'&&typeof Reflect[_0x4eb125(0xe2)]==='function')_0x3817b1=Reflect[_0x4eb125(0xe2)](_0x43b28e,_0x2952f9,_0x18a93a,_0x190d31);else{for(var _0x2df40b=_0x43b28e['length']-0x1;_0x2df40b>=0x0;_0x2df40b--)if(_0x45fd8e=_0x43b28e[_0x2df40b])_0x3817b1=(_0x10c046<0x3?_0x45fd8e(_0x3817b1):_0x10c046>0x3?_0x45fd8e(_0x2952f9,_0x18a93a,_0x3817b1):_0x45fd8e(_0x2952f9,_0x18a93a))||_0x3817b1;}return _0x10c046>0x3&&_0x3817b1&&Object[_0x4eb125(0xb0)](_0x2952f9,_0x18a93a,_0x3817b1),_0x3817b1;},__metadata=this&&this['__metadata']||function(_0x2a9091,_0x1c87ae){const _0x4bb763=_0x5ed21f;if(typeof Reflect==='object'&&typeof Reflect[_0x4bb763(0xe6)]==='function')return Reflect['metadata'](_0x2a9091,_0x1c87ae);},__param=this&&this['__param']||function(_0x534ade,_0x55b096){return function(_0x4918b8,_0x5c3b0f){_0x55b096(_0x4918b8,_0x5c3b0f,_0x534ade);};};Object[_0x5ed21f(0xb0)](exports,'__esModule',{'value':!![]}),exports['MidjourneyService']=void 0x0;const user_entity_1=require(_0x5ed21f(0xe3)),common_1=require('@nestjs/common'),typeorm_1=require(_0x5ed21f(0xb9)),midjourney_entity_1=require('./midjourney.entity'),typeorm_2=require(_0x5ed21f(0xaa)),axios_1=require(_0x5ed21f(0x122)),globalConfig_service_1=require(_0x5ed21f(0xef)),midjourney_constant_1=require(_0x5ed21f(0xf3)),upload_service_1=require(_0x5ed21f(0xa6)),userBalance_service_1=require(_0x5ed21f(0xa2)),utils_1=require(_0x5ed21f(0x11b)),redisCache_service_1=require(_0x5ed21f(0xfa)),prompt_entity_1=require('./prompt.entity'),image_size_1=require(_0x5ed21f(0x133));let MidjourneyService=class MidjourneyService{constructor(_0x5f0f4b,_0x3dede7,_0xfc2597,_0x2dee62,_0xc7c9eb,_0x51f89c,_0x57cf96){const _0x1b390e=_0x5ed21f;this['midjourneyEntity']=_0x5f0f4b,this['userEntity']=_0x3dede7,this[_0x1b390e(0x10d)]=_0xfc2597,this['globalConfigService']=_0x2dee62,this[_0x1b390e(0x95)]=_0xc7c9eb,this[_0x1b390e(0x12c)]=_0x51f89c,this[_0x1b390e(0x109)]=_0x57cf96,this['lockPrompt']=[];}async[_0x5ed21f(0x110)](_0x38a58d){return new Promise(_0x3a02fb=>setTimeout(_0x3a02fb,_0x38a58d));}async['getImageSizeFromUrl'](_0x265815){const _0x5c3292=_0x5ed21f;try{const _0x5d9839=await axios_1[_0x5c3292(0xeb)][_0x5c3292(0x127)](_0x265815,{'responseType':'arraybuffer'}),_0x568d82=Buffer[_0x5c3292(0xff)](_0x5d9839[_0x5c3292(0xcc)],'binary'),_0x2ded53=(0x0,image_size_1[_0x5c3292(0xeb)])(_0x568d82);return{'width':_0x2ded53['width'],'height':_0x2ded53['height']};}catch(_0x207dc0){console[_0x5c3292(0xf0)]('Error\x20fetching\x20image\x20size:',_0x207dc0);throw _0x207dc0;}}async[_0x5ed21f(0xd7)](_0x182ef8,_0x20aa85){const _0x13ed94=_0x5ed21f,{id:_0x3e5961,action:_0xd531c,drawId:_0x3433f6}=_0x182ef8,_0x241110=await this['midjourneyEntity'][_0x13ed94(0xa3)]({'where':{'id':_0x3e5961}}),{customId:_0x2fed95}=_0x241110;try{await this[_0x13ed94(0xd6)](_0x3e5961,_0x20aa85),await this[_0x13ed94(0xee)](_0x3e5961,midjourney_constant_1['MidjourneyStatusEnum'][_0x13ed94(0xd2)]);const _0x110bf0=await this[_0x13ed94(0xc6)](_0x241110,_0xd531c);_0x241110[_0x13ed94(0x11a)]=_0x110bf0;const _0x4750a0=await this[_0x13ed94(0x121)](_0x3e5961,_0x241110);return await this[_0x13ed94(0x11c)](_0x182ef8,_0x4750a0),this['drawSuccess'](_0x182ef8),!![];}catch(_0x1ba78b){return console[_0x13ed94(0xd5)]('error:\x20',_0x1ba78b),!![];}}async['addDrawQueue'](_0x4bbb39){const _0x3ac005=_0x5ed21f;try{const {prompt:_0x466730,imgUrl:imgUrl='',extraParam:extraParam='',action:_0xc8919d,userId:_0x3824bb,orderId:_0x16c74c,customId:_0x20449f,drawId:_0x10998c}=_0x4bbb39,_0x5dcb4a=imgUrl?imgUrl+'\x20'+_0x466730+'\x20'+extraParam:_0x466730+'\x20'+extraParam,_0x3d4cd6={'userId':_0x3824bb,'drawId':_0x10998c,'extraParam':extraParam,'prompt':_0x466730,'imgUrl':imgUrl,'fullPrompt':_0x5dcb4a,'status':midjourney_constant_1[_0x3ac005(0xc5)][_0x3ac005(0x108)],'action':_0xc8919d,'orderId':_0x16c74c,'customId':_0x20449f},_0x3be028=await this[_0x3ac005(0xfc)]['save'](_0x3d4cd6);return _0x3be028;}catch(_0x16a6c2){console[_0x3ac005(0xf0)](_0x3ac005(0xdc),_0x16a6c2);throw _0x16a6c2;}}async[_0x5ed21f(0xee)](_0x1d3e6b,_0x319147){const _0x21973a=_0x5ed21f;await this[_0x21973a(0xfc)][_0x21973a(0x12a)]({'id':_0x1d3e6b},{'status':_0x319147});}async['updateDrawData'](_0x4a4e1f,_0xf57baf){const _0x5eceb5=_0x5ed21f;try{const {id:_0x5b46a3,imageUrl:_0x3602f4,action:_0x38372f,submitTime:_0x2d3105,finishTime:_0x3d9f3e,progress:_0x5be30a}=_0xf57baf,_0x5044e9=_0x3d9f3e-_0x2d3105;let _0xf21dff=Date[_0x5eceb5(0xce)]()+'-'+_0x5b46a3+_0x5eceb5(0x94);const _0x2c747f=await this[_0x5eceb5(0x12e)][_0x5eceb5(0xd1)](['mjNotSaveImg']);let _0x5787c7='',_0x4d0f65=!![];try{!Number(_0x2c747f)||Number(_0x2c747f)===0x0?(common_1[_0x5eceb5(0x107)][_0x5eceb5(0xec)](_0x5eceb5(0xcf),'MidjourneyService'),_0x5787c7=await this['uploadService'][_0x5eceb5(0xe4)]({'filename':_0xf21dff,'url':_0x3602f4})):(_0x5787c7=_0x3602f4,_0x4d0f65=![],common_1[_0x5eceb5(0x107)][_0x5eceb5(0xec)]('本次不存图片了','MidjourneyService'));}catch(_0x1037b2){common_1['Logger'][_0x5eceb5(0xf0)](_0x5eceb5(0x130),_0x5eceb5(0xca)),_0x5787c7=_0x3602f4,_0x4d0f65=![];}const {width:_0x4355d2,height:_0x4bd1d8}=await this[_0x5eceb5(0xab)](_0x3602f4),_0x21501b={'status':midjourney_constant_1[_0x5eceb5(0xc5)]['DRAWED'],'drawId':_0x5b46a3,'action':_0x38372f,'drawUrl':_0x5787c7,'drawRatio':_0x4355d2+'x'+_0x4bd1d8,'progress':0x64,'extend':this['removeEmoji'](JSON[_0x5eceb5(0xd9)](_0xf57baf)),'durationSpent':_0x5044e9,'isSaveImg':_0x4d0f65};await this[_0x5eceb5(0xfc)]['update']({'id':_0x4a4e1f['id']},_0x21501b);}catch(_0x525b2b){throw new common_1[(_0x5eceb5(0xa7))](_0x5eceb5(0xba),common_1['HttpStatus'][_0x5eceb5(0xc9)]);}}async[_0x5ed21f(0xc6)](_0x2ac382,_0x305cfd){const _0x286597=_0x5ed21f,_0x426758=await this[_0x286597(0x12e)][_0x286597(0xd1)]([_0x286597(0xe5)]),_0x1fadf2=await this[_0x286597(0x12e)][_0x286597(0xd1)](['mjKey']),{id:_0x65439a,fullPrompt:_0x103ae6,imgUrl:_0x4da190,drawId:_0x136e5f,customId:_0x4f6333}=_0x2ac382,_0x4c64ae=_0x4da190?_0x4da190+'\x20'+_0x103ae6:''+_0x103ae6;let _0x56be38='',_0x2b5cab={};const _0x4a3f86=0x3;let _0x9f8ef3=0x0;while(_0x9f8ef3<_0x4a3f86){try{_0x305cfd===_0x286597(0x132)?(_0x56be38=_0x426758+_0x286597(0xa1),_0x2b5cab={'prompt':_0x4c64ae}):(_0x56be38=_0x426758+'/mj/submit/action',_0x2b5cab={'taskId':_0x136e5f,'customId':_0x4f6333});const _0x22cda3={'mj-api-secret':_0x1fadf2},_0x47476e=await axios_1[_0x286597(0xeb)]['post'](_0x56be38,_0x2b5cab,{'headers':_0x22cda3}),{result:_0xf1c103}=_0x47476e['data'];if(_0xf1c103)return common_1[_0x286597(0x107)]['log'](_0x286597(0xf4)+_0xf1c103,_0x286597(0xca)),_0xf1c103;else throw new Error(_0x286597(0xb4));}catch(_0x4ebd7f){_0x9f8ef3++;if(_0x9f8ef3>=_0x4a3f86){await this[_0x286597(0xee)](_0x65439a,midjourney_constant_1[_0x286597(0xc5)]['DRAWFAIL']);throw new common_1[(_0x286597(0xa7))](_0x286597(0xb2),common_1['HttpStatus'][_0x286597(0xc9)]);}}}}async[_0x5ed21f(0x121)](_0x3cce8c,_0x5abda5){const _0x2befa1=_0x5ed21f,_0x53b264=await this[_0x2befa1(0x12e)][_0x2befa1(0xd1)]([_0x2befa1(0xe5)]),_0x430b24=await this[_0x2befa1(0x12e)][_0x2befa1(0xd1)](['mjKey']),_0x349265=Date[_0x2befa1(0xce)](),_0x864685=0x1388,_0x4029a3=0x249f0;let _0x47b56b=0x0,_0x327889=0x0;const _0xdff4b2=0x5,{drawId:_0x33d0bf}=_0x5abda5;try{while(Date['now']()-_0x349265<_0x4029a3&&_0x327889<_0xdff4b2){await new Promise(_0x55c42b=>setTimeout(_0x55c42b,_0x864685));try{const _0x69ba9f={'Content-Type':_0x2befa1(0xd8),'mj-api-secret':_0x430b24},_0x59ab89=_0x53b264+'/mj/task/'+_0x33d0bf+_0x2befa1(0x117),_0x39f65c=await axios_1[_0x2befa1(0xeb)]['get'](_0x59ab89,{'headers':_0x69ba9f}),_0x25f5f9=_0x39f65c[_0x2befa1(0xcc)],_0x5c35ac=_0x25f5f9[_0x2befa1(0xe1)];await this['midjourneyEntity'][_0x2befa1(0x12a)]({'id':_0x3cce8c},{'progress':_0x5c35ac});if(_0x25f5f9[_0x2befa1(0x119)]===_0x2befa1(0x106))return common_1[_0x2befa1(0x107)][_0x2befa1(0xd5)](_0x2befa1(0xb7)+_0x25f5f9[_0x2befa1(0x9b)],'MidjourneyService'),_0x25f5f9;}catch(_0x1a4479){_0x327889++,common_1['Logger'][_0x2befa1(0xf0)]('轮询过程中发生错误:\x20'+_0x1a4479,_0x2befa1(0xca));}_0x47b56b++;}if(_0x327889>=_0xdff4b2){await this[_0x2befa1(0xee)](_0x3cce8c,midjourney_constant_1[_0x2befa1(0xc5)][_0x2befa1(0x10f)]);throw new common_1[(_0x2befa1(0xa7))]('轮询失败次数过多,请稍后再试!',common_1[_0x2befa1(0xe8)][_0x2befa1(0xc9)]);}common_1[_0x2befa1(0x107)][_0x2befa1(0xf0)](_0x2befa1(0xc1),_0x2befa1(0xca)),await this['updateDrawStatus'](_0x3cce8c,midjourney_constant_1[_0x2befa1(0xc5)][_0x2befa1(0x10f)]);throw new common_1[(_0x2befa1(0xa7))](_0x2befa1(0xc1),common_1[_0x2befa1(0xe8)][_0x2befa1(0xc9)]);}catch(_0x4e76dc){common_1[_0x2befa1(0x107)][_0x2befa1(0xf0)](_0x2befa1(0xdd),_0x4e76dc,'MidjourneyService'),await this['updateDrawStatus'](_0x3cce8c,midjourney_constant_1['MidjourneyStatusEnum'][_0x2befa1(0x10f)]);throw _0x4e76dc;}}[_0x5ed21f(0xe0)](_0x2fb74b){const _0x5821d1=_0x5ed21f,_0x4fc5ed=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return _0x2fb74b[_0x5821d1(0x9a)](_0x4fc5ed,'');}async[_0x5ed21f(0xd6)](_0x71eff9,_0x22783b){const _0x113680=_0x5ed21f;await this[_0x113680(0xfc)][_0x113680(0x12a)]({'id':_0x71eff9},{'jobId':_0x22783b});}async[_0x5ed21f(0x113)](_0x433c10,_0x18bcf2){const _0x11107f=_0x5ed21f;try{const {page:page=0x1,size:size=0x1e}=_0x18bcf2,[_0x53bf2b,_0xbc7911]=await this[_0x11107f(0xfc)][_0x11107f(0xf7)]({'where':{'userId':_0x433c10[_0x11107f(0xfe)]['id'],'isDelete':0x0},'order':{'id':_0x11107f(0xf2)},'take':size,'skip':(page-0x1)*size,'select':['id',_0x11107f(0xe9),_0x11107f(0xd3),_0x11107f(0x12d),_0x11107f(0xda),'rec','orderId','drawId',_0x11107f(0x9d),'drawRatio',_0x11107f(0x12b),_0x11107f(0x119),_0x11107f(0xfd)]}),_0x1ff87c=await this[_0x11107f(0xfc)][_0x11107f(0xa8)]({'where':{'isDelete':0x0,'status':(0x0,typeorm_2['In'])([0x1,0x2])}}),_0x12263f={'rows':(0x0,utils_1[_0x11107f(0xf8)])(_0x53bf2b),'count':_0xbc7911,'countQueue':_0x1ff87c};return _0x12263f;}catch(_0x1533ea){throw new common_1[(_0x11107f(0xa7))](_0x11107f(0x131),common_1[_0x11107f(0xe8)]['BAD_REQUEST']);}}async[_0x5ed21f(0x9c)](_0x6f3be2,_0x4ef9f9,_0x5b2765){const _0x31b9d4=_0x5ed21f,_0x110171=await this['midjourneyEntity'][_0x31b9d4(0xa3)]({'where':{'drawId':_0x4ef9f9}}),{extend:_0x406849,prompt:_0x2616d7,imgUrl:_0x21c7ac,extraParam:_0x44c5aa}=_0x110171,_0x35326b=JSON[_0x31b9d4(0xb8)](_0x406849),_0x3767c1=_0x35326b['buttons']||[];let _0x342168;_0x6f3be2==='UPSCALE'&&(_0x342168=_0x3767c1[_0x31b9d4(0xac)](_0x61e2=>{const _0x4b3618=_0x31b9d4,_0x3a4cd4=_0x61e2[_0x4b3618(0xf6)][_0x4b3618(0xc0)]('U'+_0x5b2765),_0x530ad8=_0x5b2765===0x1&&/(Redo )?Upscale \(Subtle\)/[_0x4b3618(0x120)](_0x61e2[_0x4b3618(0xf6)])||_0x5b2765===0x2&&/(Redo )?Upscale \(Creative\)/['test'](_0x61e2[_0x4b3618(0xf6)]);return _0x3a4cd4||_0x530ad8;}));_0x6f3be2===_0x31b9d4(0x115)&&(_0x342168=_0x3767c1[_0x31b9d4(0xac)](_0x12dd86=>{const _0x237519=_0x31b9d4,_0x837b0a=_0x12dd86[_0x237519(0xf6)][_0x237519(0xc0)]('V'+_0x5b2765),_0x28f84a=_0x5b2765===0x1&&/Vary \(Strong\)/[_0x237519(0x120)](_0x12dd86['label'])||_0x5b2765===0x2&&/Vary \(Region\)/['test'](_0x12dd86[_0x237519(0xf6)]);return _0x837b0a||_0x28f84a;}));_0x6f3be2===_0x31b9d4(0x92)&&(_0x342168=_0x3767c1[_0x31b9d4(0xac)](_0x314ab6=>_0x314ab6['customId'][_0x31b9d4(0xc0)](_0x31b9d4(0xbd))&&_0x314ab6[_0x31b9d4(0xf6)]===''));_0x6f3be2===_0x31b9d4(0xa4)&&(_0x342168=_0x3767c1[_0x31b9d4(0xac)](_0x48c5c5=>_0x5b2765===0x1&&_0x48c5c5['label']===_0x31b9d4(0xa5)||_0x5b2765===0x2&&_0x48c5c5['label']===_0x31b9d4(0x101)));if(!_0x342168)throw new common_1[(_0x31b9d4(0xa7))](_0x31b9d4(0xed),common_1[_0x31b9d4(0xe8)][_0x31b9d4(0xc9)]);const {customId:_0x55de42}=_0x342168;return{'customId':_0x55de42,'prompt':_0x2616d7,'extraParam':_0x44c5aa,'drawId':_0x4ef9f9};}async[_0x5ed21f(0xc4)](_0x31c109,_0x22beaa){const _0x4f15e5=_0x5ed21f,_0x306045=await this[_0x4f15e5(0xfc)][_0x4f15e5(0xa3)]({'where':{'id':_0x31c109,'userId':_0x22beaa['user']['id'],'isDelete':0x0}});if(!_0x306045)throw new common_1[(_0x4f15e5(0xa7))](_0x4f15e5(0x104),common_1['HttpStatus'][_0x4f15e5(0xc9)]);if(_0x306045[_0x4f15e5(0x119)]===0x2)throw new common_1['HttpException'](_0x4f15e5(0xbb),common_1[_0x4f15e5(0xe8)][_0x4f15e5(0xc9)]);const _0x53a193=await this[_0x4f15e5(0xfc)]['update']({'id':_0x31c109},{'isDelete':0x1});if(_0x53a193['affected']>0x0)return _0x4f15e5(0xe7);else throw new common_1[(_0x4f15e5(0xa7))](_0x4f15e5(0xbf),common_1[_0x4f15e5(0xe8)]['BAD_REQUEST']);}async['checkLimit'](_0x1a9df2){const _0x3022a7=_0x5ed21f,{role:_0x515735,id:_0x21693f}=_0x1a9df2[_0x3022a7(0xfe)],_0x386433=await this['midjourneyEntity'][_0x3022a7(0xa8)]({'where':{'userId':_0x21693f,'isDelete':0x0,'status':(0x0,typeorm_2['In'])([0x1,0x2])}}),_0x285f27=await this[_0x3022a7(0x12e)][_0x3022a7(0xd1)]([_0x3022a7(0xf5)]),_0x1dae61=_0x285f27?Number(_0x285f27):0x2;if(_0x386433>=_0x1dae61)throw new common_1[(_0x3022a7(0xa7))](_0x3022a7(0x9e)+_0x1dae61+_0x3022a7(0xbe),common_1[_0x3022a7(0xe8)][_0x3022a7(0xc9)]);}async[_0x5ed21f(0x112)](_0x3ead59){const _0x42ef5b=_0x5ed21f,{id:_0x4ee6ec,userId:_0x32351a,action:_0x3931e6}=_0x3ead59;await this[_0x42ef5b(0xfc)][_0x42ef5b(0x12a)]({'id':_0x4ee6ec},{'status':0x4});}async[_0x5ed21f(0xea)](_0x5b8a84){const _0x4b5f8a=_0x5ed21f,{id:_0x181115,userId:_0x5406ee,action:_0x2a8fa6}=_0x5b8a84,_0x3d1f30=_0x2a8fa6==='UPSCALE'?0x1:0x4;common_1[_0x4b5f8a(0x107)]['debug'](_0x4b5f8a(0x93)+_0x3d1f30+_0x4b5f8a(0x11d)),await this[_0x4b5f8a(0x12c)]['refundMjBalance'](_0x5406ee,-_0x3d1f30),await this[_0x4b5f8a(0xfc)][_0x4b5f8a(0x12a)]({'id':_0x181115},{'status':0x3});}async[_0x5ed21f(0xaf)](_0xa9caec){const _0x3627de=_0x5ed21f,{page:page=0x1,size:size=0x14,rec:_0x253497,userId:_0x9247ca,status:_0xf826b0}=_0xa9caec;if(Number(size)===0x3e7){const _0x4c91f5=await this[_0x3627de(0x109)][_0x3627de(0x127)]({'key':_0x3627de(0x105)});if(_0x4c91f5)try{return JSON[_0x3627de(0xb8)](_0x4c91f5);}catch(_0x375e0b){return[];}}const _0x4de0da={'isDelete':0x0};_0x253497&&Object[_0x3627de(0xb3)](_0x4de0da,{'rec':_0x253497}),_0x9247ca&&Object[_0x3627de(0xb3)](_0x4de0da,{'userId':_0x9247ca}),_0xf826b0&&Object['assign'](_0x4de0da,{'status':_0xf826b0});const [_0x4badf7,_0x1535d2]=await this[_0x3627de(0xfc)][_0x3627de(0xf7)]({'where':_0x4de0da,'order':{'id':_0x3627de(0xf2)},'take':size,'skip':(page-0x1)*size,'select':['id','drawId',_0x3627de(0x9d),_0x3627de(0xa0),_0x3627de(0xd3),_0x3627de(0xda),_0x3627de(0x102),_0x3627de(0x98),_0x3627de(0xfd),_0x3627de(0x119)]});if(Number(size)===0x3e7){const _0x1a3dcf={'rows':_0x4badf7[_0x3627de(0xc8)](_0x3da4ae=>{const {id:_0x14bf32,drawId:_0x46a19a,drawUrl:_0x4b4094,drawRatio:_0x6e734f,prompt:_0x10cce4,fullPrompt:_0x2380db,createdAt:_0x5a0a8b,rec:_0x3bd96c,action:_0x15be40,status:_0x31b147}=_0x3da4ae;return{'id':_0x14bf32,'drawId':_0x46a19a,'drawUrl':_0x4b4094,'drawRatio':_0x6e734f,'prompt':_0x10cce4,'fullPrompt':_0x2380db,'createdAt':_0x5a0a8b,'rec':_0x3bd96c,'action':_0x15be40,'status':_0x31b147};}),'count':_0x1535d2};return await this[_0x3627de(0x109)][_0x3627de(0xc3)]({'key':'midjourney:getList','val':JSON[_0x3627de(0xd9)](_0x1a3dcf)},0x3c*0x5),_0x1a3dcf;}const _0x342108={'rows':_0x4badf7,'count':_0x1535d2};return _0x342108;}async[_0x5ed21f(0x90)](_0xa7b07a){const _0x111161=_0x5ed21f,_0x56af6c=await this[_0x111161(0xfc)][_0x111161(0xa3)]({'where':{'id':_0xa7b07a}});if(!_0x56af6c)return'';const {fullPrompt:_0xb7af39}=_0x56af6c;return _0xb7af39;}async['getAdminDrawList'](_0x29a063,_0x683a26){const _0x456a98=_0x5ed21f;try{const {page:page=0x1,size:size=0xa,rec:_0x3ea01b,userId:_0x1e70b0,status:_0x282e75}=_0x683a26,_0x24a6a7={'isDelete':0x0};_0x3ea01b&&Object['assign'](_0x24a6a7,{'rec':_0x3ea01b}),_0x1e70b0&&Object[_0x456a98(0xb3)](_0x24a6a7,{'userId':_0x1e70b0}),_0x282e75&&Object[_0x456a98(0xb3)](_0x24a6a7,{'status':_0x282e75});const [_0x3934dd,_0x48d323]=await this[_0x456a98(0xfc)]['findAndCount']({'where':_0x24a6a7,'order':{'id':_0x456a98(0xf2)},'take':size,'skip':(page-0x1)*size}),_0xe67284=_0x3934dd[_0x456a98(0xc8)](_0x523fa4=>_0x523fa4[_0x456a98(0xe9)])[_0x456a98(0xcb)](_0x5b5ba1=>_0x5b5ba1<0x186a0),_0x14ffe6=await this[_0x456a98(0x96)][_0x456a98(0xac)]({'where':{'id':(0x0,typeorm_2['In'])(_0xe67284)},'select':['id','username','avatar',_0x456a98(0x9f)]});return _0x3934dd['forEach'](_0x30c360=>{const _0x11ed1b=_0x456a98;_0x30c360[_0x11ed1b(0x10c)]=_0x14ffe6[_0x11ed1b(0xac)](_0x39ad74=>_0x39ad74['id']===_0x30c360[_0x11ed1b(0xe9)]);}),_0x29a063[_0x456a98(0xfe)][_0x456a98(0xa9)]!==_0x456a98(0xb5)&&_0x3934dd['forEach'](_0xbd1a7c=>{const _0x325a79=_0x456a98;_0xbd1a7c[_0x325a79(0x10c)]&&_0xbd1a7c['userInfo']['email']&&(_0xbd1a7c[_0x325a79(0x10c)][_0x325a79(0x9f)]=_0xbd1a7c['userInfo'][_0x325a79(0x9f)][_0x325a79(0x9a)](/(.{2}).+(.{2}@.+)/,'$1****$2'));}),{'rows':_0x3934dd,'count':_0x48d323};}catch(_0x442ca3){throw new common_1['HttpException'](_0x456a98(0xfb),common_1[_0x456a98(0xe8)][_0x456a98(0xc9)]);}}async['recDraw'](_0x5dfdee){const _0x391145=_0x5ed21f,{id:_0xa1d1c1}=_0x5dfdee,_0x1b7b72=await this['midjourneyEntity'][_0x391145(0xa3)]({'where':{'id':_0xa1d1c1,'status':0x3,'isDelete':0x0}});if(!_0x1b7b72)throw new common_1[(_0x391145(0xa7))](_0x391145(0x104),common_1[_0x391145(0xe8)][_0x391145(0xc9)]);const {rec:_0x5d35e8}=_0x1b7b72,_0x37bf8c=await this[_0x391145(0xfc)][_0x391145(0x12a)]({'id':_0xa1d1c1},{'rec':_0x5d35e8===0x1?0x0:0x1});if(_0x37bf8c[_0x391145(0xcd)]>0x0)return _0x391145(0xdf);}async[_0x5ed21f(0x8e)](){const _0x33d3c8=_0x5ed21f;try{await this['midjourneyEntity'][_0x33d3c8(0x12a)]({'status':0x2},{'status':0x4});}catch(_0x485b65){console[_0x33d3c8(0xd5)]('TODO->error:\x20',_0x485b65);}}async[_0x5ed21f(0x10b)](_0x16b0cc,_0x16b364){const _0x3394c8=_0x5ed21f,{id:_0x43bb89}=_0x16b364;if(!_0x43bb89)throw new common_1[(_0x3394c8(0xa7))]('非法操作!',common_1[_0x3394c8(0xe8)][_0x3394c8(0xc9)]);const _0x5bd2af=await this[_0x3394c8(0xfc)][_0x3394c8(0x128)]({'id':_0x43bb89});if(_0x5bd2af['affected']>0x0)return _0x3394c8(0xc2);else throw new common_1[(_0x3394c8(0xa7))](_0x3394c8(0xdb),common_1[_0x3394c8(0xe8)][_0x3394c8(0xc9)]);}async[_0x5ed21f(0x91)](_0x57c52f,_0x538cf8){const _0x4b3242=_0x5ed21f;try{const {prompt:_0x309c4a,status:_0x7e6718,isCarryParams:_0x612333,title:_0x2902dc,order:_0x5b1ae7,id:_0x123be8,aspect:_0x2db5c9}=_0x538cf8;return _0x123be8?await this['mjPromptsEntity']['update']({'id':_0x123be8},{'prompt':_0x309c4a,'status':_0x7e6718,'isCarryParams':_0x612333,'order':_0x5b1ae7,'aspect':_0x2db5c9}):await this[_0x4b3242(0x10d)][_0x4b3242(0x124)]({'prompt':_0x309c4a,'status':_0x7e6718,'isCarryParams':_0x612333,'title':_0x2902dc,'order':_0x5b1ae7,'aspect':_0x2db5c9});}catch(_0x1201b4){console[_0x4b3242(0xd5)](_0x4b3242(0x99),_0x1201b4);}}async[_0x5ed21f(0x126)](_0x49a0d9,_0x2b6bfe){const _0x3f1e93=_0x5ed21f,{id:_0x2b826e}=_0x2b6bfe;if(!_0x2b826e)throw new common_1[(_0x3f1e93(0xa7))]('非法操作!',common_1['HttpStatus'][_0x3f1e93(0xc9)]);return await this['mjPromptsEntity'][_0x3f1e93(0x128)]({'id':_0x2b826e});}async[_0x5ed21f(0xb6)](){const _0x5ad36e=_0x5ed21f;return await this[_0x5ad36e(0x10d)][_0x5ad36e(0xac)]({'order':{'order':_0x5ad36e(0xf2)}});}async[_0x5ed21f(0xd4)](_0x5c73a3){const _0xf9332b=_0x5ed21f,{url:_0x4268e4}=_0x5c73a3;if(!_0x4268e4)return;const _0x1d2725=await axios_1[_0xf9332b(0xeb)]['get'](_0x4268e4,{'responseType':_0xf9332b(0xf9)}),_0x27e002=Buffer[_0xf9332b(0xff)](_0x1d2725[_0xf9332b(0xcc)])['toString'](_0xf9332b(0x11f));return _0x27e002;}};function _0x1f3a(_0x332f2b,_0x533d94){const _0x55104b=_0x5510();return _0x1f3a=function(_0x1f3a12,_0xb065b2){_0x1f3a12=_0x1f3a12-0x8e;let _0x3eb979=_0x55104b[_0x1f3a12];return _0x3eb979;},_0x1f3a(_0x332f2b,_0x533d94);}MidjourneyService=__decorate([(0x0,common_1[_0x5ed21f(0x129)])(),__param(0x0,(0x0,typeorm_1[_0x5ed21f(0x11e)])(midjourney_entity_1[_0x5ed21f(0xc7)])),__param(0x1,(0x0,typeorm_1['InjectRepository'])(user_entity_1[_0x5ed21f(0x8f)])),__param(0x2,(0x0,typeorm_1[_0x5ed21f(0x11e)])(prompt_entity_1[_0x5ed21f(0x123)])),__metadata('design:paramtypes',[typeorm_2[_0x5ed21f(0xbc)],typeorm_2['Repository'],typeorm_2[_0x5ed21f(0xbc)],globalConfig_service_1[_0x5ed21f(0x116)],upload_service_1[_0x5ed21f(0x10e)],userBalance_service_1[_0x5ed21f(0x114)],redisCache_service_1[_0x5ed21f(0x103)]])],MidjourneyService),exports['MidjourneyService']=MidjourneyService;