|
|
@@ -130,6 +130,7 @@ export class TaskService implements OnModuleInit {
|
|
|
} else if (phones.length < 100) {
|
|
|
throw new InternalServerErrorException('料子条数不能少于100条!')
|
|
|
}
|
|
|
+ task.message = task.message || ''
|
|
|
task.total = phones.length
|
|
|
task.country = phoneList.country
|
|
|
if (task.country) {
|
|
|
@@ -206,8 +207,10 @@ export class TaskService implements OnModuleInit {
|
|
|
}
|
|
|
|
|
|
getMessage(task: Task) {
|
|
|
- if (task.img) return ''
|
|
|
let message = task.message
|
|
|
+ if (!message) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
task.dynamicMessage?.forEach((dm) => {
|
|
|
if (dm.key && dm.values?.length > 0) {
|
|
|
message = message.replaceAll(`${dm.key}`, dm.values[Math.floor(Math.random() * dm.values.length)])
|
|
|
@@ -844,24 +847,6 @@ export class TaskService implements OnModuleInit {
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
- async sentHourStatistics() {
|
|
|
- const result = await this.taskItemRepository.query(`
|
|
|
- SELECT SUM(c) / 60 AS hour
|
|
|
- FROM (
|
|
|
- SELECT 1 AS c, UNIX_TIMESTAMP(sendAt) DIV 60 * 60 AS "time"
|
|
|
- FROM task_item
|
|
|
- WHERE sendAt >= CURDATE() - INTERVAL 1 DAY
|
|
|
- AND sendAt < CURDATE()
|
|
|
- AND status != 'idle'
|
|
|
- GROUP BY time
|
|
|
- ) tmp
|
|
|
- `)
|
|
|
-
|
|
|
- return {
|
|
|
- data: result[0]?.hour ?? 0
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
async sentCountryStatistics(req: any) {
|
|
|
let where = {}
|
|
|
if (req.user.roles.includes('api') || req.user.roles.includes('superApi')) {
|