|
|
@@ -399,6 +399,7 @@ export class TaskService implements OnModuleInit {
|
|
|
|
|
|
async homeStatistics(req: any) {
|
|
|
let where = {}
|
|
|
+ let codeSum = '0'
|
|
|
const res = {
|
|
|
xData: [],
|
|
|
sentData: [],
|
|
|
@@ -426,16 +427,17 @@ export class TaskService implements OnModuleInit {
|
|
|
userId: Not(1),
|
|
|
createdAt: Between(sixDaysAgo, new Date())
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- await this.rcsNumberRepository
|
|
|
+ if (req.user.roles.includes('admin') || req.user.roles.includes('superApi')) {
|
|
|
+ codeSum = await this.rcsNumberRepository
|
|
|
.createQueryBuilder()
|
|
|
.select('count(1) as sum')
|
|
|
.where('rcsNumber.status = :status', { status: 'success' })
|
|
|
.andWhere('DATE(rcsNumber.createdAt) = CURDATE()')
|
|
|
.getRawOne().then((data) => {
|
|
|
- res.todayData.push(data.sum)
|
|
|
+ return data.sum
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return await this.taskRepository
|
|
|
@@ -458,7 +460,7 @@ export class TaskService implements OnModuleInit {
|
|
|
res.successData.push(item.success)
|
|
|
res.totalData.push(item.total)
|
|
|
if (moment(new Date()).format('MM-DD').includes(day)) {
|
|
|
- res.todayData.push(item.sent, item.success, item.total)
|
|
|
+ res.todayData.push(item.sent, item.success, item.total, codeSum)
|
|
|
}
|
|
|
})
|
|
|
}
|