You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.7 KiB
93 lines
3.7 KiB
using System;
|
|
using System.Threading.Tasks;
|
|
using Znyc.Cloudcar.Admin.Commons;
|
|
using Znyc.Cloudcar.Admin.Commons.Mapping;
|
|
using Znyc.Cloudcar.Admin.Commons.Pages;
|
|
using Znyc.Cloudcar.Admin.Commons.Services;
|
|
using Znyc.Cloudcar.Admin.Security.Dtos;
|
|
using Znyc.Cloudcar.Admin.Security.Entitys;
|
|
using Znyc.Cloudcar.Admin.Security.IRepositories;
|
|
using Znyc.Cloudcar.Admin.Security.IServices;
|
|
|
|
namespace Znyc.Cloudcar.Admin.Security.Services
|
|
{
|
|
/// <summary>
|
|
/// 充值服务
|
|
/// </summary>
|
|
public class PaymentRecordService : BaseService<PaymentRecordEntity, PaymentRecordOutputDto, long>, IPaymentRecordService
|
|
{
|
|
private readonly IPaymentRecordRepository _PaymentRecordRepository;
|
|
private readonly ICurrencyRepository _currencyRepository;
|
|
private readonly IUserRepository _userRepository;
|
|
|
|
public PaymentRecordService(
|
|
IUserRepository userRepository,
|
|
ICurrencyRepository currencyRepository,
|
|
IPaymentRecordRepository PaymentRecordRepository
|
|
) : base(PaymentRecordRepository)
|
|
{
|
|
_userRepository = userRepository;
|
|
_currencyRepository = currencyRepository;
|
|
_PaymentRecordRepository = PaymentRecordRepository;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 云币列表
|
|
/// </summary>
|
|
/// <param name="search"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
public async Task<PageResult<PaymentRecordOutputDto>> FindWithPagerSearchAsync(SearchPaymentRecordModel search)
|
|
{
|
|
bool order = search.Order == "asc" ? false : true;
|
|
string where = GetDataPrivilege(false);
|
|
@where += " and PayStatus=20";
|
|
|
|
//金额类型
|
|
if (search.PaymentMoney > 0)
|
|
{
|
|
@where += $" and PaymentMoney={search.PaymentMoney}";
|
|
}
|
|
//起始时间
|
|
if (!string.IsNullOrEmpty(search.StartTime))
|
|
{
|
|
@where += $" and CreatedTime >='{search.StartTime} 00:00:00'";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(search.EndTime))
|
|
{
|
|
@where += $" and CreatedTime <='{search.EndTime} 23:59:59'";
|
|
}
|
|
|
|
|
|
PagerInfo pagerInfo = new PagerInfo
|
|
{
|
|
CurrenetPageIndex = search.CurrenetPageIndex,
|
|
PageSize = search.PageSize
|
|
};
|
|
//查询充值记录表
|
|
System.Collections.Generic.List<PaymentRecordOutputDto> list = (await repository.FindWithPagerAsync(where, pagerInfo, search.Sort, order)).MapTo<PaymentRecordOutputDto>();
|
|
//获取所有用户信息(查缓存)
|
|
System.Collections.Generic.List<UserOutputDto> users = (await _userRepository.GetListWhereAsync(" `State`=10")).MapTo<UserOutputDto>();
|
|
|
|
foreach (PaymentRecordOutputDto item in list)
|
|
{
|
|
UserOutputDto user = users.Find(x => x.Id == item.UserId);
|
|
item.UserName = user?.UserName;
|
|
item.AvatarUrl = CommonConst.Default_Image_Prefix + user?.AvatarUrl;
|
|
item.Phone = user?.Phone;
|
|
// item = EnumExtensions.ParseEnum(typeof(OperatingTypeEnum), item.OperatingType.ToString()).ToDescription();
|
|
// item.CurrencyTypeName = EnumExtensions.ParseEnum(typeof(OperatingCreditsTypeEnum), item.CurrencyType.ToString()).ToDescription();
|
|
}
|
|
PageResult<PaymentRecordOutputDto> pageResult = new PageResult<PaymentRecordOutputDto>
|
|
{
|
|
CurrentPage = pagerInfo.CurrenetPageIndex,
|
|
Items = list,
|
|
ItemsPerPage = pagerInfo.PageSize,
|
|
TotalItems = pagerInfo.RecordCount
|
|
};
|
|
return pageResult;
|
|
}
|
|
}
|
|
}
|