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
83 lines
2.2 KiB
JavaScript
83 lines
2.2 KiB
JavaScript
/**
|
|
* 更新商品定价为 AI 维度主题
|
|
* 用法: node src/scripts/update-products.js
|
|
*/
|
|
require('dotenv').config();
|
|
const mongoose = require('mongoose');
|
|
const ShopItem = require('../models/ShopItem');
|
|
|
|
const DB_URI = process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/wdkj';
|
|
|
|
async function main() {
|
|
await mongoose.connect(DB_URI);
|
|
console.log('数据库已连接');
|
|
|
|
// 清空旧商品
|
|
await ShopItem.deleteMany({});
|
|
console.log('旧商品已清空');
|
|
|
|
const products = [
|
|
{
|
|
itemId: 'pro_monthly',
|
|
name: 'AI维度 Pro (月付)',
|
|
description: '无限 AI 问答 + 全部知识解锁 + 趋势跟踪',
|
|
price: 1990, // 分 = ¥19.90
|
|
originalPrice: 2990,
|
|
type: 'subscription',
|
|
duration: 30,
|
|
sortOrder: 1,
|
|
status: 'active'
|
|
},
|
|
{
|
|
itemId: 'pro_quarterly',
|
|
name: 'AI维度 Pro (季付)',
|
|
description: '无限 AI 问答 + 全部知识解锁 + 趋势跟踪,享 8 折',
|
|
price: 4990, // ¥49.90
|
|
originalPrice: 5970,
|
|
type: 'subscription',
|
|
duration: 90,
|
|
sortOrder: 2,
|
|
status: 'active'
|
|
},
|
|
{
|
|
itemId: 'vip_monthly',
|
|
name: 'AI维度 VIP (月付)',
|
|
description: 'Pro + 工具教程 + 学习路径定制 + 社区 + 优先支持',
|
|
price: 3990, // ¥39.90
|
|
originalPrice: 5990,
|
|
type: 'subscription',
|
|
duration: 30,
|
|
sortOrder: 3,
|
|
status: 'active'
|
|
},
|
|
{
|
|
itemId: 'vip_quarterly',
|
|
name: 'AI维度 VIP (季付)',
|
|
description: 'VIP全套权益,享 8 折优惠',
|
|
price: 9990, // ¥99.90
|
|
originalPrice: 11970,
|
|
type: 'subscription',
|
|
duration: 90,
|
|
sortOrder: 4,
|
|
status: 'active'
|
|
},
|
|
{
|
|
itemId: 'noad',
|
|
name: '去广告',
|
|
description: '永久去除广告,纯净体验',
|
|
price: 1200, // ¥12.00
|
|
type: 'noad',
|
|
duration: 0,
|
|
sortOrder: 5,
|
|
status: 'active'
|
|
}
|
|
];
|
|
|
|
const result = await ShopItem.insertMany(products);
|
|
console.log(`✅ 已插入 ${result.length} 个商品:`);
|
|
result.forEach(p => console.log(` - ${p.name}: ¥${(p.price/100).toFixed(2)}`));
|
|
|
|
await mongoose.disconnect();
|
|
}
|
|
|
|
main().catch(e => { console.error('❌', e.message); process.exit(1); }); |