feat: 新增上传地址管理、答题评分及社区消息功能
1. 新增UploadDomain实体与上传地址分配逻辑,为用户分配可用上传域名 2. 新增绑定期刊消息推送,通过RabbitMQ传递绑定信息 3. 优化答题评分逻辑,新增完成度阈值判定与社区消息插入 4. 新增配置项用于评分阈值配置 5. 补充相关DTO与实体类字段,完善数据传输与存储
This commit is contained in:
@ -19,6 +19,7 @@ namespace QYZH.InteractiveMagazine.Service;
|
||||
/// </summary>
|
||||
public class WeChatAuthService(
|
||||
BaseRepository<WxUser> wxUserRepository,
|
||||
BaseRepository<UploadDomain> uploadDomainRepository,
|
||||
IConfiguration configuration,
|
||||
ILogger<WeChatAuthService> logger,
|
||||
IPetService petService)
|
||||
@ -260,7 +261,27 @@ public class WeChatAuthService(
|
||||
UpdatedAt = DateTime.Now
|
||||
};
|
||||
|
||||
await wxUserRepository.Context.Insertable(newUser).ExecuteReturnIdentityAsync();
|
||||
await UseTranAsync(async () =>
|
||||
{
|
||||
var uploadDomain = await uploadDomainRepository.Queryable()
|
||||
.Where(d => d.Status == 1 && !d.IsDeleted)
|
||||
.OrderBy(d => d.AssignedCount, SqlSugar.OrderByType.Asc)
|
||||
.OrderBy(d => d.Id, SqlSugar.OrderByType.Asc)
|
||||
.FirstAsync();
|
||||
|
||||
BusinessException.ThrowIf(uploadDomain == null, "暂无可用上传地址,请联系管理员", ResultCode.UNPROCESSABLE_ENTITY);
|
||||
|
||||
newUser.UploadDomain = uploadDomain!.Domain;
|
||||
|
||||
await wxUserRepository.Context.Insertable(newUser).ExecuteCommandAsync();
|
||||
|
||||
await uploadDomainRepository.Updateable()
|
||||
.SetColumns(d => d.AssignedCount == d.AssignedCount + 1)
|
||||
.SetColumns(d => d.UpdatedBy == wxUserId.ToString())
|
||||
.SetColumns(d => d.UpdatedAt == DateTime.Now)
|
||||
.Where(d => d.Id == uploadDomain.Id)
|
||||
.ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
logger.LogInformation("新用户创建成功,UserId: {UserId}, WxUserId: {WxUserId}, Name: {Name}",
|
||||
newUser.Id, wxUserId, input.Name);
|
||||
@ -431,7 +452,8 @@ public class WeChatAuthService(
|
||||
Type = user.Type.ToString(),
|
||||
Status = user.Status.ToString(),
|
||||
IsLastOnline = user.IsLastOnline,
|
||||
CreatedAt = user.CreatedAt
|
||||
CreatedAt = user.CreatedAt,
|
||||
UploadDomain = user.UploadDomain
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user