fix: 修复默认版本号

This commit is contained in:
lrhh123
2024-07-02 00:05:06 +08:00
parent fbb02b544c
commit 41f0a6cf8d
4 changed files with 27 additions and 9 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ export function initPlugin(sequelize: Sequelize) {
},
version: {
type: DataTypes.STRING(255),
defaultValue: '1.2.0-beta.1',
defaultValue: '1.2.0',
allowNull: true,
},
source: {
+8 -1
View File
@@ -8,7 +8,7 @@ import { Sequelize } from 'sequelize';
import { Config, initConfig } from './entities/config';
import { initSession } from './entities/session';
import { initMessage } from './entities/message';
import { initPlugin } from './entities/plugin';
import { Plugin, initPlugin } from './entities/plugin';
import { initInstance } from './entities/instance';
import { Keyword, initKeyword } from './entities/keyword';
import { TransferKeyword, initTransfer } from './entities/transfer';
@@ -247,6 +247,13 @@ async function initDb(): Promise<void> {
];
await ReplaceKeyword.bulkCreate(replaces);
}
// 因为 Plugin 1.0.0 版本不支持了,这里直接删除
await Plugin.destroy({
where: {
version: '1.0.0',
},
});
}
(async () => {
+12 -7
View File
@@ -1,17 +1,22 @@
export const PluginExtraLib = `
type AppContext = {
app_name: string; // 当前应用名称
app_id: string; // 当前应用 ID
instance_id: string; // 当前客服实例 ID
username?: string; // 当前操作的用户名
platform?: string; // 当前所在平台
has_new_message?: boolean; // 是否有新消息
has_group_message?: boolean; // 是否有群消息
CTX_APP_NAME: string; // 当前应用名称
CTX_APP_ID: string; // 当前应用 ID
CTX_INSTANCE_ID: string; // 当前客服实例 ID
CTX_USERNAME?: string; // 当前操作的用户名
CTX_PLATFORM?: string; // 当前所在平台
CTX_HAS_NEW_MESSAGE?: boolean; // 是否有新消息
CTX_HAS_GROUP_MESSAGE?: boolean; // 是否有群消息
CTX_CURRENT_GOODS?: string; // 当前商品
CTX_CURRENT_GOODS_ID?: string; // 当前商品 ID
CTX_MEMBER_TAG?: string; // 会员标签
CTX_FAN_TAG?: string; // 粉丝标签
CTX_NEW_CUSTOMER_TAG?: string; // 新客标签
CTX_ORDER_STATUS?: string; // 订单状态
CTX_ORDER_ID?: string; // 订单 ID
CTX_ORDER_AMOUNT?: string; // PDD 平台特有 [订单金额]
CTX_GOODS_SPEC?: string; // PDD 平台特有 [商品规格]
CTX_LOGISTICS_STATUS?: string; // 物流状态
};
type RoleType = 'SELF' | 'OTHER' | 'SYSTEM';
@@ -66,6 +66,12 @@ const MessageModal = ({ isOpen, onClose }: MessageModalProps) => {
const handleSetDefault = () => {
// MockCtx 是一个 Map 对象
// 先清空所有上下文
// eslint-disable-next-line no-restricted-syntax
for (const key of ContextKeys) {
setContext(key, '');
}
// eslint-disable-next-line no-restricted-syntax
for (const [key, value] of MockCtx) {
setContext(key, value);