|
|
@@ -327,6 +327,19 @@ export class TaskService implements OnModuleInit {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async unscheduledSending(id: number) {
|
|
|
+ const task = await this.taskRepository.findOneBy({ id })
|
|
|
+ if (task.status === TaskStatus.SCHEDULED) {
|
|
|
+ await this.taskRepository.update({ id }, { status: TaskStatus.IDLE, paid: false })
|
|
|
+ }
|
|
|
+ const costBalanceRecord = await this.balanceRecordRepository.findOneBy({
|
|
|
+ taskId: id,
|
|
|
+ type: BalanceType.CONSUMPTION
|
|
|
+ })
|
|
|
+ // 退款
|
|
|
+ await this.balanceService.feeRefund(task.userId, costBalanceRecord.amount, task.id)
|
|
|
+ }
|
|
|
+
|
|
|
async exportTaskItem(taskId: number) {
|
|
|
const workbook = new ExcelJS.Workbook()
|
|
|
const worksheet = workbook.addWorksheet('Sheet1')
|