using CloudGaming.Core.Identity.Services;
using CloudGaming.Core;
using HZY.Framework.Core;
using HZY.Framework.Repository.EntityFramework.Interceptor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CloudGaming.Code.DataBaseModel;
public class CloudGamingAuditAop : AbstractFreeSqlAuditAop
{
///
/// 获取当前用户 id
///
///
protected override string? GetCurrentUserId()
{
try
{
using var scope = App.CreateScope();
var tokenService = scope?.ServiceProvider.GetService(); //
var id = tokenService?.GetAccountIdByToken();
return id == Guid.Empty || id == null ? null : id.ToString();
}
catch (Exception)
{
// ignored
return null;
}
}
///
/// 获取雪花id
///
///
protected override long GetSnowflakeId()
{
return Tools.GetNewId();
}
}