Beispiel #1
0
        /// <summary>
        /// 赠送钻石
        /// </summary>
        /// <param name="diamond">赠送钻石信息</param>
        /// <returns></returns>
        public Message GrantDiamond(RecordGrantDiamond diamond)
        {
            var prams = new List <DbParameter>
            {
                Database.MakeInParam("MasterID", diamond.MasterID),
                Database.MakeInParam("ClientIP", diamond.ClientIP),
                Database.MakeInParam("UserID", diamond.UserID),
                Database.MakeInParam("AddDiamond", diamond.AddDiamond),
                Database.MakeInParam("TypeID", diamond.TypeID),
                Database.MakeInParam("CollectNote", diamond.CollectNote)
            };

            Message msg = MessageHelper.GetMessage(Database, "WSP_PM_GrantDiamond", prams);

            return(msg);
        }
        /// <summary>
        /// 页面保存
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strReason = CtrlHelper.GetText(txtReason);
            int    diamond   = CtrlHelper.GetInt(txtDiamond, 0);
            bool   flag      = cbPull.Checked;

            if (diamond <= 0)
            {
                MessageBox("赠送钻石数必须大于零!");
                return;
            }
            if (string.IsNullOrEmpty(strReason))
            {
                MessageBox("赠送备注不能为空");
                return;
            }
            string             ip  = GameRequest.GetUserIP();
            RecordGrantDiamond rgd = new RecordGrantDiamond();

            rgd.MasterID    = userExt.UserID;
            rgd.UserID      = IntParam;
            rgd.TypeID      = 0;
            rgd.AddDiamond  = diamond;
            rgd.ClientIP    = ip;
            rgd.CollectNote = strReason;

            Message msg = FacadeManage.aideTreasureFacade.GrantDiamond(rgd);

            if (msg.Success)
            {
                if (flag)
                {
                    AccountsUmeng umeng = FacadeManage.aideAccountsFacade.GetAccountsUmeng(IntParam);
                    if (umeng != null && !string.IsNullOrEmpty(umeng.DeviceToken))
                    {
                        string   content = "系统管理员" + userExt.UserName + "已赠送您" + diamond.ToString() + "钻石";
                        DateTime start   = DateTime.Now.AddMinutes(1);
                        DateTime end     = start.AddHours(5);
                        bool     result  = Umeng.SendMessage(umeng.DeviceType, content, "unicast", start.ToString("yyyy-MM-dd HH:mm:ss"), end.ToString("yyyy-MM-dd HH:mm:ss"), umeng.DeviceToken);
                        if (!result)
                        {
                            MessageBox("赠送成功,但推送消息失败,请前往友盟后台绑定系统后台ip");
                            return;
                        }
                        RecordAccountsUmeng record = new RecordAccountsUmeng();
                        record.MasterID    = rgd.MasterID;
                        record.UserID      = rgd.UserID;
                        record.PushType    = umeng.DeviceType;
                        record.PushTime    = DateTime.Now;
                        record.PushIP      = ip;
                        record.PushContent = content;
                        int rows = FacadeManage.aideRecordFacade.AddRecordAccountsUmeng(record);
                        MessageBox(rows > 0 ? "赠送成功" : "赠送成功,但推送记录写入失败");
                    }
                    else
                    {
                        MessageBox("赠送成功,但推送用户未绑定设备,无法推送");
                    }
                }
                else
                {
                    MessageBox("赠送成功");
                }
            }
            else
            {
                MessageBox("赠送失败");
            }
        }
Beispiel #3
0
 /// <summary>
 /// 赠送钻石
 /// </summary>
 /// <param name="diamond">赠送钻石信息</param>
 /// <returns></returns>
 public Message GrantDiamond(RecordGrantDiamond diamond)
 {
     return(aideTreasureData.GrantDiamond(diamond));
 }
        /// <summary>
        /// 数据保存
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strReason = CtrlHelper.GetText(txtReason);
            int    a         = 0;

            if (!int.TryParse(txtDiamond.Text, out a))
            {
                MessageBox("赠送钻石格式不正确");
                return;
            }

            int  diamond = a;
            bool flag    = cbPull.Checked;
            int  userid  = IntParam <= 0 ? CtrlHelper.GetInt(hidUserID, 0) : IntParam;

            //if(diamond <= 0)
            //{
            //    MessageBox("赠送钻石不能小于或等于零");
            //    return;
            //}
            if (string.IsNullOrEmpty(strReason))
            {
                MessageBox("赠送备注不能为空");
                return;
            }
            string             ip  = GameRequest.GetUserIP();
            RecordGrantDiamond rgd = new RecordGrantDiamond
            {
                MasterID    = userExt.UserID,
                UserID      = userid,
                TypeID      = 0,
                AddDiamond  = diamond,
                ClientIP    = ip,
                CollectNote = strReason
            };

            Message msg = FacadeManage.aideTreasureFacade.GrantDiamond(rgd);

            if (msg.Success)
            {
                if (flag)
                {
                    AccountsUmeng umeng = FacadeManage.aideAccountsFacade.GetAccountsUmeng(IntParam);
                    if (!string.IsNullOrEmpty(umeng?.DeviceToken))
                    {
                        string   content = "系统管理员" + userExt.UserName + "已" + (diamond < 0 ? "扣除" : "赠送") + "您" + diamond.ToString() + "钻石";
                        DateTime start   = DateTime.Now.AddMinutes(1);
                        DateTime end     = start.AddHours(5);
                        bool     result  = Umeng.SendMessage(umeng.DeviceType, content, "unicast", start.ToString("yyyy-MM-dd HH:mm:ss"), end.ToString("yyyy-MM-dd HH:mm:ss"), umeng.DeviceToken);
                        if (!result)
                        {
                            MessageBox("赠送成功,但推送消息失败,请前往友盟后台绑定系统后台ip");
                            return;
                        }
                        RecordAccountsUmeng record = new RecordAccountsUmeng
                        {
                            MasterID    = rgd.MasterID,
                            UserID      = rgd.UserID,
                            PushType    = umeng.DeviceType,
                            PushTime    = DateTime.Now,
                            PushIP      = ip,
                            PushContent = content
                        };
                        int rows = FacadeManage.aideRecordFacade.AddRecordAccountsUmeng(record);
                        MessageBox(rows > 0 ? "赠送成功" : "赠送成功,但推送记录写入失败");
                    }
                    else
                    {
                        MessageBox("赠送成功,但推送用户未绑定设备,无法推送");
                    }
                }
                else
                {
                    MessageBox("赠送成功");
                }
            }
            else
            {
                MessageBox("赠送失败");
            }
        }