Ejemplo n.º 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);
            if (cashorderInfo.SUserID == iUserID && cashorderInfo.SStatus == 0 && cashorderInfo.BStatus == 1 && cashorderInfo.IsFeedback == 0)
            {
                cashorderBLL.Feedback(cashorderInfo.OrderID, SafeHelper.GetSafeSqlandHtml(txtReason.Text.Trim()), DateTime.Now);//反馈

                #region 短信通知
                lgk.BLL.SMS   smsBLL   = new lgk.BLL.SMS();
                lgk.Model.SMS smsModel = new lgk.Model.SMS();
                //给卖家发短信通知已付款
                //	SCode --1:出局短信 2:买家点击已付款 3:卖家点击已收款 4:卖家点击未收款
                var user = userBLL.GetModel(cashorderInfo.SUserID);
                smsModel.ToUserID    = cashorderInfo.SUserID;
                smsModel.ToUserCode  = user.UserCode;
                smsModel.ToPhone     = user.PhoneNum;
                smsModel.PublishTime = DateTime.Now;
                smsModel.ValidTime   = DateTime.Now.AddMinutes(5);
                smsModel.SendNum     = 0;
                smsModel.SMSContent  = cashorderInfo.OrderCode;
                smsModel.IsValid     = 1;
                smsModel.IsDeleted   = 0;
                smsModel.SCode       = "4";
                smsModel.TypeID      = 0;
                smsBLL.Add(smsModel);
                #endregion
                MessageBox.ShowBox(this.Page, GetLanguage("FeedbackSuccess"), Library.Enums.ModalTypes.success, "CashOrderList.aspx");//反馈成功
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 发送短信
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string sendSms(string phone, string type)
        {
            bool   flag = false;
            string msg  = "";

            try
            {
                int    itype    = 0;
                string strphone = phone; // context.Request["phone"] ?? "";
                string strtype  = type;  // context.Request["type"] ?? "";
                LogHelper.SaveLog(strphone + "," + strtype, "sendSms");
                lgk.BLL.SMS smsBLL = new lgk.BLL.SMS();

                string regSwitch = ConfigurationManager.AppSettings["SMS_SWITCH"];//注册短信开关
                if (!regSwitch.Equals("Open"))
                {
                    flag = true;
                    msg  = "不需要验证码";
                }
                else
                {
                    if (string.IsNullOrEmpty(strphone))
                    {
                        msg = "手机号码为空";
                    }
                    if (!new RegexR().isPhones(strphone))
                    {
                        msg = "请输入正确的手机号";
                    }
                    else if (string.IsNullOrEmpty(strtype))
                    {
                        msg = "验证码类别为空";
                    }
                    else if (!int.TryParse(strtype, out itype))
                    {
                        msg = "type参数无效";
                    }
                    else if (smsBLL.GetSendCountOfDay(strphone) >= 5) //同号码每日限制:5条
                    {
                        msg = "超出短信发送计数限制";
                    }
                    else if (smsBLL.GetSendCountOfMinute(strphone, 1) >= 1) //同号码每分钟限制:1条
                    {
                        msg = "操作过于频繁,请稍后重试";
                    }
                    else
                    {
                        if (regSwitch.Equals("Open"))
                        {
                            LogHelper.SaveLog("2:" + strphone, "PHONEJS");
                            lgk.Model.SMS model = new lgk.Model.SMS();
                            model.IsDeleted   = 0;
                            model.IsValid     = 0;
                            model.PublishTime = DateTime.Now;
                            model.SCode       = new Library.Common().GetRandom(6);
                            model.ToPhone     = strphone;
                            model.SMSContent  = model.SCode;
                            model.SendNum     = 1;
                            model.ToUserCode  = "";
                            model.ValidTime   = DateTime.Now.AddMinutes(5);
                            model.TypeID      = itype;

                            long isid = smsBLL.Add(model);
                            if (isid > 0)
                            {
                                //msg = "验证码已发送";
                                string strreturn = Library.SMSHelper.SendMessage2(strphone, model.SCode);
                                if (strreturn == "0")
                                {
                                    flag = true;
                                    msg  = "发送成功";
                                }
                                else
                                {
                                    smsBLL.UpdateDelete(isid, -1);
                                    msg = "发送失败";
                                }
                            }
                            else
                            {
                                msg = "验证码发送失败";
                            }
                        }
                        else
                        {
                            msg = "短信接口关闭";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            if (flag == true)
            {
                return(ResultJson(ResultType.success, msg, ""));
            }
            else
            {
                return(ResultJson(ResultType.error, msg, ""));
            }
        }
Ejemplo n.º 3
0
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            //if (!SysTradeIsOpen())
            //{
            //    MessageBox.ShowBox(this.Page,string.Format(GetLanguage("TradingReminder"),getParamVarchar("GoldTradingTime")), Library.Enums.ModalTypes.warning);//请选择投资积分
            //    return;
            //}
            lgk.BLL.SMS   smsBLL   = new lgk.BLL.SMS();
            lgk.Model.SMS smsModel = new lgk.Model.SMS();

            lgk.Model.Cashorder cashorderInfo = cashorderBLL.GetModel(iOrderID);

            if (cashorderInfo.BUserID == iUserID && cashorderInfo.SStatus == 0 && cashorderInfo.BStatus == 0 && iActionID == 1)
            {
                string pic = Request.Form["hiddenupimage"] == null ||
                             Request.Form["hiddenupimage"].ToString() == "" ? "" : Request.Form["hiddenupimage"].ToString();
                if (string.IsNullOrEmpty(pic))
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请上传图片凭证。');window.location.href='CashOrderList.aspx';", true);
                    return;
                }
                cashorderBLL.Update(iUserID, cashorderInfo.OrderID, DateTime.Now, pic, "", 1);//付款

                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);
                cashbuyInfo.IsBuy = 1;//已付款,未发货
                cashbuyBLL.Update(cashbuyInfo);
                #region 短信通知
                //给卖家发短信通知已付款
                //	SCode --1:出局短信 2:买家点击已付款 3:卖家点击已收款 4:卖家点击未收款
                var user = userBLL.GetModel(cashorderInfo.SUserID);
                smsModel.ToUserID    = cashorderInfo.SUserID;
                smsModel.ToUserCode  = user.UserCode;
                smsModel.ToPhone     = user.PhoneNum;
                smsModel.PublishTime = DateTime.Now;
                smsModel.ValidTime   = DateTime.Now.AddMinutes(5);
                smsModel.SendNum     = 0;
                smsModel.SMSContent  = cashorderInfo.OrderCode;
                smsModel.IsValid     = 1;
                smsModel.IsDeleted   = 0;
                smsModel.SCode       = "2";
                smsModel.TypeID      = 0;
                smsBLL.Add(smsModel);
                #endregion
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true);
            }
            else if (cashorderInfo.SUserID == iUserID && cashorderInfo.BStatus == 1 && cashorderInfo.SStatus == 0 && iActionID == 2)
            {
                cashorderBLL.Update(iUserID, cashorderInfo.OrderID, DateTime.Now, "", "", 2);  //确认已付款

                cashorderBLL.Update(cashorderInfo.SUserID, iOrderID, DateTime.Now, "", "", 3); //发货

                lgk.Model.Cashbuy cashbuyInfo = cashbuyBLL.GetModel(cashorderInfo.CashbuyID);
                cashbuyInfo.IsBuy = 2;//完成
                cashbuyBLL.Update(cashbuyInfo);

                lgk.Model.Cashsell CashsellInfo = cashsellBLL.GetModel(cashbuyInfo.CashsellID);
                int buyNum = cashorderBLL.GetOrderBuyNumber(cashbuyInfo.CashsellID);
                if (buyNum == CashsellInfo.Number)
                {
                    CashsellInfo.IsSell = 2;//完成
                    cashsellBLL.Update(CashsellInfo);
                }
                decimal dNumber = cashbuyInfo.Amount;
                //decimal dCharge = CashsellInfo.Charge;//总手续费
                //decimal dMTaxRate = dNumber * getParamAmount("Gold3") / 100;//买家获得手续费
                //decimal dCTaxRate = dNumber * getParamAmount("Gold4") / 100;//公司获得手续费

                //decimal dTNumber = dNumber - dCharge + dMTaxRate;
                decimal dTNumber = dNumber;// + dMTaxRate;
                //  decimal give = dTNumber * getParamAmount("Gold10") / 100; //买入获得系统赠送
                // dTNumber += give; //买入获得系统赠送2018-3-15
                //买家得到的是投资积分 StockMoney
                UpdateAccount("ShopAccount", cashorderInfo.BUserID, dTNumber, 1);//发货给购买者

                //UpdateSystemAccount("MoneyAccount", dCTaxRate, 1);

                ////SetAccount(iUserID, dAccount, "EP币发货!", 1);
                SetAccount(cashorderInfo.BUserID, dTNumber, "金币发货!", cashorderInfo.SUserID, (int)Library.AccountType.购物分, "ShopAccount");

                var user = userBLL.GetModel(cashorderInfo.BUserID);
                if (user.GLmoney <= 0)
                {
                    decimal lessthenRate   = getParamAmount("Gold11");                          //能量值小于等于0时,每次购买交易币扣除
                    decimal shoppingAmount = dTNumber * lessthenRate / 100;
                    UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0);     //交易币
                    UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币
                    SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount");
                    SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值小于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount");
                }
                else
                {
                    decimal greaterthenRate = getParamAmount("Gold10");                         //能量值大于0时,每次购买交易币扣除
                    decimal shoppingAmount  = dTNumber * greaterthenRate / 100;
                    UpdateAccount("ShopAccount", cashorderInfo.BUserID, shoppingAmount, 0);     //交易币
                    UpdateAccount("AllBonusAccount", cashorderInfo.BUserID, shoppingAmount, 1); //购物币
                    SetOutAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "ShopAccount");
                    SetAccount(cashorderInfo.BUserID, shoppingAmount, "能量值大于0,扣除交易币到购物币。", cashorderInfo.BUserID, (int)Library.AccountType.购物分, "AllBonusAccount");
                }
                UpdateGLmoney(cashorderInfo.BUserID, dTNumber, 1); //更新能量值 买方
                UpdateGLmoney(cashorderInfo.SUserID, dTNumber, 0); //更新能量值 卖方

                #region 短信通知
                //给卖家发短信通知已付款
                //	SCode --1:出局短信 2:买家点击已付款 3:卖家点击已收款 4:卖家点击未收款
                // var user = userBLL.GetModel(cashorderInfo.BUserID);
                smsModel.ToUserID    = cashorderInfo.BUserID;
                smsModel.ToUserCode  = user.UserCode;
                smsModel.ToPhone     = user.PhoneNum;
                smsModel.PublishTime = DateTime.Now;
                smsModel.ValidTime   = DateTime.Now.AddMinutes(5);
                smsModel.SendNum     = 0;
                smsModel.SMSContent  = cashorderInfo.OrderCode;
                smsModel.IsValid     = 1;
                smsModel.IsDeleted   = 0;
                smsModel.SCode       = "3";
                smsModel.TypeID      = 0;
                smsBLL.Add(smsModel);
                #endregion

                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Successful") + "');window.location.href='CashOrderList.aspx';", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("OperationFailed") + "');window.location.href='CashOrderList.aspx';", true);
            }
        }