/// <summary> /// 投注 /// </summary> /// <returns></returns> public string BetSingle(string issueNo, double money, JJBetEnum codes) { ResBetSingle resEntity = new ResBetSingle(); resEntity.accountId = accountId; resEntity.clientTime = 1234; resEntity.gameId = gameId; resEntity.issue = issueNo; List <BetEntity> betList = new List <BetEntity>(); betList.Add(new BetEntity() { methodid = "", nums = 1, //数量 rebate = 0.00, //回扣 times = money.ToString(), money = money, mode = 1, issueNo = issueNo, codes = codes.ToString(), playId = new string[] { "K3002001010" } }); resEntity.item = betList.ToArray(); Ku.Common.HttpHelper http = new Common.HttpHelper(); HttpItem httpItem = new HttpItem(); httpItem.URL = "http://" + Domain + "/tools/_ajax/cache/lotteryOpenCache"; httpItem.Method = "POST"; httpItem.Postdata = "{\"requirement\":[\"OG1K3\"]}"; httpItem.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"; httpItem.Host = Domain; httpItem.Referer = "http://" + Domain + "/lottery/K3/OG1K3"; httpItem.ContentType = "application/json"; httpItem.Cookie = Cookie; HttpResult httpRes = http.GetHtml(httpItem); if (httpRes.StatusCode == System.Net.HttpStatusCode.OK) { requestFailCount = 0; string html = httpRes.Html; return(html); } else { requestFailCount++; LogsRecord.write("接口调用异常", "投注,次数=" + requestFailCount + ",异常=" + httpRes.Html); if (requestFailCount >= requestMaxFailCount) { throw new LogException("请求异常," + httpRes.Html); } return(BetSingle(issueNo, money, codes)); } }
/// <summary> /// 大小投注 /// </summary> /// <param name="failNum">容错次数</param> /// <param name="repeatNum">重复次数</param> public void BettingDaxiao(JJApiKit jjKit, long currentIssueNo, string valueNum, int money) { if (currentIssueNo <= lastBetRecord.IssueNo) { return; } JJBetEnum codes = valueNum == "大" ? JJBetEnum.大 : JJBetEnum.小; #region 调用API投注 //string html = jjKit.BetSingle(currentIssueNo, money, codes); #endregion #region 存档 int isExist = JJ_BetSingleDAL.Instance.GetSingle(currentIssueNo.ToString()); if (isExist == 0) { DBParamEntity[] pramsAdd = { new DBParamEntity() { FieldName = "issueNo", Value = currentIssueNo }, new DBParamEntity() { FieldName = "codes", Value = valueNum }, new DBParamEntity() { FieldName = "money", Value = money }, }; int res = JJ_BetSingleDAL.Instance.Add(pramsAdd); //msg("期数=" + entity.issueNo + ",值=" + item.lotteryOpen); } #endregion lastBetRecord = new TouzhuEntity() { bs = 1, codes = codes, money = money, IssueNo = currentIssueNo }; }