Ejemplo n.º 1
0
 public static void BettingYiXing(ref BettingSolutinModel model, string userToken)
 {
     try
     {
         BettingYiXing(ref model, GloableConstants.AccountBelongs.Jiang, userToken);
     }
     catch (Exception ex)
     {
         model.IsBettingSucc = false;
         model.MyMessage     = "投注异常:" + ex.Message;
     }
 }
Ejemplo n.º 2
0
        public static List <BettingSolutinModel> BuildingBetModels(ref List <AccountResponse> jAccountList, ref List <AccountResponse> qAccountList)
        {
            int jcount = jAccountList.Count;
            int qcount = qAccountList.Count;
            List <BettingSolutinModel> result = new List <BettingSolutinModel>();

            for (int j = 0; j < jcount; j++)
            {
                var account           = jAccountList[j];
                BettingSolutinModel m = new BettingSolutinModel();
                m.CurrentToken = account.UserToken;
                m.LoginName    = account.LoginName;
                m.AccountMoney = account.MyTotoalMoeny;
                m.AccountRed   = account.RedBagBalance;
                m.Belongs      = GloableConstants.AccountBelongs.Jiang;
                m.Password     = account.Password;
                m.BettingNums  = new List <int>()
                {
                    1
                };
                m.Beishu = GloableParams.DefaultJiangMultBet;
                result.Add(m);
                break;;
            }
            for (int q = 0; q < qcount; q++)
            {
                var account           = qAccountList[q];
                BettingSolutinModel m = new BettingSolutinModel();
                m.CurrentToken = account.UserToken;
                m.LoginName    = account.LoginName;
                m.AccountMoney = account.MyTotoalMoeny;
                m.AccountRed   = account.RedBagBalance;
                m.Belongs      = GloableConstants.AccountBelongs.Qcw;
                m.Password     = account.Password;
                m.BettingNums  = new List <int>()
                {
                    3
                };
                m.Beishu = GloableParams.DefaultJiangMultBet;
                result.Add(m);
                break;
            }
            return(result);
        }
Ejemplo n.º 3
0
        protected static void BettingYiXing(ref BettingSolutinModel bettingData, GloableConstants.AccountBelongs wherefrom, string userToken)
        {
            string url = "";

            if (wherefrom == GloableConstants.AccountBelongs.Jiang)
            {
                url = GloableConstants.Jiang.Phone_CqsscBetServiceUrl;
            }
            else if (wherefrom == GloableConstants.AccountBelongs.Qcw)
            {
                url = GloableConstants.Qcw.Phone_CqsscBetServiceUrl;
            }
            try
            {
                CqsscBettingContent bet = new CqsscBettingContent();
                bet.UserToken = userToken;
                //bet.CodeList = GetCodeListNew("-,-,-,-,234", bet.GameType);
                //bet.GameType = GloableConstants.CqsscGameType.DXDS;
                //bet.CodeList = GetCodeListNew("4,4;5,4", bet.GameType);
                bet.GameType        = GloableConstants.CqsscGameType.YiXingDX.ToString();
                bet.CodeList        = GetCodeListNew(bettingData.BettingNumStr, bet.GameType);
                bet.TotalMatchCount = bettingData.Zhushu;
                bet.IssuseList      = GetIssuseListNew(bettingData.Beishu, bet.TotalMatchCount, bettingData.CurrentIssueStr);
                bet.RedBagMoney     = bettingData.MaxRedUse;
                bet.TotalMoney      = bettingData.TotalMoney;
                string content = JsonHelper.ObjectToJson(bet);

                Dictionary <string, string> map = new Dictionary <string, string>();
                map.Add("Action", "104");
                map.Add("SourceCode", "102");
                map.Add("MsgId", "123456");
                map.Add("Param", HtmlUtil.UrlEncode(content));
                map.Add("Sign", HtmlUtil.UrlEncode(GetMd5HashStr("caibb123456102104" + content)));

                var            objUri      = new Uri(url);
                HttpWebRequest httpRequest = HttpWebRequest.Create(objUri) as HttpWebRequest;
                httpRequest.Method      = "POST";
                httpRequest.Accept      = "*/*";
                httpRequest.KeepAlive   = true;
                httpRequest.ContentType = "application/x-www-form-urlencoded";
                httpRequest.UserAgent   = "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4";
                httpRequest.Headers.Add("Cache-Control", "no-cache");
                httpRequest.Timeout = 10000;
                #region 添加Post 参数
                StringBuilder builder = new StringBuilder();
                var           dic     = map;
                int           i       = 0;
                foreach (var item in dic)
                {
                    if (i > 0)
                    {
                        builder.Append("&");
                    }
                    builder.AppendFormat("{0}={1}", item.Key, item.Value);
                    i++;
                }
                byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
                httpRequest.ContentLength = data.Length;
                using (Stream reqStream = httpRequest.GetRequestStream())
                {
                    reqStream.Write(data, 0, data.Length);
                    reqStream.Close();
                }
                #endregion
                var httpResponse   = httpRequest.GetResponse();
                var responseStream = new StreamReader(httpResponse.GetResponseStream(), Encoding.UTF8);
                var responseJson   = responseStream.ReadToEnd();
                responseStream.Close();
                BettingResponse response = JsonHelper.JsonToObject <BettingResponse>(responseJson);
                if (response.Code == 101)
                {
                    bettingData.IsBettingSucc = true;
                }
                bettingData.ResponseCode = response.Code;
                bettingData.MyMessage    = response.Message;
            }
            catch (Exception ex)
            {
                bettingData.IsBettingSucc = false;
                bettingData.MyMessage     = "投注异常:" + ex.Message;
            }
        }