public Choicer(ILogger <Choicer> logger, IDbContextFactory <AppDbContext> contextFactory, WinnerReader winnerReader, PipeClient pipeClient) { _logger = logger; _contextFactory = contextFactory; _winnerReader = winnerReader; _pipe_client = pipeClient; }
public Purger(ILogger <Purger> logger, IDbContextFactory <AppDbContext> contextFactory, MailSenderLottoLion mailSender, SmtpDirectSender smtpDirect, WinnerReader winnerReader) { _logger = logger; _contextFactory = contextFactory; _mailSender = mailSender; _smtpDirect = smtpDirect; _winnerReader = winnerReader; }
public UserController(IOptions <JwtIssuerOptions> jwtOptions, IConfiguration configuration, AppDbContext dbContext, WinnerReader reader, PipeClient pipeClient, CCryption cryptor) { __usermgr = new UserManager(jwtOptions.Value); __configuration = configuration; __db_context = dbContext; __reader = reader; __pipe_client = pipeClient; __cryptor = cryptor; }
public Selector(ILogger <Selector> logger, IDbContextFactory <AppDbContext> contextFactory, WinnerSelector winnerSelector, WinnerReader winnerReader, PipeClient pipeClient) { _logger = logger; _contextFactory = contextFactory; _winnerSelector = winnerSelector; _winnerReader = winnerReader; _pipe_client = pipeClient; }
public LottoController(IOptions <JwtIssuerOptions> jwtOptions, AppDbContext dbContext, WinnerReader winnerReader, PrizeReader prizeReader, PipeClient pipeClient, dForcast forcast) { __usermgr = new UserManager(jwtOptions.Value); __db_context = dbContext; __winner_reader = winnerReader; __prize_reader = prizeReader; __pipe_client = pipeClient; __prize_forcast = forcast; }
public async Task <IActionResult> GetUserSequenceNos() { return(await CProxy.Using(() => { var _result = (success : false, message : "ok"); var _sequence_nos = new List <TKeyValue>(); { var _login_id = __usermgr.GetLoginId(Request); if (String.IsNullOrEmpty(_login_id) == false) { _sequence_nos = __db_context.TbLionChoice .Where(c => c.LoginId == _login_id) .GroupBy(x => x.SequenceNo) .Select( y => new TKeyValue { key = y.Key, value = y.Count() } ) .OrderByDescending(z => z.key) .ToList(); if (_sequence_nos.Count() < 1) { var _today_sequence_no = WinnerReader.GetThisWeekSequenceNo(); _sequence_nos.Add(new TKeyValue { key = _today_sequence_no, value = 0 }); } _result.success = true; } else { _result.message = "인증 정보에서 회원ID를 찾을 수 없습니다"; } } return new OkObjectResult(new { success = _result.success, message = _result.message, result = _sequence_nos }); })); }
public Analyst(ILogger <Analyst> logger, IDbContextFactory <AppDbContext> contextFactory, WinnerAnalysis winnerAnalysis, WinnerPercent winnerPercent, WinnerScoring winnerScoring, WinnerSelector winnerSelector, WinnerReader winnerReader, PipeClient pipeClient) { _logger = logger; _contextFactory = contextFactory; _winnerAnalysis = winnerAnalysis; _winnerPercent = winnerPercent; _winnerScoring = winnerScoring; _winnerSelector = winnerSelector; _winnerReader = winnerReader; _pipe_client = pipeClient; }
public async Task <IActionResult> GetPrizeBySeqNo(int sequence_no) { return(await CProxy.Using(() => { var _result = (success : false, message : "ok"); var _winner = (TbLionWinner)null; if (sequence_no >= 1 && sequence_no <= WinnerReader.GetThisWeekSequenceNo()) { _winner = __db_context.TbLionWinner .Where(w => w.SequenceNo == sequence_no) .SingleOrDefault(); if (_winner == null) { _result.message = $"해당 회차'{sequence_no}'의 추첨 정보가 없습니다"; _winner = new TbLionWinner() { SequenceNo = sequence_no, IssueDate = WinnerReader.GetIssueDateBySequenceNo(sequence_no), PaymentDate = WinnerReader.GetPaymentDateBySequenceNo(sequence_no) }; } else { _result.success = true; } } else { _result.message = "추첨 회차가 범위를 벗어 났습니다"; } return new OkObjectResult(new { success = _result.success, message = _result.message, result = _winner }); })); }
public async Task <int> SelectMemberAsync(AppDbContext ltctx, WinnerReader reader, int selectNo, bool resend) { var _result = 0; var _today_winner_no = reader.GetThisWeekSequenceNo(); // 현재의 예상 번호가 select(추출) 되어 있으면, choice(선택) 한다. // analysis(분석) 차수와 같은 차수이면 select(추출)이 있다고 가정한다. if (_today_winner_no == selectNo - 1) { var _digits = new List <short> { 0, 0, 0 }; { var _master = ltctx.tb_lion_member .Where(m => m.LoginId == LottoSelectmasterId) .SingleOrDefault(); if (_master != null) { var _offset = 0; if (_master.Digit1 > 0) { if (!_digits.Contains(_master.Digit1)) { _digits[_offset] = _master.Digit1; _offset++; } } if (_master.Digit2 > 0) { if (!_digits.Contains(_master.Digit2)) { _digits[_offset] = _master.Digit2; _offset++; } } if (_master.Digit3 > 0) { if (!_digits.Contains(_master.Digit3)) { _digits[_offset] = _master.Digit3; _offset++; } } } } // 가입 member(회원)들에게 각자에게 할당 된 갯수만큼을 select(추출)테이블에서 choice(선택) 테이블로 // 복사 후 메일 발송 하도록 큐에 명령을 보냅니다. (여기서 처리 하지 않고 memberQ에서 pop하여 처리 함) var _members = ltctx.tb_lion_member .Where(m => m.IsNumberChoice == true && m.IsMailSend == true && m.IsAlive == true && m.MailError == false) .ToList(); foreach (var _member in _members) { var _no_choice = ltctx.tb_lion_choice .Where(c => c.SequenceNo == selectNo && c.LoginId == _member.LoginId) .GroupBy(c => c.IsMailSent) .Select(n => new { b = n.Key, c = n.Count() }) .ToList(); var _no_choice_t = _no_choice.Where(c => c.b == true).Sum(c => c.c); var _no_choice_f = _no_choice.Where(c => c.b == false).Sum(c => c.c); // 기 선택 하였으면 skip 함 if (_no_choice_t + _no_choice_f <= 0 || _no_choice_f > 0) { var _choice = new dChoice() { sequence_no = selectNo, login_id = _member.LoginId, resend = resend || _no_choice_f > 0, digit1 = _digits[0], digit2 = _digits[1], digit3 = _digits[2] }; // member(회원)들에게 메일 발송 하도록 큐에 명령을 보냅니다. await this.RequestToChoicerQ(_choice); _result++; } } } return(_result); }
public async Task <IActionResult> AddMemberByFacebook([FromForm] ApplicationUser app_user) { return(await CProxy.UsingAsync(async() => { var _result = (success : false, message : "ok"); while (true) { if (String.IsNullOrEmpty(app_user.mail_address) == true) { _result.message = "메일 주소가 필요 합니다"; break; } var _value = ""; var _validate = __verify_email.TryRemove(app_user.mail_address, out _value); if (_validate == false) { _result.message = $"검증 하고자 하는 메일 주소({app_user.mail_address})가 아닙니다"; break; } _validate = _value == app_user.check_number; if (_validate == false) { _result.message = $"메일 검증 번호({app_user.check_number})가 일치 하지 않습니다"; break; } if (String.IsNullOrEmpty(app_user.login_name) == true || String.IsNullOrEmpty(app_user.facebook_id) == true || String.IsNullOrEmpty(app_user.facebook_token) == true ) { _result.message = "facebook-id, facebook-token, 회원-이름이 필요 합니다"; break; } _validate = await __usermgr.VerifyFacebookToken(app_user.facebook_token, app_user.facebook_id); if (_validate == false) { _result.message = $"facebook-token 또는 facebook-id({app_user.facebook_id}) 오류 입니다"; break; } app_user.login_id = app_user.facebook_id; var _member = __db_context.TbLionMember .Where(m => m.EmailAddress == app_user.mail_address) .SingleOrDefault(); if (_member == null) { _member = __db_context.TbLionMember .Where(m => m.LoginId == app_user.facebook_id) .SingleOrDefault(); if (_member != null) { _result.message = $"동일한 facebook-id({app_user.facebook_id})가 이미 사용 중 입니다"; break; } if (__usermgr.AddNewMember(__db_context, app_user) == false) { _result.message = $"모바일 장치 정보 오류 입니다"; break; } _result.message = $"신규 회원으로 등록 되었습니다"; _result.success = true; } else { if (_member.IsAlive == true) { _result.message = $"다른 회원이 이미 사용하고 있는 메일 주소({app_user.mail_address}) 입니다"; break; } if (__usermgr.ReUseMember(__db_context, _member, app_user) == false) { _result.message = $"모바일 장치 정보 오류 입니다"; break; } _result.message = $"기존 회원으로 등록 되었습니다"; _result.success = true; } // 가입 member(회원)에게 즉시 메일 발송 하도록 큐에 명령을 보냅니다. if (_result.success == true) { var _choice = new TChoice() { login_id = app_user.login_id, sequence_no = WinnerReader.GetNextWeekSequenceNo(), resend = true }; await __memberQ.SendQAsync(_choice); } break; } return new OkObjectResult(new { success = _result.success, message = _result.message, result = "" }); })); }