|
|
@@ -30,7 +30,7 @@ export class MiniAuthService {
|
|
|
|
|
|
if (!user) {
|
|
|
// 自动注册新用户
|
|
|
- user = await this.createMiniUser(openidInfo);
|
|
|
+ user = await this.createMiniUser(openidInfo, tenantId);
|
|
|
isNewUser = true;
|
|
|
}
|
|
|
|
|
|
@@ -116,8 +116,9 @@ export class MiniAuthService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async createMiniUser(openidInfo: { openid: string; unionid?: string }): Promise<UserEntityMt> {
|
|
|
+ private async createMiniUser(openidInfo: { openid: string; unionid?: string }, tenantId?: number): Promise<UserEntityMt> {
|
|
|
const user = this.userRepository.create({
|
|
|
+ tenantId: tenantId || 1, // 默认租户ID为1,如果未提供
|
|
|
username: `wx_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`,
|
|
|
password: '', // 小程序用户不需要密码
|
|
|
openid: openidInfo.openid,
|