/// <summary>
 /// 如果有,返回并删除
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public Online RemovedGet(string key)
 {
     lock (lockObj)
     {
         Online outOnline = null;
         if (ConcurrentQueueLst.TryGetValue(key, out outOnline))
         {
             ConcurrentQueueLst.Remove(key);
             return(outOnline);
         }
         return(null);
     }
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="key"></param>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool Put(string key, Online item)
 {
     lock (lockObj)
     {
         Online outOnline = null;
         if (ConcurrentQueueLst.TryGetValue(key, out outOnline))
         {
             return(false);
         }
         ConcurrentQueueLst.Add(key, item);
         Console.WriteLine("key:" + key + " [[[[[[" + item.result);
         return(true);
     }
 }
Пример #3
0
        private static void IntoSql(Online o)
        {
            string lotteryType = "tenct";
            int    lotteryid   = 11;
            bool   isCompled   = mLotteryIssuesData.UpdateResult(new OpenResultEntity()
            {
                expect   = o.issue,
                opencode = o.result,
                opentime = DateTime.Now
            }, lotteryid);//保存开奖结果

            if (isCompled)
            {
                //取消延迟开奖
                mBetDetailsCalculate.Calculate(lotteryType, o.issue, o.result);//计算投注明细中奖金额
                LogManager.Info(string.Format("计算开奖成功: type={0},lotteryCode={1}", lotteryType, lotteryType));
            }
        }
Пример #4
0
        private static int pcqqOnline(int c, int d)
        {
            int cha = 0;

            try
            {
                int code = 200;

                if (code == 200)
                {
                    //{"c":267762809,"ec":0,"h":281650131}
                    String result = HttpPostRequest(tenctRequestUrl);
                    if (string.IsNullOrEmpty(result))
                    {
                        return(0);
                    }
                    result = result.Substring(12);
                    result = result.Substring(0, result.Length - 1);
                    var jobj = JObject.Parse(result);
                    var rows = jobj.Property("c");
                    if (rows == null)
                    {
                        return(0);
                    }

                    int   curr = Convert.ToInt32(rows.Value.ToString());
                    int   l    = curr;
                    int[] a    = new int[9];
                    int   i    = 0;
                    int   sum  = 0;
                    if (c % 2 == 0)
                    {
                        c2 = l;
                    }
                    else
                    {
                        c1 = l;
                    }
                    if (c % 2 == 0)
                    {
                        cha = c2 - c1;
                    }
                    else
                    {
                        cha = c1 - c2;
                    }
                    while (true)
                    {
                        a[i] = l % 10;
                        sum  = sum + a[i];
                        i++;
                        l = l / 10;
                        if (l / 10 == 0)
                        {
                            a[i] = l;
                            sum  = sum + a[i];
                            break;
                        }
                    }
                    //System.out.println(Arrays.toString(a));

                    string s   = curr.ToString();
                    string qs  = DateTime.Now.ToString("yyyyMMdd");
                    int    min = d * 60 + c;
                    String qs1 = "";
                    if (min < 100)
                    {
                        qs1 = "00" + min;
                    }
                    else if (min >= 100 && min < 1000)
                    {
                        qs1 = "0" + min;
                    }
                    else
                    {
                        qs1 = min + "";
                    }
                    String jieguo = sum % 10 + "," + a[3] + "," + a[2] + "," + a[1] + "," + a[0];
                    LogManager.Info("开奖结果:" + jieguo);
                    string dateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                    LogManager.Info("期数:" + qs + "-" + qs1 + " " + DateTime.Now + " " + s + " " + (cha >= 0 ? "+" + cha : cha.ToString()));
                    if (cha != 0)
                    {
                        Online o = new Online();
                        o.issue  = (qs + qs1);
                        o.time   = (dateTime);
                        o.total  = (s);
                        o.change = (cha >= 0 ? "+" + cha : cha + "");
                        o.result = (jieguo);
                        o.wan    = (sum % 10);
                        o.qian   = (a[3]);
                        o.bai    = (a[2]);
                        o.shi    = (a[1]);
                        o.ge     = (a[0]);
                        //MysqlTool.insertPcqq(o);
                        string key = qs + qs1;//期数
                        //TenctOpenResult.CreateInstan().Put(key, o);
                        int whileCount = 0;
                        while (true)
                        {
                            try
                            {
                                whileCount++;
                                if (whileCount > 5)
                                {
                                    break;
                                }
                                IntoSql(o);
                                break;
                            }
                            catch (Exception instar)
                            {
                                LogManager.Error("腾讯分分彩运算错误---" + o.ToString(), instar);
                            }
                            System.Threading.Thread.Sleep(5);
                        }
                    }
                }
            }
            catch (IOException e)
            {
                LogManager.Error("", e);
                return(0);
            }
            return(cha);
        }