This commit is contained in:
vastxie
2024-01-27 00:40:50 +08:00
parent af6eedafa0
commit fa238c1f03
160 changed files with 1160 additions and 1122 deletions

View File

@@ -92,6 +92,7 @@ let MidjourneyService = class MidjourneyService {
await this.updateDrawData(jobData, drawRes);
this.lockPrompt = this.lockPrompt.filter((item) => item !== drawInfo.randomDrawId);
}
this.drawSuccess(jobData);
return true;
}
catch (error) {
@@ -754,10 +755,15 @@ let MidjourneyService = class MidjourneyService {
}
async drawFailed(jobData) {
const { id, userId, action } = jobData;
const amount = action === 2 ? 1 : 4;
await this.userBalanceService.refundMjBalance(userId, amount);
await this.midjourneyEntity.update({ id }, { status: 4 });
}
async drawSuccess(jobData) {
const { id, userId, action } = jobData;
const amount = action === 2 ? 1 : 4;
common_1.Logger.debug(`绘画完成,执行扣费,扣除费用:${amount}积分。`);
await this.userBalanceService.refundMjBalance(userId, -amount);
await this.midjourneyEntity.update({ id }, { status: 3 });
}
async getList(params) {
const { page = 1, size = 20, rec, userId, status } = params;
if (Number(size) === 999) {