diff --git a/AGENTS.md b/AGENTS.md index ad215f1..d156adb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -202,7 +202,7 @@ cd zhiyin-app && npm run build:mp-weixin && node scripts/upload-mp.js ## 六、项目状态与开发阶段 -**当前**: Phase 1.5(商业化 + 全量部署)— v1.0.17 +**当前**: Phase 1.5(商业化 + 全量部署)— v1.0.18(开发中) | 阶段 | 状态 | 关键交付 | |------|------|---------| @@ -259,7 +259,7 @@ VITE_APP_NAME=AI磁场 | 账号 | 密码 | 角色 | 说明 | |------|------|------|------| | `13701190814@139.com` | `Zhiyin2024!` | admin | 管理员,可访问管理后台 | -| `test@yzrcloud.cn` | `123456` | user | 测试账号 | +| `test@yzrcloud.cn` | `123456` | user | 测试账号(普通用户,含 5 引力值) | | `test@test.com` | 验证码 `123456` | admin | 旧管理员(dev 模式可用) | 管理后台路径:`/pages/admin/admin`,进入后自动验证管理员身份(`onMounted` → `doVerify`)。 @@ -270,7 +270,7 @@ VITE_APP_NAME=AI磁场 - 远程仓库: `http://127.0.0.1:2999/txai-dev/zhiyin.git`(本机 Gitea,带 token 认证) - 默认分支: `master` -- 最新 tag: `v1.0.16`(小程序上传版本 v1.0.17 源自 git tag + 末位自增 1) +- 最新 tag: `v1.0.17`(小程序上传版本 v1.0.18 源自 git tag v1.0.17 + 末位自增 1) --- diff --git a/backend/scripts/seed-test-user.ts b/backend/scripts/seed-test-user.ts new file mode 100644 index 0000000..3d00d6a --- /dev/null +++ b/backend/scripts/seed-test-user.ts @@ -0,0 +1,55 @@ +import { connect, disconnect } from 'mongoose' +import * as bcrypt from 'bcrypt' +import * as dotenv from 'dotenv' +import * as path from 'path' + +dotenv.config({ path: path.resolve(__dirname, '../.env') }) + +async function main() { + const uri = process.env.MONGODB_URI + if (!uri) { + console.error('MONGODB_URI not set') + process.exit(1) + } + + const conn = await connect(uri) + console.log('Connected to MongoDB') + + const users = conn.connection.db!.collection('users') + + const email = 'test@yzrcloud.cn' + const password = '123456' + const hashed = await bcrypt.hash(password, 10) + + const existing = await users.findOne({ email }) + if (existing) { + await users.updateOne( + { email }, + { $set: { password: hashed, nickname: '测试用户', role: 'user', gravity: 5, interviewCredits: 1, remaining: 3 } } + ) + console.log(`Updated test user: ${email}`) + } else { + await users.insertOne({ + email, + password: hashed, + nickname: '测试用户', + role: 'user', + gravity: 5, + interviewCredits: 1, + remaining: 3, + interviewCount: 0, + plan: 'free', + createdAt: new Date(), + updatedAt: new Date(), + }) + console.log(`Created test user: ${email}`) + } + + await disconnect() + console.log('Done') +} + +main().catch(err => { + console.error('Failed:', err) + process.exit(1) +}) diff --git a/backend/src/modules/user/user.schema.ts b/backend/src/modules/user/user.schema.ts index 1eaa013..09338c3 100644 --- a/backend/src/modules/user/user.schema.ts +++ b/backend/src/modules/user/user.schema.ts @@ -69,9 +69,8 @@ export class User { export const UserSchema = SchemaFactory.createForClass(User) -UserSchema.pre('save', function (next) { +UserSchema.pre('save', async function () { if (!this.phone && !this.wxOpenid && !this.email) { - return next(new Error('用户必须至少有一个联系方式(手机号/微信/邮箱)')) + throw new Error('用户必须至少有一个联系方式(手机号/微信/邮箱)') } - next() }) \ No newline at end of file diff --git a/docs/PROJECT-STATUS.md b/docs/PROJECT-STATUS.md index 2b4313c..1953253 100644 --- a/docs/PROJECT-STATUS.md +++ b/docs/PROJECT-STATUS.md @@ -1,8 +1,8 @@ -# 职引项目 · 状态报告 v4.8 +# 职引项目 · 状态报告 v4.9 -> **项目版本**: v4.8 -> **更新时间**: 2026-06-21 -> **项目状态**: ✅ SEO 优化 + 微信分享全面开启 + 全量部署 +> **项目版本**: v4.9 +> **更新时间**: 2026-06-22 +> **项目状态**: ✅ Mongoose 8 兼容修复 + v1.0.17 发布 --- @@ -224,6 +224,7 @@ | 日期 | 版本 | 变更内容 | 操作者 | |------|------|----------|--------| +| 2026-06-22 | **v4.9** | **Mongoose 8 兼容修复**(pre-save hook 回调→async);v1.0.17 tag 发布;测试账号 test@yzrcloud.cn 重建 | AI | | 2026-06-21 | **v4.8** | **SEO 全量优化**(canonical URL、robots.txt、sitemap.xml、结构化数据);**微信分享全面开启**(13 个页面 onShareAppMessage + onShareTimeline);**版本号自动注入**(Vite define __APP_VERSION__);**导航栏/Tab标题关键词优化**;manifest 描述更新;页面描述统一增强 | AI | | 2026-06-21 | v4.7 | 按量购买引力值体系重构(¥5/份取代月订阅);member.vue 完全重写;微信小程序剪贴板购买链路;客服按钮;管理后台字段全面完善;代码清理;测试数据清理;后端/H5/小程序全量部署上线 | AI | | 2026-06-19 | v4.6 | 引力值体系统一:VIP 取消无限面试改为月度引力值消耗;管理后台全面完善(搜索/筛选/分页/CRUD/分析tab/岗位描述字段) | AI |