fix: 修改种子用户推荐码为SEED01(6字符)
生产环境的ReferralCode值对象限制推荐码必须恰好6个字符, GENESIS(7字符)不符合格式要求,改为SEED01 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bee48e8b87
commit
6039bffa73
|
|
@ -51,9 +51,9 @@ const SYSTEM_ACCOUNTS = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
userId: BigInt(5),
|
userId: BigInt(5),
|
||||||
accountSequence: 'S0000000005', // GENESIS种子用户
|
accountSequence: 'S0000000005', // 种子用户
|
||||||
nickname: 'GENESIS种子用户',
|
nickname: '种子用户',
|
||||||
referralCode: 'GENESIS',
|
referralCode: 'SEED01',
|
||||||
status: 'SYSTEM',
|
status: 'SYSTEM',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ import { PrismaClient } from '@prisma/client';
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// GENESIS 系统种子用户
|
// 系统种子用户
|
||||||
// 用于为未来的注册用户提供初始推荐码
|
// 用于为未来的注册用户提供初始推荐码
|
||||||
// ============================================
|
// ============================================
|
||||||
const GENESIS_USER = {
|
const SEED_USER = {
|
||||||
userId: BigInt(5),
|
userId: BigInt(5),
|
||||||
accountSequence: 'S0000000005',
|
accountSequence: 'S0000000005',
|
||||||
myReferralCode: 'GENESIS',
|
myReferralCode: 'SEED01',
|
||||||
usedReferralCode: null, // 根节点无推荐人
|
usedReferralCode: null, // 根节点无推荐人
|
||||||
referrerId: null, // 根节点
|
referrerId: null, // 根节点
|
||||||
rootUserId: null,
|
rootUserId: null,
|
||||||
|
|
@ -22,20 +22,20 @@ const GENESIS_USER = {
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log('Seeding referral-service database...');
|
console.log('Seeding referral-service database...');
|
||||||
|
|
||||||
// 创建 GENESIS 推荐关系
|
// 创建种子用户推荐关系
|
||||||
await prisma.referralRelationship.upsert({
|
await prisma.referralRelationship.upsert({
|
||||||
where: { userId: GENESIS_USER.userId },
|
where: { userId: SEED_USER.userId },
|
||||||
update: GENESIS_USER,
|
update: SEED_USER,
|
||||||
create: GENESIS_USER,
|
create: SEED_USER,
|
||||||
});
|
});
|
||||||
console.log(' - Created GENESIS referral relationship (userId=5, code=GENESIS)');
|
console.log(' - Created seed user referral relationship (userId=5, code=SEED01)');
|
||||||
|
|
||||||
// 创建 GENESIS 的团队统计
|
// 创建种子用户的团队统计
|
||||||
await prisma.teamStatistics.upsert({
|
await prisma.teamStatistics.upsert({
|
||||||
where: { userId: GENESIS_USER.userId },
|
where: { userId: SEED_USER.userId },
|
||||||
update: {},
|
update: {},
|
||||||
create: {
|
create: {
|
||||||
userId: GENESIS_USER.userId,
|
userId: SEED_USER.userId,
|
||||||
directReferralCount: 0,
|
directReferralCount: 0,
|
||||||
totalTeamCount: 0,
|
totalTeamCount: 0,
|
||||||
selfPlantingCount: 0,
|
selfPlantingCount: 0,
|
||||||
|
|
@ -51,10 +51,10 @@ async function main() {
|
||||||
cityTeamPercentage: 0,
|
cityTeamPercentage: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(' - Created GENESIS team statistics');
|
console.log(' - Created seed user team statistics');
|
||||||
|
|
||||||
console.log('Database seeded successfully!');
|
console.log('Database seeded successfully!');
|
||||||
console.log('- Created 1 GENESIS seed user for initial referrals');
|
console.log('- Created 1 seed user (SEED01) for initial referrals');
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue