Merge branch 'yongpxu-soul' of https://github.com/fnvtk/Mycontent into yongpxu-soul
# Conflicts: # .cursorrules resolved by yongpxu-soul version # miniprogram/app.json resolved by yongpxu-soul version # miniprogram/pages/index/index.js resolved by yongpxu-soul version # miniprogram/pages/index/index.wxml resolved by yongpxu-soul version # miniprogram/pages/my/my.js resolved by yongpxu-soul version # miniprogram/pages/my/my.wxml resolved by yongpxu-soul version # miniprogram/pages/my/my.wxss resolved by yongpxu-soul version # miniprogram/pages/settings/settings.js resolved by yongpxu-soul version # miniprogram/pages/settings/settings.wxml resolved by yongpxu-soul version # miniprogram/上传小程序.py resolved by yongpxu-soul version # next-project/app/admin/error.tsx resolved by yongpxu-soul version # next-project/app/admin/page.tsx resolved by yongpxu-soul version # next-project/app/api/book/all-chapters/route.ts resolved by yongpxu-soul version # next-project/lib/admin-auth.ts resolved by yongpxu-soul version # next-project/lib/db.ts resolved by yongpxu-soul version # next-project/lib/password.ts resolved by yongpxu-soul version # next-project/package.json resolved by yongpxu-soul version # next-project/scripts/.env.feishu.example resolved by yongpxu-soul version # next-project/scripts/fix_souladmin_login.sh resolved by yongpxu-soul version # next-project/scripts/send_poster_to_feishu.py resolved by yongpxu-soul version # next-project/scripts/upload_soul_article.sh resolved by yongpxu-soul version # soul-admin/dist/assets/index-CbOmKBRd.js resolved by yongpxu-soul version # soul-admin/dist/index.html resolved by yongpxu-soul version # 开发文档/10、项目管理/产研团队 第21场 20260129 许永平.txt resolved by yongpxu-soul version # 开发文档/5、接口/配置清单-完整版.md resolved by yongpxu-soul version # 开发文档/服务器管理/references/端口配置表.md resolved by yongpxu-soul version
This commit is contained in:
@@ -115,6 +115,47 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
// VIP会员字段
|
||||
if (!migration || migration === 'vip_fields') {
|
||||
const vipFields = [
|
||||
{ name: 'is_vip', def: "BOOLEAN DEFAULT FALSE COMMENT 'VIP会员'" },
|
||||
{ name: 'vip_expire_date', def: "TIMESTAMP NULL COMMENT 'VIP到期时间'" },
|
||||
{ name: 'vip_name', def: "VARCHAR(100) COMMENT '会员真实姓名'" },
|
||||
{ name: 'vip_project', def: "VARCHAR(200) COMMENT '会员项目名称'" },
|
||||
{ name: 'vip_contact', def: "VARCHAR(100) COMMENT '会员联系方式'" },
|
||||
{ name: 'vip_avatar', def: "VARCHAR(500) COMMENT '会员展示头像'" },
|
||||
{ name: 'vip_bio', def: "VARCHAR(500) COMMENT '会员简介'" },
|
||||
]
|
||||
let addedCount = 0
|
||||
let existCount = 0
|
||||
for (const field of vipFields) {
|
||||
try {
|
||||
await query(`SELECT ${field.name} FROM users LIMIT 1`)
|
||||
existCount++
|
||||
} catch {
|
||||
try {
|
||||
await query(`ALTER TABLE users ADD COLUMN ${field.name} ${field.def}`)
|
||||
addedCount++
|
||||
} catch (e: any) {
|
||||
if (e.code !== 'ER_DUP_FIELDNAME') {
|
||||
results.push(`⚠️ 添加VIP字段 ${field.name} 失败: ${e.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 扩展 orders.product_type 支持 vip
|
||||
try {
|
||||
await query(`ALTER TABLE orders MODIFY COLUMN product_type ENUM('section', 'fullbook', 'match', 'vip') NOT NULL`)
|
||||
results.push('✅ orders.product_type 已支持 vip')
|
||||
} catch (e: any) {
|
||||
results.push('ℹ️ orders.product_type 更新跳过: ' + e.message)
|
||||
}
|
||||
|
||||
if (addedCount > 0) results.push(`✅ VIP字段新增 ${addedCount} 个`)
|
||||
if (existCount > 0) results.push(`ℹ️ VIP字段已有 ${existCount} 个存在`)
|
||||
}
|
||||
|
||||
// 用户标签定义表
|
||||
if (!migration || migration === 'user_tag_definitions') {
|
||||
try {
|
||||
@@ -189,7 +230,7 @@ export async function GET() {
|
||||
|
||||
// 检查用户表字段
|
||||
const userFields: Record<string, boolean> = {}
|
||||
const checkFields = ['ckb_user_id', 'ckb_synced_at', 'ckb_tags', 'tags', 'merged_tags']
|
||||
const checkFields = ['ckb_user_id', 'ckb_synced_at', 'ckb_tags', 'tags', 'merged_tags', 'is_vip', 'vip_expire_date', 'vip_name']
|
||||
|
||||
for (const field of checkFields) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user