feat(medications): 实现V2版本药品AI分析功能及结构化数据支持
- 新增 V2 版药品分析服务,通过 AI 生成包含适用人群、副作用等字段的结构化 JSON 数据 - 添加 `POST :id/ai-analysis/v2` 接口,集成用户免费次数校验与自动扣费逻辑 - 在药品创建流程中增加异步触发自动 AI 分析的机制 - fix(users): 修复 Apple 登录未获取到邮箱时的报错问题,改为自动生成随机唯一邮箱 - perf(medications): 将服药提醒定时任务的检查频率调整为每 5 分钟一次 - refactor(push-notifications): 移除不再使用的 PushTestService
This commit is contained in:
@@ -538,10 +538,14 @@ export class UsersService {
|
||||
if (!user) {
|
||||
// 创建新用户
|
||||
const userName = appleLoginDto.name || applePayload.email?.split('@')[0] || '用户';
|
||||
const userEmail = appleLoginDto.email || applePayload.email || '';
|
||||
|
||||
|
||||
// 如果无法获取用户邮箱,生成一个随机邮箱
|
||||
let userEmail = appleLoginDto.email || applePayload.email || '';
|
||||
if (!userEmail) {
|
||||
throw new BadRequestException('无法获取用户邮箱信息');
|
||||
// 使用用户ID生成唯一的随机邮箱
|
||||
const randomString = Math.random().toString(36).substring(2, 10);
|
||||
userEmail = `${userId.substring(0, 8)}_${randomString}@outlive.com`;
|
||||
this.logger.log(`为用户 ${userId} 生成随机邮箱: ${userEmail}`);
|
||||
}
|
||||
|
||||
const memberNumber = await this.assignMemberNumber();
|
||||
|
||||
Reference in New Issue
Block a user