Skip to content

Commit 41f0a6c

Browse files
author
lrhh123
committed
fix: 修复默认版本号
1 parent fbb02b5 commit 41f0a6c

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

src/main/backend/entities/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function initPlugin(sequelize: Sequelize) {
128128
},
129129
version: {
130130
type: DataTypes.STRING(255),
131-
defaultValue: '1.2.0-beta.1',
131+
defaultValue: '1.2.0',
132132
allowNull: true,
133133
},
134134
source: {

src/main/backend/ormconfig.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Sequelize } from 'sequelize';
88
import { Config, initConfig } from './entities/config';
99
import { initSession } from './entities/session';
1010
import { initMessage } from './entities/message';
11-
import { initPlugin } from './entities/plugin';
11+
import { Plugin, initPlugin } from './entities/plugin';
1212
import { initInstance } from './entities/instance';
1313
import { Keyword, initKeyword } from './entities/keyword';
1414
import { TransferKeyword, initTransfer } from './entities/transfer';
@@ -247,6 +247,13 @@ async function initDb(): Promise<void> {
247247
];
248248
await ReplaceKeyword.bulkCreate(replaces);
249249
}
250+
251+
// 因为 Plugin 1.0.0 版本不支持了,这里直接删除
252+
await Plugin.destroy({
253+
where: {
254+
version: '1.0.0',
255+
},
256+
});
250257
}
251258

252259
(async () => {

src/renderer/common/utils/constants/index.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
export const PluginExtraLib = `
22
type AppContext = {
3-
app_name: string; // 当前应用名称
4-
app_id: string; // 当前应用 ID
5-
instance_id: string; // 当前客服实例 ID
6-
username?: string; // 当前操作的用户名
7-
platform?: string; // 当前所在平台
8-
has_new_message?: boolean; // 是否有新消息
9-
has_group_message?: boolean; // 是否有群消息
3+
CTX_APP_NAME: string; // 当前应用名称
4+
CTX_APP_ID: string; // 当前应用 ID
5+
CTX_INSTANCE_ID: string; // 当前客服实例 ID
6+
CTX_USERNAME?: string; // 当前操作的用户名
7+
CTX_PLATFORM?: string; // 当前所在平台
8+
CTX_HAS_NEW_MESSAGE?: boolean; // 是否有新消息
9+
CTX_HAS_GROUP_MESSAGE?: boolean; // 是否有群消息
1010
CTX_CURRENT_GOODS?: string; // 当前商品
1111
CTX_CURRENT_GOODS_ID?: string; // 当前商品 ID
1212
CTX_MEMBER_TAG?: string; // 会员标签
1313
CTX_FAN_TAG?: string; // 粉丝标签
1414
CTX_NEW_CUSTOMER_TAG?: string; // 新客标签
15+
CTX_ORDER_STATUS?: string; // 订单状态
16+
CTX_ORDER_ID?: string; // 订单 ID
17+
CTX_ORDER_AMOUNT?: string; // PDD 平台特有 [订单金额]
18+
CTX_GOODS_SPEC?: string; // PDD 平台特有 [商品规格]
19+
CTX_LOGISTICS_STATUS?: string; // 物流状态
1520
};
1621
1722
type RoleType = 'SELF' | 'OTHER' | 'SYSTEM';

src/renderer/settings-window/components/MessageModal/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ const MessageModal = ({ isOpen, onClose }: MessageModalProps) => {
6666

6767
const handleSetDefault = () => {
6868
// MockCtx 是一个 Map 对象
69+
// 先清空所有上下文
70+
// eslint-disable-next-line no-restricted-syntax
71+
for (const key of ContextKeys) {
72+
setContext(key, '');
73+
}
74+
6975
// eslint-disable-next-line no-restricted-syntax
7076
for (const [key, value] of MockCtx) {
7177
setContext(key, value);

0 commit comments

Comments
 (0)