24cd9cef53
- uni-app Vue3 frontend with dark glassmorphism theme - 5 AI dimensions: Origin / Development / Current / Learning / Trend - AI Chat system prompt updated from geometry to AI - 23 AI knowledge articles initialized in DB - Trend API + cron job for daily news - Product pricing (Pro ¥19.9, VIP ¥39.9) - Pinia stores + API utilities - AGENTS.md documentation
121 lines
2.6 KiB
JavaScript
Executable File
121 lines
2.6 KiB
JavaScript
Executable File
const mongoose = require('mongoose');
|
|
|
|
/**
|
|
* 拼音内容模型
|
|
* 存储拼音字母的基础信息、音频、口型图、关联词语等
|
|
*/
|
|
const pinyinContentSchema = new mongoose.Schema({
|
|
// 拼音符号,如 "b"
|
|
symbol: {
|
|
type: String,
|
|
required: true,
|
|
unique: true,
|
|
trim: true
|
|
},
|
|
|
|
// 拼音类型:initial(声母)/final(韵母)/overall(整体认读)
|
|
type: {
|
|
type: String,
|
|
required: true,
|
|
enum: ['initial', 'final', 'overall']
|
|
},
|
|
|
|
// 拼音名称,如 "玻"
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
trim: true
|
|
},
|
|
|
|
// 发音音频URL
|
|
audioUrl: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
|
|
// 口型示意图URL
|
|
mouthImage: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
|
|
// 发音方法描述
|
|
pronunciation: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
|
|
// 显示顺序
|
|
order: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
|
|
// 是否免费
|
|
isFree: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
|
|
// 状态:active(启用)/inactive(禁用)
|
|
status: {
|
|
type: String,
|
|
enum: ['active', 'inactive'],
|
|
default: 'active'
|
|
},
|
|
|
|
// 相关词语
|
|
words: [{
|
|
word: { type: String, required: true }, // 汉字
|
|
pinyin: { type: String, required: true }, // 拼音
|
|
image: { type: String, default: '' }, // 图片URL
|
|
audioUrl: { type: String, default: '' }, // 音频URL
|
|
meaning: { type: String, default: '' } // 释义
|
|
}],
|
|
|
|
// 关联游戏配置
|
|
games: [{
|
|
type: {
|
|
type: String,
|
|
enum: ['match', 'tone', 'find', 'puzzle', 'mimic', 'runner']
|
|
},
|
|
config: { type: mongoose.Schema.Types.Mixed, default: {} },
|
|
isEnabled: { type: Boolean, default: true }
|
|
}],
|
|
|
|
// 探索区域配置
|
|
exploreAreas: {
|
|
audio: { type: Boolean, default: true }, // 声音发现
|
|
mouth: { type: Boolean, default: true }, // 口型观察
|
|
speak: { type: Boolean, default: true }, // 语音互动
|
|
write: { type: Boolean, default: true }, // 书写体验
|
|
game: { type: Boolean, default: true }, // 趣味互动
|
|
words: { type: Boolean, default: true } // 词语发现
|
|
},
|
|
|
|
// 创建时间
|
|
createdAt: {
|
|
type: Date,
|
|
default: Date.now
|
|
},
|
|
|
|
// 更新时间
|
|
updatedAt: {
|
|
type: Date,
|
|
default: Date.now
|
|
}
|
|
});
|
|
|
|
// 索引
|
|
pinyinContentSchema.index({ type: 1, order: 1 });
|
|
pinyinContentSchema.index({ status: 1 });
|
|
pinyinContentSchema.index({ isFree: 1 });
|
|
|
|
// 更新中间件
|
|
pinyinContentSchema.pre('save', function(next) {
|
|
this.updatedAt = Date.now();
|
|
next();
|
|
});
|
|
|
|
module.exports = mongoose.model('PinyinContent', pinyinContentSchema);
|