|
|
@@ -38,7 +38,7 @@ export class MomentsService {
|
|
|
) {
|
|
|
setInterval(() => {
|
|
|
this.automaticallySendMoments();
|
|
|
- }, 60 * 60 * 1000);
|
|
|
+ }, 24 * 60 * 60 * 1000);
|
|
|
}
|
|
|
|
|
|
async findAll(req: PageRequest<Moments>, userId: number): Promise<Pagination<Moments>> {
|
|
|
@@ -105,13 +105,14 @@ export class MomentsService {
|
|
|
}
|
|
|
|
|
|
public async automaticallySendMoments() {
|
|
|
- const message = "请你发一条此时此刻的动态"
|
|
|
- const maskList = await this.maskRepository.createQueryBuilder().getMany()
|
|
|
- maskList.forEach(async mask => {
|
|
|
- const text = await this.chatService.sendMessage(mask.describe, message)
|
|
|
+ const message = "请你以类似于朋友圈的放肆发一条此时此刻的动态"
|
|
|
+ const chatRoleList = await this.chatRoleRepository.createQueryBuilder().getMany()
|
|
|
+
|
|
|
+ chatRoleList.forEach(async role => {
|
|
|
+ const text = await this.chatService.sendMessage(role.condition, message)
|
|
|
const momentsDto = new MomentsDto
|
|
|
momentsDto.content = text
|
|
|
- momentsDto.userId = mask.id
|
|
|
+ momentsDto.userId = role.id
|
|
|
await this.momentsRepository.save(momentsDto)
|
|
|
})
|
|
|
|