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; } /// /// 是否获取过手机号 /// /// 云币来源类型 /// 产品id /// public async Task 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; } /// /// 是否存在云币记录 /// /// public async Task IsExistCurrencyRecord(long userId, int operatingType) { CurrencyRecordEntity currencyRecord = await _currencyRecordRepository.GetAsync(x => x.UserId == userId && x.CurrencyType == operatingType); if (currencyRecord.IsNull()) { return false; } return true; } } }