Exemplo n.º 1
0
        /// <summary>
        /// 读取物理文件路径
        /// </summary>
        /// <param name="fileName">文件物理地址</param>
        /// <returns>文件内容</returns>
        public static string ReadFileString(string fullUrl)
        {
            //using (var sr = new StreamReader(fileName))
            //{
            //    return sr.ReadToEnd();
            //}
            try
            {
                string strResult = PostManager.Get(fullUrl, Encoding.UTF8);
                if (strResult == "404")
                {
                    return(string.Empty);
                }

                if (!string.IsNullOrEmpty(strResult))
                {
                    if (strResult.ToLower().StartsWith("var"))
                    {
                        string[] strArray = strResult.Split('=');
                        if (strArray != null && strArray.Length == 2)
                        {
                            if (strArray[1].ToString().Trim().EndsWith(";"))
                            {
                                return(strArray[1].ToString().Trim().TrimEnd(';'));
                            }
                            return(strArray[1].ToString().Trim());
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            return(string.Empty);
        }
Exemplo n.º 2
0
        public string SendSMS(string mobile, string content, string attach)
        {
            string _sendurl = "http://106.ihuyi.cn/webservice/sms.php?method=Submit&";
            var    pList    = new List <string>();

            pList.Add(string.Format("{0}={1}", "account", _cdKey));
            pList.Add(string.Format("{0}={1}", "password", _password));
            pList.Add(string.Format("{0}={1}", "mobile", mobile));
            pList.Add(string.Format("{0}={1}", "content", content));
            _sendurl += string.Join("&", pList);
            //var writer = Common.Log.LogWriterGetter.GetLogWriter();

            var r = PostManager.Get(_sendurl, Encoding.UTF8).Trim();

            //<?xml version="1.0" encoding="utf-8"?>
            //<SubmitResult xmlns="http://106.ihuyi.cn/">
            //<code>2</code>
            //<msg>提交成功</msg>
            //<smsid>168570682</smsid>
            //</SubmitResult>
            //writer.Write("CF短信记录", "SendSMS", Log.LogType.Error, "_sendurl", _sendurl + Environment.NewLine + r);

            try
            {
                var xml = new XmlDocument();
                xml.LoadXml(r);
                return(xml.ChildNodes[1].ChildNodes[0].InnerText);
            }
            catch (Exception ex)
            {
                return(r);
            }
        }
Exemplo n.º 3
0
        public string SendSMS(string mobile, string content, string attach)
        {
            string _sendurl = "http://sdk4report.eucp.b2m.cn:8080/sdkproxy/sendsms.action?";
            var    pList    = new List <string>();

            pList.Add(string.Format("{0}={1}", "cdkey", _cdKey));
            pList.Add(string.Format("{0}={1}", "password", _password));
            pList.Add(string.Format("{0}={1}", "phone", mobile));
            pList.Add(string.Format("{0}={1}", "message", content));
            pList.Add(string.Format("{0}={1}", "addserial", attach));
            _sendurl += string.Join("&", pList);
            var r = PostManager.Get(_sendurl, Encoding.UTF8).Trim();

            try
            {
                var xml = new XmlDocument();
                xml.LoadXml(r);
                var respnseNode = xml.SelectSingleNode("response");
                if (respnseNode == null)
                {
                    throw new Exception("返回结果中找不到节点response");
                }
                var errorNode = respnseNode.SelectSingleNode("error");
                if (errorNode == null)
                {
                    throw new Exception("返回结果中找不到节点error");
                }
                //结果:0 为发送成功,其它失败
                return(errorNode.InnerText);
            }
            catch (Exception ex)
            {
                return(r);
            }
        }
Exemplo n.º 4
0
        public ServiceResult GetBy(string uuid)
        {
            if (string.IsNullOrWhiteSpace(uuid))
            {
                return(ServiceResponse.Error("You must provide a uuid for the post."));
            }

            PostManager postManager = new PostManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            return(postManager.Get(uuid));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 发送通知到网站生成静态页或静态数据
        /// </summary>
        public string SendBuildStaticFileNotice(string pageType, string key = "")
        {
            var result   = new List <string>();
            var urlArray = Lottery.CrawGetters.InitConfigInfo.BuildStaticFileSendUrl.Split('|'); //ConfigurationManager.AppSettings["BuildStaticFileSendUrl"].Split('|');
            var code     = Encipherment.MD5(string.Format("Home_BuildSpecificPage_{0}", pageType), Encoding.UTF8);

            foreach (var item in urlArray)
            {
                var fullUrl = string.Format("{0}/StaticHtml/BuildSpecificPage?pageType={1}&code={2}&key={3}", item, pageType, code, key);
                result.Add(PostManager.Get(fullUrl, Encoding.UTF8));
            }
            return(string.Join(Environment.NewLine, result.ToArray()));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 加密请求,得到返回数据
        /// </summary>
        private static string DoRequest(List <string> list, out string sendData)
        {
            var source = string.Join("&", list.ToArray());
            var sign   = GetSign(source, SXFKey);

            list.Add(string.Format("{0}={1}", "sign", sign));

            sendData = string.Join("&", list.ToArray());

            var url = string.Format("{0}?{1}", SXFUrl, sendData);

            return(PostManager.Get(url, Encoding.UTF8, SXFOutTimeSeconds));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 发送生成静态数据通知
        /// </summary>
        public static void SendBuildStaticDataNotice(string pageType, string key)
        {
            var urlArray = ConfigurationManager.AppSettings["BuildStaticFileSendUrl"].Split('|');

            foreach (var url in urlArray)
            {
                if (string.IsNullOrEmpty(url))
                {
                    continue;
                }
                var code       = Encipherment.MD5(string.Format("Home_BuildSpecificPage_{0}", pageType), Encoding.UTF8);
                var webSiteUrl = string.Format("{0}/{1}?pageType={2}&code={3}&key={4}", url, "StaticHtml/BuildSpecificPage", pageType, code, key);
                var result     = PostManager.Get(webSiteUrl, Encoding.UTF8, timeoutSeconds: 60);
            }
        }
        public override Dictionary <string, string> GetWinNumber(string gameName, int lastIssuseCount,
                                                                 string issuseNumber)
        {
            var dic = new Dictionary <string, string>();
            var url = GetUrl(gameName);

            var xml = PostManager.Get(url, Encoding.UTF8, 0,
                                      request => { request.Headers.Add("Upgrade-Insecure-Requests", "1"); });

            var info = JsonHelper.Deserialize <CaiLeleOpenInfo>(xml);

            dic.Add(FomartIssuseNumber(gameName, info.openTerm), FomartWinNumber(gameName, info.openResult));

            return(dic);
        }
        public override Dictionary <string, string> GetWinNumber(string gameName, int lastIssuseCount, string issuseNumber)
        {
            var dic = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(gameName) || lastIssuseCount == 0)
            {
                return(dic);
            }
            string url            = string.Empty;
            string kaiJiangLe_URL = string.Empty;
            string requestString  = string.Empty;

            switch (gameName)
            {
            case "FC3D":
                url = urlFC3D;
                break;

            case "PL3":
                url = urlPL3;
                break;

            case "CQSSC":
                url = urlCQSSC;
                break;

            //case "JXSSC":
            //    url = urlJXSSC;
            //    break;
            case "JX11X5":
                url = urlJX11X5;
                break;
            }
            try
            {
                string json = PostManager.Get(url, Encoding.UTF8, 0);
                if (string.IsNullOrEmpty(json))
                {
                    return(dic);
                }
                return(SplitHtml(json, gameName, lastIssuseCount));
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 10
0
        public Dictionary <string, string> Process(string gameCode)
        {
            string url  = InitConfigInfo.SZC_OPEN_MIRROR_URL;
            string json = PostManager.Get(string.Format(url, gameCode, DateTime.Now.Ticks), Encoding.UTF8);

            if (string.IsNullOrEmpty(json))
            {
                return(null);
            }
            Dictionary <string, string> dict = new Dictionary <string, string>();

            foreach (var item in JsonHelper.Deserialize <GameWinNumber_Info[]>(json))
            {
                dict[item.IssuseNumber] = item.WinNumber;
            }
            return(dict);
        }
Exemplo n.º 11
0
        public ServiceResult Delete(string uuid)
        {
            if (string.IsNullOrWhiteSpace(uuid))
            {
                return(ServiceResponse.Error("Invalid id was sent."));
            }

            PostManager postManager = new PostManager(Globals.DBConnectionKey, this.GetAuthToken(Request));
            var         res         = postManager.Get(uuid);

            if (res.Code != 200)
            {
                return(res);
            }

            Post fa = (Post)res.Result;

            return(postManager.Delete(fa));
        }
Exemplo n.º 12
0
        /// <summary>
        /// 从500wan.com获取开奖信息
        /// </summary>
        /// <param name="gameCode">彩种</param>
        /// <returns></returns>
        public override OpenDataInfo GetOpenData(string gameCode, string issuseNumber)
        {
            var url = "http://kaijiang.500wan.com/";

            switch (gameCode.ToUpper())
            {
            case "DLT":
                url += "dlt.shtml";
                break;

            case "SSQ":
                url += "ssq.shtml";
                break;

            default:
                break;
            }

            if (string.IsNullOrEmpty(url))
            {
                return(null);
            }

            var html = PostManager.Get(url, Encoding.GetEncoding("gb2312"));

            OpenDataInfo result = null;

            switch (gameCode.ToUpper())
            {
            case "DLT":
                result = getDLTInfo(html);
                break;

            case "SSQ":
                result = getSSQInfo(html);
                break;

            default:
                break;
            }

            return(result);
        }
Exemplo n.º 13
0
        public override OpenDataInfo GetOpenData(string gameCode, string issuseNumber)
        {
            var url_ssq = "http://kaijiang.aicai.com/fcssq/";
            var url_dlt = "http://kaijiang.aicai.com/tcdlt/";

            switch (gameCode)
            {
            case "SSQ":
                var htmlSSQ = PostManager.Get(url_ssq, Encoding.UTF8, 0).Trim();
                return(FomartSSQ(htmlSSQ));

            case "DLT":
                var htmlDLT = PostManager.Get(url_dlt, Encoding.UTF8, 0).Trim();
                return(FomartDLT(htmlDLT));

            default:
                break;
            }

            return(new OpenDataInfo());
        }
Exemplo n.º 14
0
        public override Dictionary <string, string> GetWinNumber(string gameName, int lastIssuseCount, string issuseNumber)
        {
            var    dic = new Dictionary <string, string>();
            string url = GetUrl(gameName);

            try
            {
                var xml = PostManager.Get(url, Encoding.UTF8, 0, (request) =>
                {
                    request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 FirePHP/0.7.4";
                });

                var info = JsonSerializer.Deserialize <CaiLeleOpenInfo>(xml);
                dic.Add(FomartIssuseNumber(gameName, info.openTerm), FomartWinNumber(gameName, info.openResult));

                return(dic);
            }
            catch
            {
                return(dic);
            }
        }
Exemplo n.º 15
0
 public static string GetJsonData(string url)
 {
     try
     {
         var domain = ConfigHelper.AllConfigInfo["SelfDomain"] ?? "";
         url = domain + url;
         if (string.IsNullOrEmpty(url))
         {
             return(string.Empty);
         }
         var result = PostManager.Get(url, Encoding.UTF8);
         if (result == "404")
         {
             return(string.Empty);
         }
         return(result);
     }
     catch
     {
         return(string.Empty);
     }
 }
Exemplo n.º 16
0
        //private const string _url = "http://d.apiplus.net:8888/daily.do?token=f9e18eb66b794d91&code={0}&format=json";

        public override Dictionary <string, string> GetWinNumber(string gameCode, int lastIssuseCount, string issuseNumber = "")
        {
            var dic = new Dictionary <string, string>();

            try
            {
                var url  = string.Format(_url, FormatGameCode(gameCode));
                var json = PostManager.Get(url, Encoding.UTF8);
                var r    = JsonSerializer.Deserialize <KaiCaiWangResult>(json);
                if (r.data != null && r.data.Length > 0)
                {
                    foreach (var item in r.data)
                    {
                        dic.Add(FormatIssuseNumber(gameCode, item.expect), FormatWinNumber(gameCode, item.opencode));
                    }
                }
            }
            catch (Exception)
            {
                return(dic);
            }
            return(dic);
        }
Exemplo n.º 17
0
        public override Dictionary <string, string> GetWinNumber(string gameName, int lastIssuseCount, string issuseNumber)
        {
            var dic = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(gameName) || lastIssuseCount == 0)
            {
                return(dic);
            }
            string url  = DatermineURL(gameName);
            string json = PostManager.Get(url, Encoding.UTF8, 0, (request) =>
            {
                request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3";
                request.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            });
            string strTemp = "var listIssue = ";
            int    index   = json.IndexOf(strTemp) + strTemp.Length;

            json  = json.Substring(index, json.Length - index);
            index = json.IndexOf("];") + 1;
            json  = json.Substring(0, index);
            var result = Deserialize(json);

            return(DicResult(result, gameName, lastIssuseCount));
        }
Exemplo n.º 18
0
        /// <summary>
        /// 查询欧赔
        /// </summary>
        private string Get_OZ_SPXmlContent(string category)
        {
            var url = string.Empty;

            switch (category)
            {
            case "WLXE":
                url = "http://bd.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi01/bd.xml?_={0}";
                break;

            case "AM":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi02/bd.xml?_={0}";
                break;

            case "LB":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi03/bd.xml?_={0}";
                break;

            case "Bet365":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi04/bd.xml?_={0}";
                break;

            case "SNAI":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi05/bd.xml?_={0}";
                break;

            case "YDS":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi06/bd.xml?_={0}";
                break;

            case "WD":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi07/bd.xml?_={0}";
                break;

            case "Bwin":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi08/bd.xml?_={0}";
                break;

            case "Coral":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi09/bd.xml?_={0}";
                break;

            case "Oddset":
                url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi10/bd.xml?_={0}";
                break;

            case "TZBL":
                url = "http://bd.cpdyj.com/staticdata/oddsinfo/newbd/bdstat.xml?_=1370078649221";
                break;
            }

            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
            long            tt        = (DateTime.Now.Ticks - startTime.Ticks) / 10000;

            url = string.Format(url, tt);
            var encoding = Encoding.GetEncoding("gb2312");
            var content  = PostManager.Get(url, encoding, 0, (request) =>
            {
                //request.Host = "intf.cpdyj.com";
                //request.Referer = "http://jc.cpdyj.com/index.html";
                if (ServiceHelper.IsUseProxy("BJDC"))
                {
                    var proxy = ServiceHelper.GetProxyUrl();
                    if (!string.IsNullOrEmpty(proxy))
                    {
                        request.Proxy = new System.Net.WebProxy(proxy);
                    }
                }
            });

            return(content);
        }
Exemplo n.º 19
0
        public override OpenDataInfo GetOpenData(string gameCode, string issuseNumber)
        {
            var url = string.Empty;

            switch (gameCode.ToUpper())
            {
            case "DLT":
                url = string.Format(baseUrlFormat, "1");
                break;

            case "SSQ":
                url = string.Format(baseUrlFormat, "50");
                break;

            default:
                break;
            }
            if (string.IsNullOrEmpty(url))
            {
                return(new OpenDataInfo());
            }
            string html = string.Empty;

            try
            {
                html = PostManager.Get(url, Encoding.UTF8, requestHandler: (h) =>
                {
                    h.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0";
                });
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("请求网页{0}出错:{1}", url, ex.Message), ex);
            }

            var json = string.Empty;

            try
            {
                //取json数据
                var phaseDataIndex = html.IndexOf("phaseData");
                var end            = html.LastIndexOf("var result_config_arr");
                html = html.Substring(phaseDataIndex, end - phaseDataIndex).Replace("}};", "}}");
                //var oneLineIndex = html.IndexOf(";\n");}};
                //json = html.Substring(0, oneLineIndex).Substring(html.IndexOf("=") + 2);
                json = html.Substring(html.IndexOf("=") + 2);

                switch (gameCode.ToUpper())
                {
                case "DLT":
                    return(DecodeJson_DLT(json));

                case "SSQ":
                    return(DecodeJson_SSQ(json));

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("解析json{0}出错:{1}", json, ex.Message), ex);
            }

            return(new OpenDataInfo());
        }
Exemplo n.º 20
0
 public Post Get(int id)
 {
     return(_repo.Get(id));
 }
Exemplo n.º 21
0
        public override Dictionary <string, string> GetWinNumber(string gameName, int lastIssuseCount, string issuseNumber)
        {
            var dic = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(gameName) || lastIssuseCount == 0)
            {
                return(dic);
            }

            string lotId = string.Empty;

            switch (gameName)
            {
            case "FC3D":
                lotId = "52";
                break;

            case "PL3":
                lotId = "33";
                break;

            case "CQSSC":
                lotId = "10401";
                break;

            case "JXSSC":
                lotId = "13001";
                break;

            case "SD11X5":
                lotId = "21406";
                break;
                //case "JX11X5":
                //    lotId = "23009";
                //    break;
                //case "GD11X5":
                //    lotId = "23009";
                //    break;
            }
            if (string.IsNullOrEmpty(lotId))
            {
                return(dic);
            }

            try
            {
                string url  = string.Format(urlFormat, lotId, lastIssuseCount, DateTime.Now.Ticks);
                string json = PostManager.Get(url, Encoding.UTF8, 0);
                if (string.IsNullOrEmpty(json))
                {
                    return(dic);
                }
                int pageParamsIndex = json.IndexOf("},");
                if (pageParamsIndex == -1)
                {
                    return(dic);
                }
                json = json.Substring(pageParamsIndex + 2);
                var result = Deserialize(json);
                foreach (var item in result)
                {
                    dic.Add(FormatIssuseNumber(gameName, item.lotIssue), FormatWinNumber(gameName, item.kjCode));
                }
                return(dic);
            }
            catch
            {
                return(dic);
            }
        }
Exemplo n.º 22
0
        public override Dictionary <string, string> GetWinNumber(string gameCode, int lastIssuseCount,
                                                                 string issuseNumber)
        {
            var dic = new Dictionary <string, string>();

            #region Url

            var url = string.Empty;
            switch (gameCode)
            {
            case "JX11X5":
                url = url_jx11x5;
                break;

            case "GD11X5":
                url = url_gd11x5;
                break;

            case "SD11X5":
                url = url_sd11x5;
                break;

            case "CQSSC":
                url = url_cqssc;
                break;

            case "JXSSC":
                url = url_jxssc;
                break;

            case "SSQ":
                url = url_ssq;
                break;

            case "DLT":
                url = url_dlt;
                break;

            case "PL3":
                url = url_pl3;
                break;

            case "PL5":
                url = url_pl5;
                break;

            case "FC3D":
                url = url_fc3d;
                break;

            case "JSKS":
                url = url_jsk3;
                break;

            case "CQ11X5":
                url = url_cq11x5;
                break;

            case "DF6J1":
                url = url_df6j1;
                break;

            case "HD15X5":
                url = url_hd15x5;
                break;

            case "JLK3":
                url = url_jlk3;
                break;

            case "LN11X5":
                url = url_ln11x5;
                break;

            case "QLC":
                url = url_qlc;
                break;

            case "QXC":
                url = url_qxc;
                break;
            }

            #endregion

            if (string.IsNullOrEmpty(url))
            {
                return(dic);
            }
            var json       = PostManager.Get(url, Encoding.UTF8, 0).Trim();
            var startIndex = -1;
            var endIndex   = -1;
            switch (gameCode)
            {
            case "CQSSC":
            case "SD11X5":
            case "JSKS":
            case "LN11X5":
            case "JLK3":
            case "JX11X5":
            case "GD11X5":
            case "CQ11X5":
            case "JXSSC":
                startIndex = json.IndexOf("<tbody id=\"jq_body_kc_result\">");
                endIndex   = json.IndexOf("<div class=\"lotboxright\">");
                json       = json.Substring(startIndex, endIndex - startIndex);
                dic        = GeGPWinNumber(gameCode, json, lastIssuseCount);
                break;

            case "PL3":
            case "PL5":
            case "SSQ":
            case "DF6J1":
            case "QLC":
            case "QXC":
            case "FC3D":
            case "HD15X5":
                startIndex = json.LastIndexOf("<p class=\"lot_kjqs\">");
                endIndex   = json.IndexOf("<span class=\"lot_text alink\">");
                json       = json.Substring(startIndex, endIndex - startIndex);
                dic        = GeDPWinNumber(gameCode, json);
                break;

            case "DLT":
                startIndex = json.IndexOf("<tr onmouseout=");
                endIndex   = json.IndexOf("</tbody>");
                json       = json.Substring(startIndex, endIndex - startIndex)
                             .Replace("<tbody id=\"jq_body_kc_result\">", "").Replace("</tbody>", "").Replace("</table>", "")
                             .Replace("</div>", "");
                dic = GeGPWinNumber(gameCode, json, lastIssuseCount);
                break;

            default:
                break;
            }

            return(dic);
        }
Exemplo n.º 23
0
        public async Task <ServiceResult> Insert(Post s)
        {
            if (s == null || string.IsNullOrWhiteSpace(s.Name))
            {
                return(ServiceResponse.Error("Invalid Post sent to server."));
            }

            PostManager postManager = new PostManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter);

            if (!string.IsNullOrWhiteSpace(s.UUID))
            {
                var res = postManager.Get(s.UUID);
                if (res.Code == 200)
                {
                    return(this.Update(s));
                }
            }

            string authToken = this.GetAuthToken(Request);

            UserSession us = SessionManager.GetSession(authToken);

            if (us == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            //if (us.Captcha?.ToUpper() != s.Captcha?.ToUpper())
            //    return ServiceResponse.Error("Invalid code.");

            if (string.IsNullOrWhiteSpace(us.UserData))
            {
                return(ServiceResponse.Error("Couldn't retrieve user data."));
            }

            if (CurrentUser == null)
            {
                return(ServiceResponse.Error("You must be logged in to access this function."));
            }

            s.Author = CurrentUser.Name;

            if (s.Status.EqualsIgnoreCase("publish") && (s.PublishDate == DateTime.MinValue || s.PublishDate == null))
            {
                s.PublishDate = DateTime.UtcNow;
            }

            if (string.IsNullOrWhiteSpace(s.AccountUUID) || s.AccountUUID == SystemFlag.Default.Account)
            {
                s.AccountUUID = CurrentUser.AccountUUID;
            }

            if (string.IsNullOrWhiteSpace(s.CreatedBy))
            {
                s.CreatedBy = CurrentUser.UUID;
            }

            if (s.DateCreated == DateTime.MinValue)
            {
                s.DateCreated = DateTime.UtcNow;
            }

            if (s.Sticky == true && CurrentUser.SiteAdmin != true)
            {
                s.Sticky = false;
            }

            if (s.PublishDate < DateTime.Now &&
                CurrentUser.SiteAdmin == false)
            {
                return(ServiceResponse.Error("Publish date cannot be in the past."));
            }


            var result = postManager.Insert(s);

            if (result.Code != 200)
            {
                return(result);
            }

            SiteController site = new SiteController();
            await site.SendMessage(new GreenWerx.Models.Logging.EmailMessage()
            {
                Subject = "New Post by:" + CurrentUser.Name,
                Body    = "Moderate new post by:" + CurrentUser.Name + "<br/>" +
                          s.Name + "<br/>" +
                          "link to post" + "<br/>" +
                          s.Body + "<br/>" +
                          "",

                DateCreated = DateTime.UtcNow,
                EmailTo     = Globals.Application.AppSetting("SiteEmail"),
                EmailFrom   = Globals.Application.AppSetting("SiteEmail")
            });

            return(result);
        }
Exemplo n.º 24
0
        public ServiceResult Update(Post form)
        {
            if (form == null)
            {
                return(ServiceResponse.Error("Invalid Post sent to server."));
            }

            PostManager postManager = new PostManager(Globals.DBConnectionKey, this.GetAuthToken(Request));

            var res = postManager.Get(form.UUID);

            if (res.Code != 200)
            {
                return(res);
            }
            var dbS = (Post)res.Result;

            if (dbS.DateCreated == DateTime.MinValue)
            {
                dbS.DateCreated = DateTime.UtcNow;
            }

            dbS.Name = form.Name;

            //below are not on Post.cshtml form
            dbS.Deleted   = form.Deleted;
            dbS.Status    = form.Status;
            dbS.SortOrder = form.SortOrder;
            dbS.Private   = form.Private;

            if (form.PublishDate != dbS.PublishDate &&
                form.PublishDate < DateTime.Now &&
                CurrentUser.SiteAdmin == false)
            {
                return(ServiceResponse.Error("Publish date cannot be in the past."));
            }

            if (form.PublishDate != DateTime.MinValue)
            {
                dbS.PublishDate = form.PublishDate;
            }

            if (form.Status.EqualsIgnoreCase("publish"))
            {
                if (dbS.PublishDate == DateTime.MinValue || dbS.PublishDate == null)
                {
                    dbS.PublishDate = DateTime.UtcNow;
                }
            }

            dbS.Body          = form.Body;
            dbS.AllowComments = form.AllowComments;
            dbS.Category      = form.Category;
            dbS.KeyWords      = form.KeyWords;

            if (dbS.Sticky == true && CurrentUser.SiteAdmin != true)
            {
                dbS.Sticky = false;
            }

            if (string.IsNullOrWhiteSpace(dbS.Author))
            {
                dbS.Author = CurrentUser.Name;
            }

            return(postManager.Update(dbS));
        }
Exemplo n.º 25
0
        public void DoWork()
        {
            //取期号
            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
            long            tt        = (DateTime.Now.Ticks - startTime.Ticks) / 10000;
            var             url       = string.Format("http://i.sporttery.cn/rank_calculator/get_list?tid[]=77535&&pcode[]=chp&pcode[]=fnl&i_callback=getDataCallBack&_={0}", tt);
            var             encoding  = Encoding.GetEncoding("gb2312");
            var             content   = PostManager.Get(url, encoding, 0);

            content = content.Replace("getDataCallBack({\"data\":", "").Replace(");", "").Replace("}]}", "}]").Trim();

            var Ozb_GJList = KaSon.FrameWork.Common.JSON.JsonHelper.Deserialize <List <CupInfo> >(content);

            var ozb_GJMatchList  = new List <CupGJMatchInfo>();
            var ozb_GYJMatchList = new List <CupGYJMatchInfo>();

            if (Ozb_GJList.Count < 2)
            {
                return;
            }
            ozb_GJMatchList  = Get_OZB_GJMatchList(Ozb_GJList[0]);
            ozb_GYJMatchList = Get_OZB_GYJMatchList(Ozb_GJList[1]);

            var newOzb_GJ_List  = GetNewSJBList <CupGJMatchInfo>(ozb_GJMatchList, "OZB_GJ");
            var newOzb_GYJ_List = GetNewSJBList <CupGYJMatchInfo>(ozb_GYJMatchList, "OZB_GYJ");

            #region 发送 欧洲杯冠军数据通知

            this.WriteLog("1、开始=>发送欧洲杯冠军数据通知");
            var addCupGJMatchList    = new List <CupGJMatchInfo>();
            var updateCupGJMatchList = new List <CupGJMatchInfo>();
            foreach (var r in newOzb_GJ_List)
            {
                try
                {
                    if (r.Key == DBChangeState.Add)
                    {
                        addCupGJMatchList.Add(r.Value);
                    }
                    else
                    {
                        updateCupGJMatchList.Add(r.Value);
                    }
                }
                catch (Exception ex)
                {
                    this.WriteLog(string.Format("向数据库写入 竞彩欧洲杯冠军 数据异常 编号:{0},异常:{1}", r.Value.MatchId, ex.ToString()));
                }
            }
            if (addCupGJMatchList.Count > 0)
            {
                var category       = (int)NoticeType.JCOZB_GJ;
                var state          = (int)DBChangeState.Add;
                var param          = string.Join("_", (from l in addCupGJMatchList select l.MatchId).ToArray());
                var sign           = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param));
                var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign);

                //发送 竞彩足球队伍 添加 通知
                var innerKey = string.Format("{0}_{1}", "OZB_GJ", "Add");
                ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GJ);

                //ServiceHelper.SendNotice(issuse_Request, (log) =>
                //{
                //    this.WriteLog(log);
                //});
            }
            if (updateCupGJMatchList.Count > 0)
            {
                var category       = (int)NoticeType.JCOZB_GJ;
                var state          = (int)DBChangeState.Update;
                var param          = string.Join("_", (from l in updateCupGJMatchList select l.MatchId).ToArray());
                var sign           = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param));
                var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign);

                //发送 竞彩足球队伍 修改 通知
                var innerKey = string.Format("{0}_{1}", "OZB_GJ", "Update");
                ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GJ);

                //ServiceHelper.SendNotice(issuse_Request, (log) =>
                //{
                //    this.WriteLog(log);
                //});
            }

            this.WriteLog("1、发送欧洲杯冠军数据通知 完成");

            #endregion

            #region 发送 欧洲杯冠军数据通知

            this.WriteLog("2、开始=>发送欧洲杯冠亚军数据通知");
            var addCupGYJMatchList    = new List <CupGYJMatchInfo>();
            var updateCupGYJMatchList = new List <CupGYJMatchInfo>();
            foreach (var r in newOzb_GYJ_List)
            {
                try
                {
                    if (r.Key == DBChangeState.Add)
                    {
                        addCupGYJMatchList.Add(r.Value);
                    }
                    else
                    {
                        updateCupGYJMatchList.Add(r.Value);
                    }
                }
                catch (Exception ex)
                {
                    this.WriteLog(string.Format("向数据库写入 竞彩欧洲杯冠军 数据异常 编号:{0},异常:{1}", r.Value.MatchId, ex.ToString()));
                }
            }
            if (addCupGYJMatchList.Count > 0)
            {
                var category       = (int)NoticeType.JCOZB_GYJ;
                var state          = (int)DBChangeState.Add;
                var param          = string.Join("_", (from l in addCupGYJMatchList select l.MatchId).ToArray());
                var sign           = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param));
                var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign);

                //发送 竞彩足球队伍 添加 通知
                var innerKey = string.Format("{0}_{1}", "OZB_GYJ", "Add");
                ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GYJ);

                //ServiceHelper.SendNotice(issuse_Request, (log) =>
                //{
                //    this.WriteLog(log);
                //});
            }
            if (updateCupGYJMatchList.Count > 0)
            {
                var category       = (int)NoticeType.JCOZB_GYJ;
                var state          = (int)DBChangeState.Update;
                var param          = string.Join("_", (from l in updateCupGYJMatchList select l.MatchId).ToArray());
                var sign           = Encipherment.MD5(string.Format("IIIOO{0}{1}{2}", category, state, param));
                var issuse_Request = string.Format("NoticeCategory={0}&ChangeState={1}&Param={2}&Sign={3}", category, state, param, sign);

                //发送 竞彩足球队伍 修改 通知
                var innerKey = string.Format("{0}_{1}", "OZB_GYJ", "Update");
                ServiceHelper.AddAndSendNotification(param, "", innerKey, NoticeType.JCOZB_GYJ);

                //ServiceHelper.SendNotice(issuse_Request, (log) =>
                //{
                //    this.WriteLog(log);
                //});
            }

            this.WriteLog("2、发送欧洲杯冠亚军数据通知 完成");

            #endregion
        }
Exemplo n.º 26
0
        /// <summary>
        /// 创建文件全路径
        /// </summary>
        //private string BuildFileFullName(string fileName, string issuseNumber)
        //{
        //    if (string.IsNullOrEmpty(Sp_SavePath))
        //        Sp_SavePath = ServiceHelper.Get_BJDC_SPSavePath();
        //    var path = Path.Combine(Sp_SavePath, issuseNumber);
        //    try
        //    {
        //        if (!Directory.Exists(path))
        //            Directory.CreateDirectory(path);
        //    }
        //    catch (Exception ex)
        //    {
        //        this.WriteLog(string.Format("创建目录{0}失败:{1}。", path, ex.ToString()));
        //    }
        //    return Path.Combine(path, fileName);
        //}

        /// <summary>
        /// 保存OZ SP
        /// </summary>
        private void Save_OZ_SPInfo <T>(List <T> list, string fileName, string category, string issuseNumber) where T : BJDC_SPF_OZ_SPInfo
        {
            var baseTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));//.AddSeconds(1366558200)

            //  var fileFullName = BuildFileFullName(fileName, issuseNumber);
            if (list.Count == 0)
            {
                return;
            }
            //不是平均赔率 采集变化历史
            if (!string.IsNullOrEmpty(category))
            {
                #region 保存SP走势数据

                foreach (var item in list)
                {
                    try
                    {
                        if (item.Win_Odds == 0 || item.Flat_Odds == 0 || item.Lose_Odds == 0)
                        {
                            continue;
                        }

                        var url = string.Empty;
                        #region 获取URL
                        switch (category)
                        {
                        case "WLXE":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi01/{1}.xml?_={0}";
                            break;

                        case "AM":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi02/{1}.xml?_={0}";
                            break;

                        case "LB":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi03/{1}.xml?_={0}";
                            break;

                        case "Bet365":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi04/{1}.xml?_={0}";
                            break;

                        case "SNAI":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi05/{1}.xml?_={0}";
                            break;

                        case "YDS":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi06/{1}.xml?_={0}";
                            break;

                        case "WD":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi07/{1}.xml?_={0}";
                            break;

                        case "Bwin":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi08/{1}.xml?_={0}";
                            break;

                        case "Coral":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi09/{1}.xml?_={0}";
                            break;

                        case "Oddset":
                            url = "http://jc.cpdyj.com/staticdata/oddsinfo/newbd/ouzhi10/{1}.xml?_={0}";
                            break;
                        }
                        #endregion

                        System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
                        long            tt        = (DateTime.Now.Ticks - startTime.Ticks) / 10000;
                        url = string.Format(url, tt, item.OddsMid);
                        var encoding   = Encoding.GetEncoding("gb2312");
                        var spTrendXml = PostManager.Get(url, encoding, 0, (request) =>
                        {
                            request.Host    = "intf.cpdyj.com";
                            request.Referer = "http://jc.cpdyj.com/index.html";
                            if (ServiceHelper.IsUseProxy("BJDC"))
                            {
                                var proxy = ServiceHelper.GetProxyUrl();
                                if (!string.IsNullOrEmpty(proxy))
                                {
                                    request.Proxy = new System.Net.WebProxy(proxy);
                                }
                            }
                        });

                        if (string.IsNullOrEmpty(spTrendXml))
                        {
                            continue;
                        }
                        if (spTrendXml == "404")
                        {
                            continue;
                        }

                        var doc = new XmlDocument();
                        doc.LoadXml(spTrendXml);
                        var root = doc.SelectSingleNode("xml");
                        if (root == null)
                        {
                            throw new Exception("从xml中查询节点错误  - " + spTrendXml);
                        }

                        var trendList = new List <BJDC_SPF_SP_Trend>();
                        foreach (XmlNode t in root.ChildNodes)
                        {
                            //<row oh="3.20" od="3.00" oa="2.25" tp="1" gtime="1370047821"></row>
                            var win   = t.Attributes["oh"].Value.GetDecimal();
                            var flat  = t.Attributes["od"].Value.GetDecimal();
                            var lose  = t.Attributes["oa"].Value.GetDecimal();
                            var tp    = t.Attributes["tp"].Value.GetInt32();
                            var gtime = baseTime.AddSeconds(t.Attributes["gtime"].Value.GetInt32());

                            trendList.Add(new BJDC_SPF_SP_Trend
                            {
                                CreateTime = gtime.ToString("yyyy-MM-dd HH:mm:ss"),
                                OddsMid    = item.OddsMid,
                                TP         = tp,
                                WinOdds    = win,
                                FlatOdds   = flat,
                                LoseOdds   = lose,
                            });
                        }
                        if (trendList.Count != 0)
                        {
                            //写入文件
                            var coll    = mDB.GetCollection <BJDC_SPF_SP_Trend>("BJDC_SPF_SP_" + category);
                            var mFilter = Builders <BJDC_SPF_SP_Trend> .Filter.Eq(b => b.OddsMid, item.OddsMid)
                                          & Builders <BJDC_SPF_SP_Trend> .Filter.Eq(b => b.issuseNumber, issuseNumber);

                            foreach (var item1 in trendList)
                            {
                                item1.issuseNumber = issuseNumber;
                            }

                            coll.DeleteMany(mFilter);
                            coll.InsertMany(trendList);

                            //var trendFullName = BuildFileFullName(string.Format("{0}_{1}_SP.json", category.ToLower(), item.OddsMid), issuseNumber);
                            //try
                            //{
                            //    ServiceHelper.CreateOrAppend_JSONFile(trendFullName, JsonSerializer.Serialize(trendList), (log) =>
                            //    {
                            //        this.WriteLog(log);
                            //    });
                            //}
                            //catch (Exception ex)
                            //{
                            //    this.WriteLog(string.Format("写入 OZ Trend SP 数据文件 {0} 失败:{1}", fileFullName, ex.ToString()));
                            //}

                            var customerSavePath = new string[] { "BJDC", issuseNumber };
                            //上传文件
                            //ServiceHelper.PostFileToServer(trendFullName, customerSavePath, (log) =>
                            //{
                            //    this.WriteLog(log);
                            //});
                        }
                    }
                    catch (Exception ex)
                    {
                        //   this.WriteLog(string.Format("写入 OZ SP 数据文件 {0} 失败:{1}", fileFullName, ex.ToString()));
                    }
                }

                #endregion
            }
            try
            {
                var coll    = mDB.GetCollection <BJDC_SPF_OZ_SPInfo>("BJDC_SPF_OZ_SPInfo");
                var mFilter = Builders <BJDC_SPF_OZ_SPInfo> .Filter.Eq(b => b.IssuseNumber, issuseNumber);

                foreach (var item1 in list)
                {
                    item1.IssuseNumber = issuseNumber;
                }

                coll.DeleteMany(mFilter);
                coll.InsertMany(list);

                //ServiceHelper.CreateOrAppend_JSONFile(fileFullName, JsonSerializer.Serialize(list), (log) =>
                //{
                //    this.WriteLog(log);
                //});

                var customerSavePath = new string[] { "BJDC", issuseNumber };
                //上传文件
                //ServiceHelper.PostFileToServer(fileFullName, customerSavePath, (log) =>
                //{
                //    this.WriteLog(log);
                //});
            }
            catch (Exception ex)
            {
                // this.WriteLog(string.Format("写入 OZ SP 数据文件 {0} 失败:{1}", fileFullName, ex.ToString()));
            }
        }
Exemplo n.º 27
0
        public override Dictionary <string, string> GetWinNumber(string gameName, int lastIssuseCount, string issuseNumber)
        {
            string url = GetUrl(gameName);
            Dictionary <string, string> result = new Dictionary <string, string>();
            string html = PostManager.Get(url, Encoding.UTF8, 0, (r) =>
            {
                r.Host      = "baidu.lecai.com";
                r.Accept    = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
                r.KeepAlive = true;
                r.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0";
            });
            string json = this.GetJson(html);

            switch (gameName)
            {
            case "CQSSC":
                result = GetCQSSCWinNumber(json, lastIssuseCount);
                break;

            case "FC3D":
                result = GetFC3DWinNumber(json, lastIssuseCount);
                break;

            case "GD11X5":
                result = GetGD11X5WinNumber(json, lastIssuseCount);
                break;

            case "JX11X5":
                result = GetJX11X5WinNumber(json, lastIssuseCount);
                break;

            case "JXSSC":
                result = GetJXSSCWinNumber(json, lastIssuseCount);
                break;

            case "PL3":
                json   = this.GetJsonForPL3(html);
                result = GetPL3WinNumber(json, lastIssuseCount);
                break;

            case "SD11X5":
                result = GetSD11X5WinNumber(json, lastIssuseCount);
                break;

            case "SDQYH":
                result = GetSDQYHWinNumber(json, lastIssuseCount);
                break;

            case "GDKLSF":
                result = GetGDKLSFWinNumber(json, lastIssuseCount);
                break;

            case "GXKLSF":
                result = GetGXKLSFWinNumber(json, lastIssuseCount);
                break;

            case "BJSC":
                result = GetBJSCWinNumber(json, lastIssuseCount);
                break;
            }

            result = this.FormatWinNumber(gameName, result);

            return(result);
        }
Exemplo n.º 28
0
        public void DoWork(string gameCode)
        {
            this.WriteLog("进入DoWork  开始采集数据");

            try
            {
                //var maxIssuseCount = 1;
                ////取期号http://jc.cpdyj.com/index.html";
                //System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
                //long tt = (DateTime.Now.Ticks - startTime.Ticks) / 10000;
                //var url = string.Format("http://intf.cpdyj.com/data/dc/issue.js?callback=expe&_={0}", tt);
                //var encoding = Encoding.GetEncoding("gb2312");
                //var content = PostManager.Get(url, encoding, 0, (request) =>
                //{
                //    request.Host = "intf.cpdyj.com";
                //    request.Referer = "http://bd.cpdyj.com/";
                //    if (ServiceHelper.IsUseProxy("BJDC"))
                //    {
                //        var proxy = ServiceHelper.GetProxyUrl();
                //        if (!string.IsNullOrEmpty(proxy))
                //        {
                //            request.Proxy = new System.Net.WebProxy(proxy);
                //        }
                //    }
                //});
                //content = content.Replace("expe(", "").Replace(");", "").Trim();
                //var issuseStrList = new List<string>();
                //var array = System.Web.Helpers.Json.Decode(content);
                //foreach (var item in array)
                //{
                //    if (issuseStrList.Count >= maxIssuseCount)
                //        break;
                //    issuseStrList.Add(item[0]);
                //}
                var issuseStrList = new List <string>();
                var getIssuseUrl  = "http://www.9188.com/data/phot/85/c.xml";
                var xml           = PostManager.Get(getIssuseUrl, Encoding.UTF8, 0, (request) =>
                {
                    if (ServiceHelper.IsUseProxy("BJDC"))
                    {
                        var proxy = ServiceHelper.GetProxyUrl();
                        if (!string.IsNullOrEmpty(proxy))
                        {
                            request.Proxy = new System.Net.WebProxy(proxy);
                        }
                    }
                });
                if (string.IsNullOrEmpty(xml))
                {
                    throw new Exception(string.Format("请求地址:{0}返回数据为空", getIssuseUrl));
                }
                var doc = new XmlDocument();
                doc.LoadXml(xml);
                var root = doc.SelectSingleNode("Resp");
                if (root == null)
                {
                    throw new Exception("从xml中查询节点错误  - " + xml);
                }


                foreach (XmlNode item in root.ChildNodes)
                {
                    var matchId = item.Attributes["pid"].Value;
                    if (string.IsNullOrEmpty(matchId))
                    {
                        continue;
                    }

                    issuseStrList.Add(matchId);
                }



                foreach (var currentIssuseNumber in issuseStrList)
                {
                    #region 保存OZSP

                    Save_OZ_SPInfo <BJDC_SPF_WLXE_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_WLXE_SPInfo>("WLXE"), "wlxe_SP.json", "WLXE", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_AM_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_AM_SPInfo>("AM"), "am_SP.json", "AM", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_LB_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_LB_SPInfo>("LB"), "lb_SP.json", "LB", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_Bet365_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_Bet365_SPInfo>("Bet365"), "bet365_SP.json", "Bet365", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_SNAI_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_SNAI_SPInfo>("SNAI"), "snai_SP.json", "SNAI", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_YDS_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_YDS_SPInfo>("YDS"), "yds_SP.json", "YDS", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_WD_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_WD_SPInfo>("WD"), "wd_SP.json", "WD", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_Bwin_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_Bwin_SPInfo>("Bwin"), "bwin_SP.json", "Bwin", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_Coral_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_Coral_SPInfo>("Coral"), "coral_SP.json", "Coral", currentIssuseNumber);
                    Save_OZ_SPInfo <BJDC_SPF_Oddset_SPInfo>(Get_OZ_SPF_SPInfo <BJDC_SPF_Oddset_SPInfo>("Oddset"), "oddset_SP.json", "Oddset", currentIssuseNumber);
                    //todo 格式不一样  要重新解析
                    //Save_OZ_SPInfo<BJDC_SPF_TZBL_SPInfo>(Get_OZ_SPF_SPInfo<BJDC_SPF_TZBL_SPInfo>("TZBL"), "tzbl_SP.json", "Oddset", currentIssuseNumber);


                    #endregion
                }
            }
            catch (Exception ex)
            {
                this.WriteLog(ex.ToString());
                throw ex;
            }
            this.WriteLog("DoWork  完成");
        }
Exemplo n.º 29
0
        /// <summary>
        /// 查询欧赔
        /// </summary>
        private string Get_OZ_SPXmlContent(string category)
        {
            var url = string.Empty;

            switch (category)
            {
            case "WLXE":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=1&_={0}";
                break;

            case "AM":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=2&_={0}";
                break;

            case "LB":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=3&_={0}";
                break;

            case "Bet365":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=4&_={0}";
                break;

            case "SNAI":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=5&_={0}";
                break;

            case "YDS":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=6&_={0}";
                break;

            case "WD":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=7&_={0}";
                break;

            case "Bwin":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=8&_={0}";
                break;

            case "Coral":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=9&_={0}";
                break;

            case "Oddset":
                url = "http://jc.cpdyj.com/api/getzcodds?lotyid=6&qh=&cid=10&_={0}";
                break;
            }

            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
            long            tt        = (DateTime.Now.Ticks - startTime.Ticks) / 10000;

            url = string.Format(url, tt);
            var encoding = Encoding.GetEncoding("gb2312");
            var content  = PostManager.Get(url, encoding, 0, (request) =>
            {
                //request.Host = "intf.cpdyj.com";
                //request.Referer = "http://jc.cpdyj.com/index.html";

                if (ServiceHelper.IsUseProxy("JCZQ"))
                {
                    var proxy = ServiceHelper.GetProxyUrl();
                    if (!string.IsNullOrEmpty(proxy))
                    {
                        request.Proxy = new System.Net.WebProxy(proxy);
                    }
                }
            });

            //content = content.Replace(replaceFlag, "").Replace(");", "");

            return(content);
        }