Пример #1
0
    /**
     * 客户端请求商品信息
     * @param shopList 商品信息
     */
    public void GC_SHOP_LIST(InputMessage data)
    {
        int       i, size;
        ArrayList shopList = new ArrayList();

        size = data.GetShort();
        for (i = 0; i < size; i++)
        {
            ShopInfoData shopList_Datas = new ShopInfoData();
            shopList_Datas.shopId = data.GetInt();           //商品id
            shopList_Datas.price  = data.GetInt();           //商品价格
            shopList.Add(shopList_Datas);
        }
        ShopHandler.Instance().GC_SHOP_LIST(shopList);
    }
Пример #2
0
        int limit = 100;//拿几条数据

        public async void GetDayDataFromDB()
        {
            DBProxyComponent dBProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();

            try
            {
                var acountscount = await dBProxyComponent.QueryCount <ProductInfoData>("{ }");

                while (skip < acountscount)
                {
                    string Json    = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort    = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS     = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts = await dBProxyComponent.QueryLss <ProductInfoData>(LSS);

                    foreach (var dataDate in acounts)
                    {
                        ProductInfoData Infodata = dataDate as ProductInfoData;
                        if (ProductInfolist.TryAdd(Infodata._ProductInfoID, Infodata))
                        {
                        }
                        ;
                        long ShopInfoID = Infodata._ShopInfoID;
                        lock (ShopProductlist)
                        {
                            List <ProductInfoData> datalist = new List <ProductInfoData>();
                            if (ShopProductlist.ContainsKey(ShopInfoID))
                            {
                                //有这个商铺直接往这个商铺的list里添加
                                ShopProductlist[ShopInfoID].Add(Infodata);
                            }
                            else
                            {
                                //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                if (ShopProductlist.TryAdd(ShopInfoID, datalist) == true)
                                {
                                }
                                ;
                                ShopProductlist[ShopInfoID].Add(Infodata);
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts1count = await dBProxyComponent.QueryCount <ProductInfoOrder>("{ }");

                while (skip < acounts1count)
                {
                    string Json     = "{ }";                 //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{_CreationTime:-1 }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <ProductInfoOrder>(LSS);

                    foreach (ProductInfoOrder item in acounts1)
                    {
                        ProductInfoOrder Orderdata = item as ProductInfoOrder;
                        long             UserID    = Orderdata._UserID;
                        lock (UserProductOrderlist)
                        {
                            List <ProductInfoOrder> datalist = new List <ProductInfoOrder>();
                            if (UserProductOrderlist.ContainsKey(UserID))
                            {
                                //有这个商铺直接往这个商铺的list里添加
                                UserProductOrderlist[UserID].Add(Orderdata);
                            }
                            else
                            {
                                //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                if (UserProductOrderlist.TryAdd(UserID, datalist) == true)
                                {
                                }
                                ;
                                UserProductOrderlist[UserID].Add(Orderdata);
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts2count = await dBProxyComponent.QueryCount <SimpleOrder>("{ }");

                while (skip < acounts2count)
                {
                    string Json     = "{ }";       //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{_id:-1 }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <SimpleOrder>(LSS);

                    foreach (SimpleOrder item in acounts1)
                    {
                        SimpleOrder Orderdata = item as SimpleOrder;
                        if (Orderdata._State == 0)
                        {
                            long UserID = Orderdata._UserID;
                            lock (UserSimpleOrderlist)
                            {
                                List <SimpleOrder> datalist = new List <SimpleOrder>();
                                if (UserSimpleOrderlist.ContainsKey(UserID))
                                {
                                    //有这个商铺直接往这个商铺的list里添加
                                    UserSimpleOrderlist[UserID].Add(Orderdata);
                                }
                                else
                                {
                                    //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                    if (UserSimpleOrderlist.TryAdd(UserID, datalist) == true)
                                    {
                                    }
                                    ;
                                    UserSimpleOrderlist[UserID].Add(Orderdata);
                                }
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acount1s = await dBProxyComponent.Query <ServiceInfoData>("{ }");

                foreach (ServiceInfoData item in acount1s)
                {
                    if (!ServiceInfos.Contains(item._ServiceInfoID))
                    {
                        ServiceInfos.Add(item._ServiceInfoID);
                    }
                }

                var acounts3count = await dBProxyComponent.QueryCount <ShopActivityInfo>("{ }");

                while (skip < acounts3count)
                {
                    string Json     = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <ShopActivityInfo>(LSS);

                    foreach (ShopActivityInfo item in acounts1)
                    {
                        ShopActivityInfo Infodata   = item as ShopActivityInfo;
                        long             ShopInfoID = Infodata._ShopInfoID;
                        lock (UserSimpleOrderlist)
                        {
                            List <ShopActivityInfo> datalist = new List <ShopActivityInfo>();
                            if (ShopActivitylist.ContainsKey(ShopInfoID))
                            {
                                //有这个商铺直接往这个商铺的list里添加
                                ShopActivitylist[ShopInfoID].Add(Infodata);
                            }
                            else
                            {
                                //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                if (ShopActivitylist.TryAdd(ShopInfoID, datalist) == true)
                                {
                                }
                                ;
                                ShopActivitylist[ShopInfoID].Add(Infodata);
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts4count = await dBProxyComponent.QueryCount <ShopInfoData>("{ }");

                while (skip < acounts4count)
                {
                    string Json    = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort    = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS     = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts = await dBProxyComponent.QueryLss <ShopInfoData>(LSS);

                    foreach (var dataDate in acounts)
                    {
                        ShopInfoData Infodata = dataDate as ShopInfoData;
                        if (ShopInfolist.TryAdd(Infodata._ShopInfoID, Infodata))
                        {
                        }
                        ;
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts5count = await dBProxyComponent.QueryCount <CollectProduct>("{ }");

                while (skip < acounts5count)
                {
                    string Json     = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <CollectProduct>(LSS);

                    foreach (CollectProduct item in acounts1)
                    {
                        CollectProduct Orderdata = item as CollectProduct;
                        if (Orderdata._State == 0)
                        {
                            long UserID = Orderdata._UserID;
                            lock (UserCollectProductlist)
                            {
                                List <CollectProduct> datalist = new List <CollectProduct>();
                                if (UserCollectProductlist.ContainsKey(UserID))
                                {
                                    //有这个商铺直接往这个商铺的list里添加
                                    UserCollectProductlist[UserID].Add(Orderdata);
                                }
                                else
                                {
                                    //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                    if (UserCollectProductlist.TryAdd(UserID, datalist) == true)
                                    {
                                    }
                                    ;
                                    UserCollectProductlist[UserID].Add(Orderdata);
                                }
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts6count = await dBProxyComponent.QueryCount <CollectShopInfo>("{ }");

                while (skip < acounts6count)
                {
                    string Json     = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <CollectShopInfo>(LSS);

                    foreach (CollectShopInfo item in acounts1)
                    {
                        CollectShopInfo Orderdata = item as CollectShopInfo;
                        if (Orderdata._State == 0)
                        {
                            long UserID = Orderdata._UserID;
                            lock (UserCollecShoptlist)
                            {
                                List <CollectShopInfo> datalist = new List <CollectShopInfo>();
                                if (UserCollecShoptlist.ContainsKey(UserID))
                                {
                                    //有这个商铺直接往这个商铺的list里添加
                                    UserCollecShoptlist[UserID].Add(Orderdata);
                                }
                                else
                                {
                                    //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                    if (UserCollecShoptlist.TryAdd(UserID, datalist) == true)
                                    {
                                    }
                                    ;
                                    UserCollecShoptlist[UserID].Add(Orderdata);
                                }
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts7count = await dBProxyComponent.QueryCount <Discount>("{ }");

                while (skip < acounts7count)
                {
                    string Json     = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <Discount>(LSS);

                    foreach (Discount item in acounts1)
                    {
                        Discount Orderdata = item as Discount;
                        if (Orderdata._State == 0)
                        {
                            long UserID = Orderdata._UserID;
                            lock (UserDiscountlist)
                            {
                                List <Discount> datalist = new List <Discount>();
                                if (UserDiscountlist.ContainsKey(UserID))
                                {
                                    //有这个商铺直接往这个商铺的list里添加
                                    UserDiscountlist[UserID].Add(Orderdata);
                                }
                                else
                                {
                                    //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                    if (UserDiscountlist.TryAdd(UserID, datalist) == true)
                                    {
                                    }
                                    ;
                                    UserDiscountlist[UserID].Add(Orderdata);
                                }
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts8count = await dBProxyComponent.QueryCount <Footmark>("{ }");

                while (skip < acounts8count)
                {
                    string Json     = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <Footmark>(LSS);

                    foreach (Footmark item in acounts1)
                    {
                        Footmark Orderdata = item as Footmark;
                        if (Orderdata._State == 0)
                        {
                            long UserID = Orderdata._UserID;
                            lock (UserFootmarklist)
                            {
                                List <Footmark> datalist = new List <Footmark>();
                                if (UserFootmarklist.ContainsKey(UserID))
                                {
                                    //有这个商铺直接往这个商铺的list里添加
                                    UserFootmarklist[UserID].Add(Orderdata);
                                }
                                else
                                {
                                    //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                    if (UserFootmarklist.TryAdd(UserID, datalist) == true)
                                    {
                                    }
                                    ;
                                    UserFootmarklist[UserID].Add(Orderdata);
                                }
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts9count = await dBProxyComponent.QueryCount <ThumbProduct>("{ }");

                while (skip < acounts9count)
                {
                    string Json     = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <ThumbProduct>(LSS);

                    foreach (ThumbProduct item in acounts1)
                    {
                        ThumbProduct Orderdata = item as ThumbProduct;
                        if (Orderdata._State == 0)
                        {
                            long ThumbProductID = Orderdata._ThumbProductID;
                            lock (ThumbUserlist)
                            {
                                List <ThumbProduct> datalist = new List <ThumbProduct>();
                                if (ThumbUserlist.ContainsKey(ThumbProductID))
                                {
                                    //有这个商铺直接往这个商铺的list里添加
                                    ThumbUserlist[ThumbProductID].Add(Orderdata);
                                }
                                else
                                {
                                    //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                    if (ThumbUserlist.TryAdd(ThumbProductID, datalist) == true)
                                    {
                                    }
                                    ;
                                    ThumbUserlist[ThumbProductID].Add(Orderdata);
                                }
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;

                var acounts10count = await dBProxyComponent.QueryCount <EvaluateProduct>("{ }");

                while (skip < acounts10count)
                {
                    string Json     = "{ }"; //查找类型里面可以添加斜杠来做匹配查找,例如:{userNowArea:/^湖南省/}
                    string sort     = "{ }"; //排序方式,必须要有参数和排序方式,例如:{userID:1}
                    string LSS      = Json + "|" + skip + "|" + limit + "|" + sort;
                    var    acounts1 = await dBProxyComponent.QueryLss <EvaluateProduct>(LSS);

                    foreach (EvaluateProduct item in acounts1)
                    {
                        EvaluateProduct Orderdata = item as EvaluateProduct;
                        if (Orderdata._State == 0)
                        {
                            long EvaluateProductID = Orderdata._EvaluateProductID;
                            lock (ProductEvaluatelist)
                            {
                                List <EvaluateProduct> datalist = new List <EvaluateProduct>();
                                if (ProductEvaluatelist.ContainsKey(EvaluateProductID))
                                {
                                    //有这个商铺直接往这个商铺的list里添加
                                    ProductEvaluatelist[EvaluateProductID].Add(Orderdata);
                                }
                                else
                                {
                                    //没有这个商铺,添加这个商铺,在往商铺里面的list里添加
                                    if (ProductEvaluatelist.TryAdd(EvaluateProductID, datalist) == true)
                                    {
                                    }
                                    ;
                                    ProductEvaluatelist[EvaluateProductID].Add(Orderdata);
                                }
                            }
                        }
                    }
                    skip += limit;
                }
                skip = 0;
            }
            catch (Exception e)
            {
                Log.Debug("ProductCenterComponent:GetDayDataFromDB:" + e);
            }
        }