public bool ValidateLotteryFree(string arg) { uint ID = uint.Parse(arg); LotteryInfo lotteryInfo = MainPlayer.Instance.LotteryInfo; if (ID == GlobalConst.DIAMOND_ID) { uint totalFreeTimes = GameSystem.Instance.CommonConfig.GetUInt("gSpecialLotteryFreeTimes"); if (lotteryInfo.free_times2 > 0 || totalFreeTimes == 0) { Debug.Log("ConditionValidator, LotteryFree failed. " + ID); return(false); } } else if (ID == GlobalConst.GOLD_ID) { uint totalFreeTimes = GameSystem.Instance.CommonConfig.GetUInt("gNormalLotteryFreeTimes"); if (lotteryInfo.free_times1 > 0 || totalFreeTimes == 0) { Debug.Log("ConditionValidator, LotteryFree failed. " + ID); return(false); } } Debug.Log("ConditionValidator, LotteryFree succeed. " + ID); return(true); }
public GetLotteryOpenNumber(LotteryInfo lottery) { this.lottery = lottery; using (var db = new OlaEntities()) { log.Info("获取最新开奖时间:" + this.lottery.LotteryId); var lotteryOpen = db.LotteryOpenHistories .Where(w => w.LotteryId == this.lottery.LotteryId).OrderByDescending(w => w.QiHao).FirstOrDefault(); if (lotteryOpen != null) { var lotteryOpenTimes = db.LotteryOpenTimes .FirstOrDefault(w => w.LotteryId == lotteryOpen.LotteryId && w.QiHao == lotteryOpen.QiHao); if (lotteryOpenTimes != null) { var nextInfo = db.LotteryOpenTimes .FirstOrDefault(w => w.LotteryId == lotteryOpen.LotteryId && w.QiHao == lotteryOpenTimes.NextQiHao); if (nextInfo != null) { this.NextRequestDT = nextInfo.OpenTime; } } } } }
public int Insert(LotteryInfo lotteryInfo) { var lotteryID = 0; IDataParameter[] parms = null; var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(lotteryInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, SQL_INSERT, parms); lotteryID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(lotteryID); }
public List <LotteryInfo> GetLotteryInfoListByKeywordID(int publishmentSystemID, ELotteryType lotteryType, int keywordID) { var lotteryInfoList = new List <LotteryInfo>(); string SQL_WHERE = $"WHERE {LotteryAttribute.PublishmentSystemID} = {publishmentSystemID} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}' AND {LotteryAttribute.IsDisabled} <> '{true}'"; if (keywordID > 0) { SQL_WHERE += $" AND {LotteryAttribute.KeywordID} = {keywordID}"; } var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var lotteryInfo = new LotteryInfo(rdr); lotteryInfoList.Add(lotteryInfo); } rdr.Close(); } return(lotteryInfoList); }
public int Insert(LotteryInfo lotteryInfo) { var lotteryId = 0; IDataParameter[] parms = null; var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(lotteryInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { lotteryId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(lotteryId); }
public List <LotteryInfo> GetLotteryInfoListByKeywordId(int publishmentSystemId, ELotteryType lotteryType, int keywordId) { var lotteryInfoList = new List <LotteryInfo>(); string sqlWhere = $"WHERE {LotteryAttribute.PublishmentSystemId} = {publishmentSystemId} AND {LotteryAttribute.LotteryType} = '{ELotteryTypeUtils.GetValue(lotteryType)}' AND {LotteryAttribute.IsDisabled} <> '{true}'"; if (keywordId > 0) { sqlWhere += $" AND {LotteryAttribute.KeywordId} = {keywordId}"; } var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var lotteryInfo = new LotteryInfo(rdr); lotteryInfoList.Add(lotteryInfo); } rdr.Close(); } return(lotteryInfoList); }
public void Update(LotteryInfo lotteryInfo) { IDataParameter[] parms = null; var SQL_UPDATE = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(lotteryInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); ExecuteNonQuery(SQL_UPDATE, parms); }
public void Update(LotteryInfo lotteryInfo) { IDataParameter[] parms = null; var sqlUpdate = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(lotteryInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); ExecuteNonQuery(sqlUpdate, parms); }
public LotteryInfo GetLotteryInfo(int lotteryID) { LotteryInfo lotteryInfo = null; string SQL_WHERE = $"WHERE ID = {lotteryID}"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { if (rdr.Read()) { lotteryInfo = new LotteryInfo(rdr); } rdr.Close(); } return(lotteryInfo); }
public LotteryInfo GetLotteryInfo(int lotteryId) { LotteryInfo lotteryInfo = null; string sqlWhere = $"WHERE ID = {lotteryId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { if (rdr.Read()) { lotteryInfo = new LotteryInfo(rdr); } rdr.Close(); } return(lotteryInfo); }
public List <LotteryInfo> GetLotteryInfoList(int publishmentSystemId) { var lotteryInfoList = new List <LotteryInfo>(); string sqlWhere = $"WHERE {LotteryAttribute.PublishmentSystemId} = {publishmentSystemId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var lotteryInfo = new LotteryInfo(rdr); lotteryInfoList.Add(lotteryInfo); } rdr.Close(); } return(lotteryInfoList); }
public List <LotteryInfo> GetLotteryInfoList(int publishmentSystemID) { var lotteryInfoList = new List <LotteryInfo>(); string SQL_WHERE = $"WHERE {LotteryAttribute.PublishmentSystemID} = {publishmentSystemID}"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var lotteryInfo = new LotteryInfo(rdr); lotteryInfoList.Add(lotteryInfo); } rdr.Close(); } return(lotteryInfoList); }
/// <summary> /// 界面显示时初始化数据 /// </summary> protected override void OnShow(INotification notification) { LoadSprite.LoaderImage(m_Panel.beijing, "bg/qiuchang", false); backType = BackType.Main; m_Panel.PieceGrid.enabled = true; m_Panel.PieceGrid.BindCustomCallBack(UpdatePieceGrid); m_Panel.PieceGrid.StartCustom(); m_Panel.rewardGrid.enabled = true; m_Panel.rewardGrid.BindCustomCallBack(UpdateRewardGrid); m_Panel.rewardGrid.StartCustom(); freeInfo = LotteryConfig.GetLotteryInfoByType(1); diamondInfo = LotteryConfig.GetLotteryInfoByType(2); tenInfo = LotteryConfig.GetLotteryInfoByType(3); m_Panel.orangedesc.text = TextManager.GetUIString("UICard3"); m_Panel.orangeCount.text = tenInfo.capitalValue.ToString(); if (cardMediator == null) { cardMediator = Facade.RetrieveMediator("CardMediator") as CardMediator; } m_Panel.freeTimes.text = string.Format(TextManager.GetUIString("UICard7"), freeInfo.freeCount - cardInfo.euroFreeTimes); UpdateView(CardType.First); }
private static string GetLotteryUrl(PublishmentSystemInfo publishmentSystemInfo, LotteryInfo lotteryInfo) { var fileName = ELotteryTypeUtils.GetValue(ELotteryTypeUtils.GetEnumType(lotteryInfo.LotteryType)).ToLower(); return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, $"weixin/lottery/{fileName}.html"))); }
public static string GetLotteryUrl(PublishmentSystemInfo publishmentSystemInfo, LotteryInfo lotteryInfo, string wxOpenId) { var attributes = new NameValueCollection { { "lotteryID", lotteryInfo.Id.ToString() }, { "publishmentSystemID", lotteryInfo.PublishmentSystemId.ToString() }, { "wxOpenID", wxOpenId } }; return(PageUtils.AddQueryString(GetLotteryUrl(publishmentSystemInfo, lotteryInfo), attributes)); }
void LoadPlayType(LotteryInfo l) { currentPos = 0; this.tabItem1.IsSelected = true; this.sp_playradio.Visibility = Visibility.Collapsed; this.sp_playtype.Visibility = Visibility.Visible; this.sp_lottery.Visibility = Visibility.Visible; srv = WcfProxy.GetProxy; srv.GetPlayTypeInfoByLotteryIdAsync(l.LotteryTypeID); loadingProgress.IsBusy = true; srv.GetPlayTypeInfoByLotteryIdCompleted += (s, er) => { loadingProgress.IsBusy = false; if (er.Result.Count == 0) { MessageBox.Show("没有找到匹配的记录!"); } this.dgPlayType.ItemsSource = er.Result; }; }
public static bool Lottery(LotteryInfo lotteryInfo, List <LotteryAwardInfo> awardInfoList, string cookieSN, string wxOpenID, out LotteryAwardInfo awardInfo, out LotteryWinnerInfo winnerInfo, string userName, out string errorMessage) { errorMessage = string.Empty; awardInfo = null; winnerInfo = DataProviderWx.LotteryWinnerDao.GetWinnerInfo(lotteryInfo.PublishmentSystemId, lotteryInfo.Id, cookieSN, wxOpenID, userName); if (winnerInfo != null) { awardInfo = GetAwardInfo(awardInfoList, winnerInfo.AwardId); } else { var isMaxCount = false; var isMaxDailyCount = false; DataProviderWx.LotteryLogDao.AddCount(lotteryInfo.PublishmentSystemId, lotteryInfo.Id, cookieSN, wxOpenID, userName, lotteryInfo.AwardMaxCount, lotteryInfo.AwardMaxDailyCount, out isMaxCount, out isMaxDailyCount); if (isMaxCount) { errorMessage = $"对不起,每人最多允许抽奖{lotteryInfo.AwardMaxCount}次"; return(false); } else if (isMaxDailyCount) { errorMessage = $"对不起,每人每天最多允许抽奖{lotteryInfo.AwardMaxDailyCount}次"; return(false); } else { if (awardInfoList != null && awardInfoList.Count > 0) { var idWithProbabilityDictionary = new Dictionary <int, decimal>(); foreach (var lotteryAwardInfo in awardInfoList) { idWithProbabilityDictionary.Add(lotteryAwardInfo.Id, lotteryAwardInfo.Probability); } var awardID = WeiXinManager.Lottery(idWithProbabilityDictionary); if (awardID > 0) { var lotteryAwardInfo = GetAwardInfo(awardInfoList, awardID); if (lotteryAwardInfo != null && lotteryAwardInfo.TotalNum > 0) { var wonNum = DataProviderWx.LotteryWinnerDao.GetTotalNum(awardID); if (lotteryAwardInfo.TotalNum > wonNum) { awardInfo = lotteryAwardInfo; winnerInfo = new LotteryWinnerInfo { PublishmentSystemId = lotteryInfo.PublishmentSystemId, LotteryType = lotteryInfo.LotteryType, LotteryId = lotteryInfo.Id, AwardId = awardID, Status = EWinStatusUtils.GetValue(EWinStatus.Won), CookieSn = cookieSN, WxOpenId = wxOpenID, UserName = userName, AddDate = DateTime.Now }; winnerInfo.Id = DataProviderWx.LotteryWinnerDao.Insert(winnerInfo); DataProviderWx.LotteryAwardDao.UpdateWonNum(awardID); DataProviderWx.LotteryDao.AddUserCount(winnerInfo.LotteryId); } } } } } } return(true); }
//public IActionResult Index() //{ // return View(); //} public List <fc3D> GetFc3Ds() { var anode = CommonHelper.GetExpect("http://kaijiang.500.com/sd.shtml"); List <fc3D> fc3Ds = new List <fc3D>(); foreach (HtmlNode item in anode) { fc3D fc3D = new fc3D(); List <LotteryInfo> lotteries = new List <LotteryInfo>(); fc3D.expect = item.InnerHtml; if (Convert.ToInt32(item.InnerHtml) == 2018333) { return(fc3Ds); } var html = "http://kaijiang.500.com/shtml/sd/" + item.InnerHtml + ".shtml"; HtmlWeb web = new HtmlWeb(); CommonHelper.Gzip(web); var htmlDoc = web.Load(html); #region 第一个表格 var GameTime = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[0].SelectSingleNode("//span[@class='span_right']").InnerHtml; fc3D.LotteryDate = GameTime.Split(":")[1].Split('兑')[0]; fc3D.AwardDeadline = GameTime.Split(":")[2]; fc3D.SalesVolume = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']").FirstOrDefault().SelectNodes("tr")[2].SelectSingleNode("//span[@class='cfont1 ']").InnerHtml.Replace("元", ""); var firstTableNode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[1].SelectSingleNode("td").SelectSingleNode("table").SelectSingleNode("tr").SelectNodes("td"); int i = 0; foreach (var Subitem in firstTableNode) { if (i == 0) { i++; continue; } else//第二个开始截取数据 { if (i == 1) { foreach (var Sub_subitem in Subitem.SelectNodes("//li[@class='ball_orange']")) { fc3D.opencode += Sub_subitem.InnerHtml + ","; } fc3D.opencode = fc3D.opencode.Remove(fc3D.opencode.Length - 1, 1); i++; } else if (i == 2) { var textNumber = Subitem.SelectSingleNode("div").InnerHtml.Split(":")[1].Replace(' ', ','); if (textNumber.StartsWith(',')) { fc3D.TestNumber = textNumber.Remove(0, 1); } else { fc3D.TestNumber = textNumber; } i++; } else { fc3D.numberType = Subitem.SelectSingleNode("//font[@class='cfont1']").InnerHtml; i++; } } } #endregion #region 第二个表格 var table_tr = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[1].SelectNodes("tr"); for (int m = 0; m < table_tr.Count; m++)//遍历tr { if (m <= 1) { continue; } else//第二个tr开始爬取数据 { if (m < 21) { if (table_tr[m].SelectNodes("td")[0].OuterHtml.Contains("rowspan")) { for (int n = 0; n < Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value); n++)//获取跨越的行 { if (n == 0) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.PrizeSubItem = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[3].InnerHtml.TrimStart().Trim(); lotteries.Add(fc); } if (n >= 1) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml; fc.PrizeSubItem = table_tr[m + n].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m + n].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m + n].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } m = m + Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value) - 1; } else { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } } } #endregion fc3D.SubItemList = lotteries; fc3Ds.Add(fc3D); } return(fc3Ds); }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var lotteryInfo = new LotteryInfo(e.Item.DataItem); var ltlItemIndex = e.Item.FindControl("ltlItemIndex") as Literal; var ltlTitle = e.Item.FindControl("ltlTitle") as Literal; var ltlKeywords = e.Item.FindControl("ltlKeywords") as Literal; var ltlStartDate = e.Item.FindControl("ltlStartDate") as Literal; var ltlEndDate = e.Item.FindControl("ltlEndDate") as Literal; var ltlUserCount = e.Item.FindControl("ltlUserCount") as Literal; var ltlPVCount = e.Item.FindControl("ltlPVCount") as Literal; var ltlIsEnabled = e.Item.FindControl("ltlIsEnabled") as Literal; var ltlWinner = e.Item.FindControl("ltlWinner") as Literal; var ltlPreviewUrl = e.Item.FindControl("ltlPreviewUrl") as Literal; var ltlEditUrl = e.Item.FindControl("ltlEditUrl") as Literal; ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString(); ltlTitle.Text = lotteryInfo.Title; ltlKeywords.Text = DataProviderWX.KeywordDAO.GetKeywords(lotteryInfo.KeywordID); ltlStartDate.Text = DateUtils.GetDateAndTimeString(lotteryInfo.StartDate); ltlEndDate.Text = DateUtils.GetDateAndTimeString(lotteryInfo.EndDate); ltlUserCount.Text = lotteryInfo.UserCount.ToString(); ltlPVCount.Text = lotteryInfo.PVCount.ToString(); ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(!lotteryInfo.IsDisabled); ltlWinner.Text = $@"<a href=""{BackgroundLotteryWinner.GetRedirectUrl(PublishmentSystemID, lotteryType, lotteryInfo.ID, 0, GetRedirectUrl(PublishmentSystemID, lotteryType))}"">查看获奖名单</a>"; var urlPreview = LotteryManager.GetLotteryUrl(lotteryInfo, string.Empty); urlPreview = BackgroundPreview.GetRedirectUrlToMobile(urlPreview); ltlPreviewUrl.Text = $@"<a href=""{urlPreview}"" target=""_blank"">预览</a>"; var urlEdit = string.Empty; if (lotteryType == ELotteryType.Scratch) { urlEdit = BackgroundScratchAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.BigWheel) { urlEdit = BackgroundBigWheelAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.GoldEgg) { urlEdit = BackgroundGoldEggAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.Flap) { urlEdit = BackgroundFlapAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } else if (lotteryType == ELotteryType.YaoYao) { urlEdit = BackgroundYaoYaoAdd.GetRedirectUrl(PublishmentSystemID, lotteryInfo.ID); } ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>"; } }
private void OnReadRow(LotteryInfo row) { lotteryInfoList[row.type] = row; }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { var selectedStep = 0; if (phStep1.Visible) { selectedStep = 1; } else if (phStep2.Visible) { selectedStep = 2; } else if (phStep3.Visible) { selectedStep = 3; } else if (phStep4.Visible) { selectedStep = 4; } else if (phStep5.Visible) { selectedStep = 5; } phStep1.Visible = phStep2.Visible = phStep3.Visible = phStep4.Visible = phStep5.Visible = false; if (selectedStep == 1) { var isConflict = false; var conflictKeywords = string.Empty; if (!string.IsNullOrEmpty(tbKeywords.Text)) { if (lotteryID > 0) { var lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID); isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, lotteryInfo.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } else { isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords); } } if (isConflict) { FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词"); phStep1.Visible = true; } else { phStep2.Visible = true; } } else if (selectedStep == 2) { phStep3.Visible = true; } else if (selectedStep == 3) { var isItemReady = true; var awardMaxCount = TranslateUtils.ToInt(tbAwardMaxCount.Text); var awardMaxDailyCount = TranslateUtils.ToInt(tbAwardMaxDailyCount.Text); if (awardMaxDailyCount > awardMaxCount) { FailMessage("摇摇乐保存失败,每人每天最多允许抽奖次数必须小于每人最多抽奖次数"); isItemReady = false; } if (isItemReady) { var itemCount = TranslateUtils.ToInt(Request.Form["itemCount"]); if (itemCount < 1) { FailMessage("摇摇乐保存失败,至少需要设置一个奖项"); isItemReady = false; } else { var itemIDList = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]); var awardNameList = TranslateUtils.StringCollectionToStringList(Request.Form["itemAwardName"]); var titleList = TranslateUtils.StringCollectionToStringList(Request.Form["itemTitle"]); var totalNumList = TranslateUtils.StringCollectionToIntList(Request.Form["itemTotalNum"]); var probabilityList = TranslateUtils.StringCollectionToDecimalList(Request.Form["itemProbability"]); decimal probabilityAll = 0; var awardInfoList = new List <LotteryAwardInfo>(); for (var i = 0; i < itemCount; i++) { var awardInfo = new LotteryAwardInfo { ID = itemIDList[i], PublishmentSystemID = PublishmentSystemID, LotteryID = lotteryID, AwardName = awardNameList[i], Title = titleList[i], TotalNum = totalNumList[i], Probability = probabilityList[i] }; if (string.IsNullOrEmpty(awardInfo.AwardName)) { FailMessage("保存失败,奖项名称为必填项"); isItemReady = false; } if (string.IsNullOrEmpty(awardInfo.Title)) { FailMessage("保存失败,奖品名为必填项"); isItemReady = false; } if (awardInfo.Probability < 0 || awardInfo.Probability > 100) { FailMessage("保存失败,各项中奖概率总和不能超过100%"); isItemReady = false; } probabilityAll += awardInfo.Probability; awardInfoList.Add(awardInfo); } if (probabilityAll <= 0 || probabilityAll > 100) { FailMessage("摇摇乐保存失败,获奖概率之和必须在1%到100%之间"); isItemReady = false; } if (isItemReady) { DataProviderWX.LotteryAwardDAO.DeleteAllNotInIDList(PublishmentSystemID, lotteryID, itemIDList); foreach (var awardInfo in awardInfoList) { var newAwardInfo = DataProviderWX.LotteryAwardDAO.GetAwardInfo(awardInfo.ID); if (awardInfo.ID > 0) { var wonNum = DataProviderWX.LotteryWinnerDAO.GetTotalNum(awardInfo.ID); if (awardInfo.TotalNum < wonNum) { awardInfo.TotalNum = wonNum; } awardInfo.WonNum = newAwardInfo.WonNum; DataProviderWX.LotteryAwardDAO.Update(awardInfo); } else { DataProviderWX.LotteryAwardDAO.Insert(awardInfo); } } } } } if (isItemReady) { phStep4.Visible = true; } else { phStep3.Visible = true; } } else if (selectedStep == 4) { phStep5.Visible = true; btnSubmit.Text = "确 认"; } else if (selectedStep == 5) { var lotteryInfo = new LotteryInfo(); if (lotteryID > 0) { lotteryInfo = DataProviderWX.LotteryDAO.GetLotteryInfo(lotteryID); } lotteryInfo.PublishmentSystemID = PublishmentSystemID; lotteryInfo.LotteryType = ELotteryTypeUtils.GetValue(ELotteryType.YaoYao); lotteryInfo.KeywordID = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, lotteryID > 0, tbKeywords.Text, EKeywordType.YaoYao, lotteryInfo.KeywordID); lotteryInfo.IsDisabled = !cbIsEnabled.Checked; lotteryInfo.StartDate = dtbStartDate.DateTime; lotteryInfo.EndDate = dtbEndDate.DateTime; lotteryInfo.Title = PageUtils.FilterXSS(tbTitle.Text); lotteryInfo.ImageUrl = imageUrl.Value;; lotteryInfo.Summary = tbSummary.Text; lotteryInfo.ContentImageUrl = contentImageUrl.Value; lotteryInfo.ContentUsage = tbContentUsage.Text; lotteryInfo.AwardUsage = tbAwardUsage.Text; lotteryInfo.IsAwardTotalNum = cbIsAwardTotalNum.Checked; lotteryInfo.AwardMaxCount = TranslateUtils.ToInt(tbAwardMaxCount.Text); lotteryInfo.AwardMaxDailyCount = TranslateUtils.ToInt(tbAwardMaxDailyCount.Text); lotteryInfo.AwardCode = tbAwardCode.Text; lotteryInfo.AwardImageUrl = awardImageUrl.Value; lotteryInfo.IsFormRealName = cbIsFormRealName.Checked; lotteryInfo.FormRealNameTitle = tbFormRealNameTitle.Text; lotteryInfo.IsFormMobile = cbIsFormMobile.Checked; lotteryInfo.FormMobileTitle = tbFormMobileTitle.Text; lotteryInfo.IsFormEmail = cbIsFormEmail.Checked; lotteryInfo.FormEmailTitle = tbFormEmailTitle.Text; lotteryInfo.IsFormAddress = cbIsFormAddress.Checked; lotteryInfo.FormAddressTitle = tbFormAddressTitle.Text; lotteryInfo.EndTitle = tbEndTitle.Text; lotteryInfo.EndImageUrl = endImageUrl.Value; lotteryInfo.EndSummary = tbEndSummary.Text; try { if (lotteryID > 0) { DataProviderWX.LotteryDAO.Update(lotteryInfo); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改摇摇乐", $"摇摇乐:{tbTitle.Text}"); SuccessMessage("修改摇摇乐成功!"); } else { lotteryID = DataProviderWX.LotteryDAO.Insert(lotteryInfo); DataProviderWX.LotteryAwardDAO.UpdateLotteryID(PublishmentSystemID, lotteryID); LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加摇摇乐", $"摇摇乐:{tbTitle.Text}"); SuccessMessage("添加摇摇乐成功!"); } var redirectUrl = BackgroundLottery.GetRedirectUrl(PublishmentSystemID, ELotteryType.YaoYao); AddWaitAndRedirectScript(redirectUrl); } catch (Exception ex) { FailMessage(ex, "摇摇乐设置失败!"); } } } }
private void GetFc3Ds() { var anode = CommonHelper.GetExpect("http://kaijiang.500.com/sd.shtml"); var Issue = _digitalLotteryService.Getnormal_lotteryIssue(); List <fc3D> fc3Ds = new List <fc3D>(); foreach (HtmlNode item in anode) { int.TryParse(item.InnerHtml, out int result); if (result >= Convert.ToInt32(Issue)) { fc3D fc3D = new fc3D(); List <LotteryInfo> lotteries = new List <LotteryInfo>(); var htmlDoc = CommonHelper.LoadGziphtml("http://kaijiang.500.com/shtml/sd/" + item.InnerHtml + ".shtml", CollectionUrlEnum.url_500kaijiang); #region 第一个表格 var GameTime = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[0].SelectSingleNode("//span[@class='span_right']").InnerHtml; fc3D.expect = item.InnerHtml; fc3D.LotteryDate = Convert.ToDateTime(GameTime.Split(":")[1].Split('兑')[0]).ToString("yyyy-MM-dd"); fc3D.AwardDeadline = Convert.ToDateTime(GameTime.Split(":")[2]).ToString("yyyy-MM-dd"); fc3D.SalesVolume = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']").FirstOrDefault().SelectNodes("tr")[2].SelectSingleNode("//span[@class='cfont1 ']").InnerHtml.Replace("元", ""); var firstTableNode = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[0].SelectNodes("tr")[1].SelectSingleNode("td").SelectSingleNode("table").SelectSingleNode("tr").SelectNodes("td"); int i = 0; foreach (var Subitem in firstTableNode) { if (i == 0) { i++; continue; } else//第二个开始截取数据 { if (i == 1) { foreach (var Sub_subitem in Subitem.SelectNodes("//li[@class='ball_orange']")) { fc3D.opencode += Sub_subitem.InnerHtml + ","; } fc3D.opencode = fc3D.opencode.Remove(fc3D.opencode.Length - 1, 1); i++; } else if (i == 2) { var textNumber = Subitem.SelectSingleNode("div").InnerHtml.Split(":")[1].Replace(' ', ','); if (textNumber.StartsWith(',')) { fc3D.TestNumber = textNumber.Remove(0, 1); } else { fc3D.TestNumber = textNumber; } i++; } else { fc3D.numberType = Subitem.SelectSingleNode("//font[@class='cfont1']").InnerHtml; i++; } } } #endregion #region 第二个表格 var table_tr = htmlDoc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02']")[1].SelectNodes("tr"); for (int m = 0; m < table_tr.Count; m++)//遍历tr { if (m <= 1) { continue; } else//第二个tr开始爬取数据 { if (m < 19) { if (table_tr[m].SelectNodes("td")[0].OuterHtml.Contains("rowspan")) { for (int n = 0; n < Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value); n++)//获取跨越的行 { if (n == 0) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.PrizeSubItem = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[3].InnerHtml.TrimStart().Trim(); lotteries.Add(fc); } if (n >= 1) { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml; fc.PrizeSubItem = table_tr[m + n].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m + n].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m + n].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } m = m + Convert.ToInt32(table_tr[m].SelectNodes("td")[0].Attributes[0].Value) - 1; } else { LotteryInfo fc = new LotteryInfo(); fc.Prize = table_tr[m].SelectNodes("td")[0].InnerHtml.Trim(); fc.BettingCount = table_tr[m].SelectNodes("td")[1].InnerHtml.Trim(); fc.Bonus = table_tr[m].SelectNodes("td")[2].InnerHtml.Trim(); lotteries.Add(fc); } } } } #endregion fc3D.SubItemList = lotteries; fc3Ds.Add(fc3D); _digitalLotteryService.Addnormal_lotterydetail(fc3Ds); } } }