Esempio n. 1
0
    //开奖设置倒计时
    private void isTimeToOpen()
    {
        int    pageIndex;
        int    recordCount;
        int    pageSize = Convert.ToInt32(ub.Get("SiteListNo"));
        string strWhere = "isDone=1";

        string[] pageValUrl = { "act", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }
        try
        {
            // 开始读取列表
            IList <BCW.Model.GoodsList> listSSCpay = new BCW.BLL.GoodsList().GetGoodsListsForGoodsOpen(pageIndex, pageSize, strWhere, out recordCount);
            if (listSSCpay.Count > 0)
            {
                int k = 1;
                foreach (BCW.Model.GoodsList n in listSSCpay)
                {
                    // if(n.Identification==0)//系统商品开奖
                    // if(n.Identification!=0)//用户商品开奖
                    if (n.GoodsValue == n.Number)
                    {
                        try
                        {
                            long    sum   = 0;
                            int     start = 0;
                            string  str   = "";
                            DataSet ds    = new BCW.BLL.yg_BuyLists().GetListTop("top 100 *", str);//获取购买的最后100条记录
                            if (ds != null && ds.Tables[0].Rows.Count > 0)
                            {
                                start = Convert.ToInt32(ds.Tables[0].Rows[0]["Id"]);//最后的记录开始往前数100
                                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                {
                                    sum = Convert.ToInt64(sum + (Convert.ToInt32(Convert.ToDateTime(ds.Tables[0].Rows[i]["BuyTime"]).ToString("hhmmssfff"))));
                                }
                            }
                            int  yushu   = Convert.ToInt32(sum % Convert.ToInt64(n.GoodsValue));
                            long userGet = 0;
                            userGet = new BCW.BLL.yg_BuyLists().GetUserId_yg_BuyListsForYungouma(Convert.ToInt32(n.Id), (Convert.ToInt32(yushu)));//返回中奖id记录的一列
                            BCW.Model.yg_BuyLists mod = new BCW.BLL.yg_BuyLists().Getyg_BuyLists(userGet);
                            if (userGet != 0)
                            {
                                n.Winner    = userGet.ToString();// +yushu.ToString();// +"," + start; //记录中奖Id,云购吗,100条记录数最后一条记录码
                                n.ImgCounts = start;
                                n.isDone    = 2;
                                DateTime dt = DateTime.Now;
                                n.OverTime    = dt;
                                n.lotteryTime = dt;
                                //n.RemainingTime = dt.AddSeconds(Opentime*60);
                                int Opentime = Convert.ToInt32(ub.GetSub("timeToOpen", xmlPath));
                                int time     = Opentime * 60;
                                n.RemainingTime = dt.AddSeconds(time);
                                new BCW.BLL.GoodsList().Update(n);                            //更新获奖id,获奖码,到该商品
                                mod.Address = "1";                                            //=win 成功获奖标识
                                new BCW.BLL.yg_BuyLists().UpdateAddress(mod.Id, mod.Address); //更新BuyLists
                                if ((n.GoodsType % 2) == 0)                                   //类型为偶数时自动生成新一期,偶数循环
                                {
                                    n.RemainingTime = DateTime.Now;
                                    n.Winner        = "0";
                                    n.isDone        = 1;
                                    n.periods      += 1;
                                    n.Number        = 0;
                                    n.lotteryTime   = DateTime.Now;
                                    n.Addtime       = DateTime.Now;
                                    n.ImgCounts     = 0;
                                    new BCW.BLL.GoodsList().Add(n);
                                }
                                //else {
                                //    //builder.Append(Out.Div("div", "商品类型不为循环!不进行新建商品!"));
                                //    //if (n.Identification != 0)//用户商品开奖并且不循环
                                //    //{
                                //    //    ;
                                //    //}

                                //}
                                builder.Append(Out.Tab("<div>", ""));
                                builder.Append("商品列" + n.Id + n.GoodsName + "开奖成功!" + "时间:" + Convert.ToDateTime(n.lotteryTime).ToString("yyyy-MM-dd hh:mm:ss fff") + "<br/>");
                                builder.Append("正常检测中...");
                                builder.Append(Out.Tab("</div>", ""));
                            }
                            else
                            {
                                builder.Append("商品列" + "开奖有误!");
                            }
                        }
                        catch (Exception e)
                        {
                            new BCW.BLL.Guest().Add(GameId, 10086, "酷爆网客服", "商品Id" + n.Id + "名称" + n.GoodsName + "第" + n.periods + "期" + "开奖失败原因" + e + ",请查看刷新机进行开奖");//向系统发内线
                        }
                    }
                    k++;
                }
            }
            else
            {
                // builder.Append(Out.Div("div", "没有需要开奖的商品..."));
            }
        }
        catch (Exception e)
        {
            new BCW.BLL.Guest().Add(1, 10086, "酷爆网客服", "开奖异常:" + e + "错误码003");//向 系统发内线
            // System.Console.WriteLine("传递过来的异常值为:{0}", e);
            // builder.Append(Out.Div("div", "开奖异常.."));
        }
    }
Esempio n. 2
0
    //倒计时完毕
    private void isTimeToOpenNew()
    {
        int    pageIndex;
        int    recordCount;
        int    pageSize = Convert.ToInt32(ub.Get("SiteListNo"));
        string strWhere = "isDone=2";

        string[] pageValUrl = { "act", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }
        try
        {
            // 开始读取列表
            IList <BCW.Model.GoodsList> listSSCpay = new BCW.BLL.GoodsList().GetGoodsListsForGoodsOpen(pageIndex, pageSize, strWhere, out recordCount);
            if (listSSCpay.Count > 0)
            {
                int k = 1;
                foreach (BCW.Model.GoodsList n in listSSCpay)
                {
                    try
                    {
                        int      meidsell = Convert.ToInt32(n.Identification);//出售者Id
                        DateTime now      = DateTime.Now;
                        DateTime dt       = Convert.ToDateTime(n.RemainingTime);
                        if (DateTime.Compare(now, dt) > 0)
                        {
                            n.isDone        = 0;
                            n.StockYungouma = "已完结";
                            if (n.Identification != 0)                                             //用户出售,盈利反馈给用户
                            {
                                string menamesell        = new BCW.BLL.User().GetUsName(meidsell); //出售者Id
                                long   gold              = Convert.ToInt64(n.statue * (n.GoodsValue - 10));
                                string bzText            = ub.Get("SiteBz");
                                long   UserSellGetPersan = Convert.ToInt64(ub.GetSub("UserSellGetPersan", xmlPath));//用户获得份数
                                long   get      = Convert.ToInt64(n.statue * UserSellGetPersan);
                                long   Usergold = new BCW.BLL.User().GetGold(meidsell);
                                if (ub.GetSub("KbygStatus", xmlPath) == "0")
                                {
                                    new BCW.BLL.User().UpdateiGold(meidsell, get, "云购出售商品盈利");
                                    //发内线
                                    string str = "您在[URL=/bbs/game/kbyg.aspx]云购[/URL]发售的" + n.GoodsName + "" + "成功售出并盈利了" + get + bzText + "[URL=/bbs/game/kbyg.aspx]去看看吧[/URL]";
                                    new BCW.BLL.Guest().Add(GameId, meidsell, menamesell, str);
                                    new BCW.BLL.Action().Add(GameId, 0, meidsell, menamesell, "在[URL=/bbs/game/kbyg.aspx]云购[/URL]获得了" + get + bzText + "第" + n.periods + "期" + (n.GoodsName) + "的收入");
                                }
                                else if (ub.GetSub("KbygStatus", xmlPath) == "2")
                                {
                                    new BCW.SWB.BLL().UpdateMoney(meidsell, get, 31);
                                    //发内线
                                    string str = "您在[URL=/bbs/game/kbyg.aspx]云购[/URL]测试发售的" + n.GoodsName + "" + "成功售出并盈利了" + get + "云币" + "[URL=/bbs/game/kbyg.aspx]去看看吧[/URL]";
                                    new BCW.BLL.Guest().Add(GameId, meidsell, menamesell, str);
                                    new BCW.BLL.Action().Add(GameId, 0, meidsell, menamesell, "在[URL=/bbs/game/kbyg.aspx]云购[/URL]获得了" + get + bzText + "第" + n.periods + "期" + (n.GoodsName) + "的云币收入");
                                }
                            }
                            new BCW.BLL.GoodsList().Update(n);//更新获奖id,获奖码,到该商品
                            BCW.Model.yg_BuyLists model = new BCW.BLL.yg_BuyLists().Getyg_BuyLists(Convert.ToInt64(n.Winner));
                            string name = new BCW.BLL.User().GetUsName(Convert.ToInt32(model.UserId));
                            int    meid = Convert.ToInt32(model.UserId);
                            if (ub.GetSub("KbygStatus", xmlPath) == "0")
                            {
                                new BCW.BLL.Action().Add(GameId, 0, meid, name, "在[URL=/bbs/game/kbyg.aspx]云购[/URL]获奖了" + "第" + n.periods + "期" + (n.GoodsName));
                                //发内线
                                string sstrLog = "您在[URL=/bbs/game/kbyg.aspx]云购[/URL]购买的第" + n.periods + "期" + n.GoodsName + "" + "中奖了" + "[URL=/bbs/game/kbyg.aspx?act=geren]去看看吧[/URL]";
                                new BCW.BLL.Guest().Add(GameId, Convert.ToInt32(model.UserId), name, sstrLog);
                            }
                            else if (ub.GetSub("KbygStatus", xmlPath) == "2")
                            {
                                new BCW.BLL.Action().Add(GameId, 0, meid, name, "在[URL=/bbs/game/kbyg.aspx]云购[/URL]测试获奖了" + "第" + n.periods + "期" + (n.GoodsName));
                                //发内线
                                string sstrLog = "您在[URL=/bbs/game/kbyg.aspx]云购[/URL]测试购买的第" + n.periods + "期" + n.GoodsName + "" + "中奖了" + "[URL=/bbs/game/kbyg.aspx?act=geren]去看看吧[/URL]";
                                new BCW.BLL.Guest().Add(GameId, Convert.ToInt32(model.UserId), name, sstrLog);
                            }
                        }
                    }
                    catch
                    {
                        new BCW.BLL.Guest().Add(GameId, 10086, "酷爆网客服", "商品Id" + n.Id + "名称" + n.GoodsName + "第" + n.periods + "期" + "设置倒计时失败,请查看刷新机进行开奖)" + "错误码002");//向系统发内线
                    }
                }

                k++;
            }
            //else
            //{
            //    builder.Append("暂未有倒计时商品..");
            //}
        }
        catch (Exception e)
        {
            System.Console.WriteLine("传递过来的异常值为:{0}", e);
            //throw
            //  builder.Append(Out.Div("div", "设置倒计时失败!.."));
        }
    }