Esempio n. 1
0
        public JsonResult UserListData(JTableData adata)
        {
            PagingInfo pi = new PagingInfo()
            {
                BeginIndex = adata.iDisplayStart + 1,
                EndIndex   = adata.iDisplayStart + adata.iDisplayLength,
                TableName  = "t_d_redpack_list rpl inner join t_d_redpack rp on rp.ID = rpl.pack_id inner join t_d_user u on u.ID = rpl.user_id",
                Fileds     = "u.nickname, u.openid, rp.rbname, rpl.*",
                SortFields = " rpl.id desc"
            };

            if (!string.IsNullOrEmpty(adata.sSearch))
            {
                pi.Conditions = "  u.nickname like '%'+@key+'%' ";
                pi.Parameters.Add("key", adata.sSearch);
            }
            RedPackListService x_rpService = new RedPackListService();
            var list = x_rpService.GetPaging(pi);

            JTableResult <RedPackListInfo> ar = new JTableResult <RedPackListInfo>()
            {
                sEcho                = adata.sEcho,
                iTotalRecords        = pi.RecordCount,
                iTotalDisplayRecords = pi.RecordCount,
                aaData               = list
            };

            return(Json(ar, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public JsonResult SetAllPack()
        {
            AjaxMsgResult      result       = new AjaxMsgResult();
            RedPackListService x_rplService = new RedPackListService();
            var list = x_rplService.getAllUser();

            if (list.Count > 0)
            {
                lock (locker)
                {
                    list = x_rplService.getAllUser();
                    int count = 0;
                    for (int i = 0; i < list.Count; i++)
                    {
                        string noncestr = "";
                        string paysing  = "";
                        var    item     = list[i];
                        //Senparc.Weixin.MP.TenPayLibV3.RedPackApi.SendNormalRedPack("appid", "mchid", "tenpaykey", "certpath", "openid", "sendername", "ip", 125, "wishing word", "actionname", "remark", out noncestr, out paysing, "mchBillNo");
                        RequestModel model = new RequestModel()
                        {
                            openid      = item.OpenId,
                            amount      = item.PackMoney.ToString(),
                            clientip    = "127.0.0.1",
                            clientport  = "80",
                            hdclass     = "17",
                            sendtxt     = "解放碑地下环道游戏红包",
                            timecontrol = "1"
                        };
                        string req = SendRedPack.SendTo(model);
                        if (!req.Contains("Error") && req.Contains("{\"State\":\"0\"}"))
                        {
                            x_rplService.Update(() => new RedPackListInfo()
                            {
                                Noncestr = req, PaySign = paysing, PackStatus = 1
                            }, a => a.ID == item.ID);
                            count++;
                        }
                        Thread.Sleep(10);
                        if (i > 0 && i % 300 == 0)
                        {
                            Thread.Sleep(15000);
                        }
                    }
                    result.Success = true;
                    result.Msg     = "该发" + list.Count + "个,实发" + count + "个用户发送了红包!";
                }
            }
            else
            {
                result.Success = false;
                result.Msg     = "所有用户都已发送过红包";
            }
            return(Json(result));
        }
Esempio n. 3
0
        public JsonResult GameRed()
        {
            AjaxMsgResult result = new AjaxMsgResult();

            RedPackListService x_rplService = new RedPackListService();
            var info = x_rplService.CheckInRedPack(this.CurrentUser.ID);

            if (info.PackId > 0)
            {
                result.Success = true;
                result.Source  = info;
            }
            else
            {
                result.Success = false;
                result.Msg     = info.RbName;
            }

            return(Json(result));
        }