Zxd.Core/code/Zxd.Core.Domain/SmsRecordDomain.cs

59 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zxd.Core.Domain.Dto.Dg;
using Zxd.Entity.dg;
namespace Zxd.Core.Domain
{
public class SmsRecordDomain : ISmsRecordDomain
{
private readonly IBaseRepository<DgDbContext> _dgRepository;
public SmsRecordDomain(
IBaseRepository<DgDbContext> dgRepository)
{
_dgRepository = dgRepository;
}
public async Task<List<Sms_RecordsDto>> GetSmsRecordsList(string umid)
{
if (string.IsNullOrEmpty(umid))
{
throw new ApiException("umid不能为空");
}
DateTime dateTime = DateTime.Now.AddDays(-10);//超过10天的数据不做查找
var query = _dgRepository.GetRepository<Sms_Records>().Query();
var channel = _dgRepository.GetRepository<Sms_Channel>().Query();
var xx = (from a in query
join b in channel on a.channel_id equals b.id
where a.umid == umid && a.send_time >= dateTime
select new Sms_RecordsDto()
{
channel_id = a.channel_id,
id = a.id,
channel_name = b.channel_name,
mobile = a.phone,
out_trade_no = a.out_trade_no,
receipt_code = a.receipt_code,
receipt_status = a.receipt_status,
receipt_success = a.receipt_success,
receipt_time = a.receipt_time,
send_state = true,
send_time = a.send_time,
sms_content = a.sms_content,
sms_temp_type_id = 0,
template_id = a.template_id,
trade_no = a.trade_no,
umid = a.umid,
}
).OrderByDescending(m => m.id);
return xx.ToList();
}
}
}