Ejemplo n.º 1
0
        private void ProcessSubmmitAmount(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            MemberInfo    currentMember = MemberProcessor.GetCurrentMember();
            StringBuilder builder       = new StringBuilder();

            builder.Append("{");
            if (currentMember == null)
            {
                builder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"请先登录!\"");
                builder.Append("}");
                context.Response.ContentType = "application/json";
                context.Response.Write(builder.ToString());
            }
            else
            {
                int     modeId     = int.Parse(context.Request["paymentType"]);
                decimal num2       = decimal.Parse(context.Request["Amount"]);
                string  generateId = Globals.GetGenerateId();
                if (num2 > 1000000M)
                {
                    builder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"最大充值金额不大于100万!\"");
                    builder.Append("}");
                    context.Response.ContentType = "application/json";
                    context.Response.Write(builder.ToString());
                }
                else
                {
                    MemberAmountDetailedInfo amountInfo = new MemberAmountDetailedInfo {
                        UserId          = currentMember.UserId,
                        UserName        = currentMember.UserName,
                        PayId           = generateId,
                        TradeAmount     = num2,
                        TradeType       = TradeType.Recharge,
                        TradeTime       = DateTime.Now,
                        State           = 0,
                        AvailableAmount = currentMember.AvailableAmount + num2,
                        Remark          = "余额充值"
                    };
                    if (modeId == 0x58)
                    {
                        amountInfo.TradeWays = TradeWays.WeChatWallet;
                    }
                    else
                    {
                        PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(modeId);
                        if (paymentMode != null)
                        {
                            if (paymentMode.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                            {
                                amountInfo.TradeWays = TradeWays.Alipay;
                            }
                            else if (paymentMode.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
                            {
                                amountInfo.TradeWays = TradeWays.ShengFutong;
                            }
                        }
                    }
                    if (MemberAmountProcessor.CreatAmount(amountInfo))
                    {
                        builder.Append("\"Status\":\"OK\",\"PayIdStatus\":\"" + amountInfo.PayId + "\",");
                        builder.AppendFormat("\"PayId\":\"{0}\"", amountInfo.PayId);
                    }
                    else
                    {
                        builder.Append("\"Status\":\"Error\"");
                        builder.AppendFormat(",\"ErrorMsg\":\"提交充值失败!\"", new object[0]);
                    }
                    builder.Append("}");
                    context.Response.ContentType = "application/json";
                    context.Response.Write(builder.ToString());
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessSubmmitAmount(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            stringBuilder.Append("{");
            if (currentMember == null)
            {
                stringBuilder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"请先登录!\"");
                stringBuilder.Append("}");
                context.Response.ContentType = "application/json";
                context.Response.Write(stringBuilder.ToString());
                return;
            }
            int     num        = int.Parse(context.Request["paymentType"]);
            decimal num2       = decimal.Parse(context.Request["Amount"]);
            string  generateId = Globals.GetGenerateId();

            if (num2 > 1000000m)
            {
                stringBuilder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"最大充值金额不大于100万!\"");
                stringBuilder.Append("}");
                context.Response.ContentType = "application/json";
                context.Response.Write(stringBuilder.ToString());
                return;
            }
            MemberAmountDetailedInfo memberAmountDetailedInfo = new MemberAmountDetailedInfo();

            memberAmountDetailedInfo.UserId          = currentMember.UserId;
            memberAmountDetailedInfo.UserName        = currentMember.UserName;
            memberAmountDetailedInfo.PayId           = generateId;
            memberAmountDetailedInfo.TradeAmount     = num2;
            memberAmountDetailedInfo.TradeType       = TradeType.Recharge;
            memberAmountDetailedInfo.TradeTime       = System.DateTime.Now;
            memberAmountDetailedInfo.State           = 0;
            memberAmountDetailedInfo.AvailableAmount = currentMember.AvailableAmount + num2;
            memberAmountDetailedInfo.Remark          = "余额充值";
            if (num == 88)
            {
                memberAmountDetailedInfo.TradeWays = TradeWays.WeChatWallet;
            }
            else
            {
                PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(num);
                if (paymentMode != null)
                {
                    if (paymentMode.Gateway == "hishop.plugins.payment.ws_wappay.wswappayrequest")
                    {
                        memberAmountDetailedInfo.TradeWays = TradeWays.Alipay;
                    }
                    else if (paymentMode.Gateway == "Hishop.Plugins.Payment.ShengPayMobile.ShengPayMobileRequest")
                    {
                        memberAmountDetailedInfo.TradeWays = TradeWays.ShengFutong;
                    }
                }
            }
            if (MemberAmountProcessor.CreatAmount(memberAmountDetailedInfo))
            {
                stringBuilder.Append("\"Status\":\"OK\",\"PayIdStatus\":\"" + memberAmountDetailedInfo.PayId + "\",");
                stringBuilder.AppendFormat("\"PayId\":\"{0}\"", memberAmountDetailedInfo.PayId);
            }
            else
            {
                stringBuilder.Append("\"Status\":\"Error\"");
                stringBuilder.AppendFormat(",\"ErrorMsg\":\"提交充值失败!\"", new object[0]);
            }
            stringBuilder.Append("}");
            context.Response.ContentType = "application/json";
            context.Response.Write(stringBuilder.ToString());
        }