Skip to content

Commit af9495e

Browse files
author
lrhh123
committed
fix: 修复全局消息无法匹配到的 BUG
1 parent 40f4ad6 commit af9495e

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/main/backend/controllers/autoReplyController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ExcelJS from 'exceljs';
22
import fs from 'fs';
3+
import { Op } from 'sequelize';
34
import { AutoReply } from '../entities/autoReply';
45
import { ALL_PLATFORMS } from '../constants';
56
import { getTempPath } from '../../utils';
@@ -146,7 +147,9 @@ export class AutoReplyController {
146147

147148
const globalKeywords = await AutoReply.findAll({
148149
where: {
149-
platform_id: '',
150+
platform_id: {
151+
[Op.or]: [null, ''],
152+
},
150153
},
151154
});
152155

src/main/backend/services/strategyService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class StrategyService {
8484
const data = await this.emitAndWait<Platform[]>(
8585
'strategyService-getAllPlatforms',
8686
);
87-
return data;
87+
return data.length > 0 ? data : ALL_PLATFORMS;
8888
} catch (error) {
8989
console.error('Failed to update strategies', error);
9090
return ALL_PLATFORMS;

src/renderer/pages/Home/EditKeyword.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ const EditKeyword = ({
7474
}
7575

7676
setPtf(editKeyword?.platform_id || '');
77+
7778
if (editKeyword) {
78-
setIsGlobal(editKeyword.platform_id === '');
79+
setIsGlobal(!editKeyword.platform_id);
7980
}
8081
}, [editKeyword]);
8182

0 commit comments

Comments
 (0)