示例#1
0
        static void ProcessN3(string n1, string n2)
        {
            CqlResult n1Result = ThriftTool.GetByCql("Select * from M01UserRelaction where key='" + n1 + "' limit 50000");
            CqlResult n2Result = ThriftTool.GetByCql("Select * from M01UserRelaction where key='" + n2 + "' limit 50000");
            var       n1List   = n1Result.Rows.First().Columns.Select(col => ThriftTool.ToString(col.Name)).Where(name => name != "KEY").ToList();
            var       n2List   = n2Result.Rows.First().Columns.Select(col => ThriftTool.ToString(col.Name)).Where(name => name != "KEY").ToList();

            foreach (var n3 in n1List.Intersect(n2List))
            {
                //Utility.Logging("n3=" + n3, Utility.DebugLevel.Info);
                if (n1 == n3 || n2 == n3)
                {
                    continue;
                }
                var sum       = Get2NodeValue(n1, n2) + Get2NodeValue(n2, n3) + Get2NodeValue(n1, n3);
                var orderList = new List <int> {
                    int.Parse(n1), int.Parse(n2), int.Parse(n3)
                };
                orderList.Sort();
                var key = orderList[2] + "_" + orderList[1] + "_" + orderList[0];
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", "sum", sum);
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", orderList[2] + "_" + orderList[1], Get2NodeValue(orderList[2].ToString(CultureInfo.InvariantCulture), orderList[1].ToString(CultureInfo.InvariantCulture)));
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", orderList[2] + "_" + orderList[0], Get2NodeValue(orderList[2].ToString(CultureInfo.InvariantCulture), orderList[0].ToString(CultureInfo.InvariantCulture)));
                ThriftTool.CounterAdd(key, "M01UserRelactionN3", orderList[1] + "_" + orderList[0], Get2NodeValue(orderList[1].ToString(CultureInfo.InvariantCulture), orderList[0].ToString(CultureInfo.InvariantCulture)));
            }
        }
示例#2
0
        public HighChart[] BahaGetOneGame(string game, string startDate, string endDate)
        {
            var gameList  = game.Split(',');
            var chartList = new HighChart[gameList.Length];

            for (var i = 0; i < gameList.Length; i++)
            {
                var rank      = new List <ScoreList>();
                var cqlResult = ThriftTool.GetByCql("select * from BahamutGames where Title='" + gameList[i] + "'");

                foreach (CqlRow t in cqlResult.Rows)
                {
                    var rl = new ScoreList();
                    foreach (var col in t.Columns)
                    {
                        var name = ThriftTool.ToString(col.Name);
                        switch (name)
                        {
                        case "Title":
                            rl.Title = ThriftTool.ToString(col.Value);
                            break;

                        case "Link":
                            rl.Link = ThriftTool.ToString(col.Value);
                            break;

                        case "Article":
                            rl.Article = ThriftTool.ToString(col.Value);
                            break;

                        case "Popular":
                            rl.Popular = ThriftTool.ToString(col.Value);
                            break;

                        case "Date":
                            rl.Date = ThriftTool.ToInt(col.Value);
                            break;
                        }
                    }
                    rank.Add(rl);
                }

                var ranks = from n in rank orderby n.Date select n;

                chartList[i] = ParseToHighChart(ranks);
            }
            //ThriftTool.TransportClose();

            return(chartList);
        }
示例#3
0
        static int GetCfCount(string cf, int limit)
        {
            var sqlStr = "select count(*) from \"M01UserRelaction\" limit 400000";
            //var sqlStr = "Select count(*) from '" + cf + "' limit " + limit;
            CqlResult n1Result = ThriftTool.GetByCql(sqlStr);

            Console.WriteLine("Type=" + n1Result.Type);
            Console.WriteLine("Num=" + n1Result.Num);
            foreach (var row in n1Result.Rows)
            {
                Console.WriteLine("row.Key=" + ThriftTool.ToString(row.Key));
                Console.WriteLine("row.Columns.Count=" + row.Columns.Count);
                foreach (var col in row.Columns)
                {
                    Console.WriteLine("Type=" + col.Value.GetType());
                    Console.WriteLine("\tcol.Name=" + ThriftTool.ToString(col.Name));
                    Console.WriteLine("\tcol.Value=" + ThriftTool.ToLong(col.Value));
                }
            }

            return(ThriftTool.ToInt(n1Result.Rows.First().Columns.First().Value));
        }
示例#4
0
        public List <string> BahaGetDayList(string mode)
        {
            var result = new List <string>();

            var cqlResult = ThriftTool.GetByCql("select first 30 Date from BahamutDays where Mode='" + mode + "'");

            foreach (CqlRow t in cqlResult.Rows)
            {
                foreach (var col in t.Columns)
                {
                    var name = ThriftTool.ToString(col.Name);
                    switch (name)
                    {
                    case "Date":
                        result.Add(ThriftTool.ToString(col.Value));
                        break;
                    }
                }
            }
            //ThriftTool.TransportClose();
            result.Sort();

            return(result);
        }