All checks were successful
Build and Deploy / deploy (push) Successful in 1m19s
合并微信/邮件通知日志,支持 H5 双通道订阅、系统发信与操作日志摘要;上线前执行 sql/migrate_order_notify_all_20261121.sql。 Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using Fake.DependencyInjection;
|
|
using Oms.Domain.SystemAggregate.Entities;
|
|
using Oms.Domain.SystemAggregate.Repositories;
|
|
using Oms.SqlSugarCore.Repositories;
|
|
|
|
namespace Oms.SqlSugarCore.System;
|
|
|
|
public class OrderNotifyLogRepository
|
|
: OmsSqlSugarRepository<OrderNotifyLog>,
|
|
IOrderNotifyLogRepository,
|
|
IScopedDependency
|
|
{
|
|
public async Task<bool> ExistsRecentSentAsync(
|
|
int orderId,
|
|
string eventCode,
|
|
string channel,
|
|
DateTime since,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
var code = eventCode.Trim();
|
|
var ch = channel.Trim();
|
|
return await AnyAsync(
|
|
x => x.OrderId == orderId
|
|
&& x.EventCode == code
|
|
&& x.Channel == ch
|
|
&& x.CreateTime >= since
|
|
&& x.Status == "sent",
|
|
cancellationToken);
|
|
}
|
|
|
|
public async Task<List<OrderNotifyLog>> ListByOrderIdAsync(
|
|
int orderId,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
var list = await GetListAsync(x => x.OrderId == orderId, cancellationToken: cancellationToken);
|
|
return list
|
|
.OrderByDescending(x => x.CreateTime)
|
|
.ThenByDescending(x => x.Id)
|
|
.ToList();
|
|
}
|
|
}
|