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.
 
 

58 lines
1.9 KiB

using Znyc.CloudCar.Auth.HttpContextUser;
using Znyc.CloudCar.Configuration;
using Znyc.CloudCar.IRepository.Currency;
using Znyc.CloudCar.IServices.Currency;
using Znyc.CloudCar.Model.Entities;
using Znyc.CloudCar.Utility.Extensions;
namespace Znyc.CloudCar.Services.Currency
{
public class CurrencyRecordService : ICurrencyRecordService
{
private readonly ICurrencyRecordRepository _currencyRecordRepository;
private readonly IHttpContextUser _httpContextUser;
public CurrencyRecordService(
ICurrencyRecordRepository currencyRecordRepository,
IHttpContextUser httpContextUser
)
{
_currencyRecordRepository = currencyRecordRepository;
_httpContextUser = httpContextUser;
}
/// <summary>
/// 是否获取过手机号
/// </summary>
/// <param name="operatingType">云币来源类型</param>
/// <param name="id">产品id</param>
/// <returns></returns>
public async Task<bool> IsGetPhone(GlobalEnumVars.CurrencyType operatingType, long id)
{
CurrencyRecordEntity currency = await _currencyRecordRepository.GetAsync(x =>
x.UserId == _httpContextUser.Id && x.CurrencyType == (int)operatingType && x.CurrencySoureObjectId == id);
if (currency.IsNull())
{
return false;
}
return true;
}
/// <summary>
/// 是否存在云币记录
/// </summary>
/// <returns></returns>
public async Task<bool> IsExistCurrencyRecord(long userId, int operatingType)
{
CurrencyRecordEntity currencyRecord = await _currencyRecordRepository.GetAsync(x =>
x.UserId == userId && x.CurrencyType == operatingType);
if (currencyRecord.IsNull())
{
return false;
}
return true;
}
}
}