예제 #1
0
        /*
         * [12:10:06] ios app: 索引7位是1111,1标识未开玩法,0表示开售玩法,第18位,1000表示是否开单关。0标识开单关
         * [12:10:29] ios app: 竞彩篮球标记顺序:胜负  让分胜负  大小分  胜分差
         * SF是1
         *  RFSF是2
         *  SFC是3
         *  DXF 是4
         */
        /// <summary>
        /// 转换JCLQjsoN
        /// </summary>
        /// <returns></returns>
        public static string GetJson(string gametype, string matchDate = null)
        {
            var jcLq = GetJCLQHHDGList();
            //var jcLq = MatchList_WEB(gametype, matchDate);
            StringBuilder json   = new StringBuilder("[");
            string        index7 = "";

            foreach (var item in jcLq)
            {
                index7 = "";
                json.Append("[");
                json.AppendFormat("\"{0}\",", item.MatchId);
                json.AppendFormat("\"{0}{1}\",", BusinessHelper.Week(), item.MatchNumber);
                json.AppendFormat("\"{0}\",", item.LeagueName);
                json.AppendFormat("\"{0}\",", item.HomeTeamName);
                json.AppendFormat("\"{0}\",", item.GuestTeamName);
                json.AppendFormat("\"{0}\",", item.StartDateTime);
                json.AppendFormat("\"{0}\",", item.FSStopBettingTime);
                if (item.SF_WinSP == 0 || item.SF_LoseSP == 0)
                {
                    index7 += "1";
                }
                else
                {
                    index7 += "0";
                }
                if (item.RF_WinSP == 0 || item.RF_LoseSP == 0)
                {
                    index7 += "1";
                }
                else
                {
                    index7 += "0";
                }
                if (item.HomeWin1_5 == 0)
                {
                    index7 += "1";
                }
                else
                {
                    index7 += "0";
                }
                if (item.DF == 0 || item.XF == 0)
                {
                    index7 += "1";
                }
                else
                {
                    index7 += "0";
                }
                json.AppendFormat("\"{0}\",", index7);
                //json.Append("\"00000\",");
                json.Append("\"-\",");
                json.Append("\"-\",");
                //json.Append("\"-\",");
                json.Append("\"-\",");
                json.Append("\"-\",");
                json.Append("\"-\",");
                json.Append("\"\",");
                json.Append("\"\",");
                json.Append("\"[");
                //非让分
                json.AppendFormat("[{0},{1}],", item.SF_WinSP, item.SF_LoseSP);
                //让分
                json.AppendFormat("[{0},{1},{2}],", item.RF, item.RF_WinSP, item.RF_LoseSP);
                //大小分
                json.AppendFormat("[{0},{1},{2}],", item.YSZF, item.DF, item.XF);
                //身负差
                json.AppendFormat("[{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}],", item.HomeWin1_5, item.HomeWin6_10, item.HomeWin11_15, item.HomeWin16_20, item.HomeWin21_25, item.HomeWin26, item.GuestWin1_5, item.GuestWin6_10, item.GuestWin11_15, item.GuestWin16_20, item.GuestWin21_25, item.GuestWin26);
                json.Append("[],[],[],[]]\",");
                json.AppendFormat("\"{0}\",", BusinessHelper.GetLeagueColor());
                json.AppendFormat("\"{0}\",", item.MatchData);
                if (item.State_HHDG == "234")
                {
                    json.Append("\"1000\"");
                }
                else if (item.State_HHDG == "3")
                {
                    json.Append("\"1101\"");
                }
                else
                {
                    json.Append("\"1101\"");
                }
                //switch (item.State_HHDG)
                //{
                //    case "1"://SF是1
                //        json.Append("\"0101\"");
                //        break;
                //    case "2"://RFSF是2
                //        json.Append("\"1001\"");
                //        break;
                //    case "3"://SFC是3
                //        json.Append("\"1101\"");
                //        break;
                //    case "4"://DXF 是4
                //        json.Append("\"1100\"");
                //        break;
                //    default:
                //        json.Append("\"1101\"");
                //        break;

                //}
                //json.Append("\"1000\"");
                json.Append("],");
            }
            string data = json.ToString().TrimEnd(',');

            //json.Append("]");
            return(data + "]");
        }