|
|
@@ -37,17 +37,22 @@ export const TEMPLATE_TYPE_MAP: Record<TemplateType, string> = {
|
|
|
[TemplateType.HOLIDAY_CELEBRATION]: "节日/特殊日庆贺",
|
|
|
};
|
|
|
|
|
|
-// 定义消息模板的接口
|
|
|
+// 定义消息模板的接口,并新增字段
|
|
|
export interface IMessageTemplate extends Document {
|
|
|
templateName: string;
|
|
|
templateType: TemplateType; // 新增字段:模板类型
|
|
|
messageTitle: ILocalizedStrings;
|
|
|
messageContent: ILocalizedStrings;
|
|
|
+ image?: string; // 通知图片URL
|
|
|
+ bigger?: boolean; // 消息是否允许展开
|
|
|
+ action?: string; // 客户端收到消息后的行为
|
|
|
+ param?: string; // 消息参数
|
|
|
+ extend?: string; // 消息扩展参数
|
|
|
createdAt: Date;
|
|
|
updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
-// 定义消息模板的 Mongoose Schema
|
|
|
+// 定义消息模板的 Mongoose Schema,并新增字段
|
|
|
const MessageTemplateSchema: Schema = new Schema(
|
|
|
{
|
|
|
templateName: { type: String, required: true, unique: true, trim: true }, // 模板的唯一名称,方便在代码中引用
|
|
|
@@ -59,6 +64,11 @@ const MessageTemplateSchema: Schema = new Schema(
|
|
|
},
|
|
|
messageTitle: { type: Object, of: String, required: true }, // 消息标题,使用嵌套对象支持多语言
|
|
|
messageContent: { type: Object, of: String, required: true }, // 消息内容,使用嵌套对象支持多语言
|
|
|
+ image: { type: String }, // 通知图片URL
|
|
|
+ bigger: { type: Boolean, default: false }, // 消息是否允许展开
|
|
|
+ action: { type: String, default: "go/app" }, // 客户端收到消息后的行为
|
|
|
+ param: { type: String }, // 消息参数
|
|
|
+ extend: { type: String }, // 消息扩展参数
|
|
|
},
|
|
|
{
|
|
|
timestamps: true, // 自动添加 createdAt 和 updatedAt 字段
|