Пример #1
0
        public ActionResult Return(string orderIds)
        {
            string empty = string.Empty;

            try
            {
                char[]             chrArray = new char[] { ',' };
                IEnumerable <long> num      =
                    from item in orderIds.Split(chrArray)
                    select long.Parse(item);

                List <long> list = (
                    from item in ServiceHelper.Create <IOrderService>().GetOrders(num)
                    select item.Id).ToList();
                ViewBag.OrderIds = string.Join <long>(",", list);
                IOrderService orderService = ServiceHelper.Create <IOrderService>();
                DateTime?     nullable     = DateTime.Now;

                orderService.PayPalSucceed(list, nullable.Value, null, list.FirstOrDefault());
                string str = CacheKeyCollection.PaymentState(string.Join <long>(",", list));
                Cache.Insert(str, true, 15);
                Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
                string            str1             = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
                IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(list.AsEnumerable <long>()))
                {
                    Log.Info(string.Concat("ShopID = ", order.ShopId));
                    ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                    if (byShopId != null)
                    {
                        Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                        Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                        if (byShopId.GrantPrice > order.OrderTotalAmount)
                        {
                            continue;
                        }
                        object[] objArray = new object[] { byShopId.Id, order.UserId, order.Id, str1 };
                        Log.Info(string.Format("{0} , {1} , {2} , {3} ", objArray));
                        long num1 = shopBonusService.GenerateBonusDetail(byShopId, order.UserId, order.Id, str1);
                        Log.Info(string.Concat("生成红包组,红包Grantid = ", num1));
                        nums.Add(num1, byShopId);
                    }
                }
            }
            catch (Exception exception)
            {
                empty = exception.Message;
            }
            ViewBag.Error = empty;
            ViewBag.Logo  = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings().Logo;
            return(View());
        }
Пример #2
0
        public ActionResult Return(string id)
        {
            id = DecodePaymentId(id);
            string empty = string.Empty;

            try
            {
                Plugin <IPaymentPlugin> plugin      = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                PaymentInfo             paymentInfo = plugin.Biz.ProcessReturn(base.HttpContext.Request);
                DateTime?   tradeTime = paymentInfo.TradeTime;
                long        num       = paymentInfo.OrderIds.FirstOrDefault();
                List <long> list      = (
                    from item in ServiceHelper.Create <IOrderService>().GetOrderPay(num)
                    select item.OrderId).ToList();
                ViewBag.OrderIds = string.Join <long>(",", list);
                IOrderService orderService = ServiceHelper.Create <IOrderService>();
                DateTime?     nullable     = paymentInfo.TradeTime;
                orderService.PaySucceed(list, id, nullable.Value, paymentInfo.TradNo, num);
                string str = CacheKeyCollection.PaymentState(string.Join <long>(",", list));
                Cache.Insert(str, true, 15);
                Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
                string            str1             = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
                IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(list.AsEnumerable <long>()))
                {
                    Log.Info(string.Concat("ShopID = ", order.ShopId));
                    ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                    Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                    Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                    if (byShopId.GrantPrice > order.OrderTotalAmount)
                    {
                        continue;
                    }
                    object[] objArray = new object[] { byShopId.Id, order.UserId, order.Id, str1 };
                    Log.Info(string.Format("{0} , {1} , {2} , {3} ", objArray));
                    long num1 = shopBonusService.GenerateBonusDetail(byShopId, order.UserId, order.Id, str1);
                    Log.Info(string.Concat("生成红包组,红包Grantid = ", num1));
                    nums.Add(num1, byShopId);
                }
            }
            catch (Exception exception)
            {
                empty = exception.Message;
            }
            ViewBag.Error = empty;
            ViewBag.Logo  = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings().Logo;
            return(View());
        }
Пример #3
0
        public JsonResult PayByCapital(string orderIds, string pwd, string payid)
        {
            if (ServiceHelper.Create <IMemberCapitalService>().GetMemberInfoByPayPwd(base.CurrentUser.Id, pwd) == null)
            {
                throw new HimallException("Payment Password is incorrect");
            }
            char[]             chrArray = new char[] { ',' };
            IEnumerable <long> nums     =
                from e in orderIds.Split(chrArray)
                select long.Parse(e);

            ServiceHelper.Create <IOrderService>().PayCapital(nums, null, long.Parse(payid));
            Dictionary <long, ShopBonusInfo> nums1 = new Dictionary <long, ShopBonusInfo>();
            string            str = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
            IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();

            foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(nums))
            {
                Log.Info(string.Concat("ShopID = ", order.ShopId));
                ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                if (byShopId == null)
                {
                    continue;
                }
                Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                if (byShopId.GrantPrice > order.OrderTotalAmount)
                {
                    continue;
                }
                long num = shopBonusService.GenerateBonusDetail(byShopId, base.CurrentUser.Id, order.Id, str);
                Log.Info(string.Concat("生成红包组,红包Grantid = ", num));
                nums1.Add(num, byShopId);
            }
            return(Json(new { success = true, msg = "Payment Success" }));
        }
Пример #4
0
        public ActionResult PaymentToOrders(string ids)
        {
            Log.Info(string.Concat("ids = ", ids));
            Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
            string str = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");

            if (!string.IsNullOrEmpty(ids))
            {
                string[]    strArrays  = ids.Split(new char[] { ',' });
                List <long> nums1      = new List <long>();
                string[]    strArrays1 = strArrays;
                for (int i = 0; i < strArrays1.Length; i++)
                {
                    nums1.Add(long.Parse(strArrays1[i]));
                }
                IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(nums1.AsEnumerable <long>()))
                {
                    Log.Info(string.Concat("ShopID = ", order.ShopId));
                    ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                    if (byShopId == null)
                    {
                        continue;
                    }
                    Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                    Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                    if (byShopId.GrantPrice > order.OrderTotalAmount)
                    {
                        continue;
                    }
                    long num = shopBonusService.GenerateBonusDetail(byShopId, base.CurrentUser.Id, order.Id, str);
                    Log.Info(string.Concat("生成红包组,红包Grantid = ", num));
                    nums.Add(num, byShopId);
                }
            }
            ViewBag.Path          = str;
            ViewBag.BonusGrantIds = nums;
            ViewBag.BaseAddress   = string.Concat("http://", base.Request.Url.Host.ToString());
            SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings();
            IWXApiService    wXApiService = ServiceHelper.Create <IWXApiService>();
            string           ticket       = wXApiService.GetTicket(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret);
            JSSDKHelper      jSSDKHelper  = new JSSDKHelper();
            string           timestamp    = JSSDKHelper.GetTimestamp();
            string           noncestr     = JSSDKHelper.GetNoncestr();
            string           signature    = jSSDKHelper.GetSignature(ticket, noncestr, timestamp, base.Request.Url.AbsoluteUri);

            ViewBag.Timestamp = timestamp;
            ViewBag.NonceStr  = noncestr;
            ViewBag.Signature = signature;
            ViewBag.AppId     = siteSettings.WeixinAppId;
            IQueryable <OrderInfo> topOrders  = ServiceHelper.Create <IOrderService>().GetTopOrders(2147483647, base.CurrentUser.Id);
            OrderQuery             orderQuery = new OrderQuery()
            {
                Status    = new OrderInfo.OrderOperateStatus?(OrderInfo.OrderOperateStatus.Finish),
                UserId    = new long?(base.CurrentUser.Id),
                PageSize  = 2147483647,
                PageNo    = 1,
                Commented = new bool?(false)
            };
            OrderQuery orderQuery1 = orderQuery;

            ViewBag.WaitingForComments = ServiceHelper.Create <IOrderService>().GetOrders <OrderInfo>(orderQuery1, null).Total;
            ServiceHelper.Create <IMemberService>().GetMember(base.CurrentUser.Id);
            ViewBag.AllOrders = topOrders.Count();
            base.ViewBag.WaitingForRecieve = topOrders.Count((OrderInfo item) => (int)item.OrderStatus == 3);
            base.ViewBag.WaitingForPay     = topOrders.Count((OrderInfo item) => (int)item.OrderStatus == 1);
            return(View("~/Areas/Mobile/Templates/Default/Views/Member/Orders.cshtml"));
        }
 /// <summary>
 /// 订单支付完成时,生成红包详情
 /// </summary>
 public static long GenerateBonusDetail(ShopBonusInfo model, long orderid, string receiveurl)
 {
     return(_iShopBonusService.GenerateBonusDetail(model, orderid, receiveurl));
 }
Пример #6
0
        public ContentResult PayNotify_Post(string id)
        {
            id = DecodePaymentId(id);
            string empty = string.Empty;
            string str   = string.Empty;

            try
            {
                Plugin <IPaymentPlugin> plugin      = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                PaymentInfo             paymentInfo = plugin.Biz.ProcessNotify(base.HttpContext.Request);
                DateTime?   tradeTime = paymentInfo.TradeTime;
                long        num       = paymentInfo.OrderIds.FirstOrDefault();
                List <long> list      = (
                    from item in ServiceHelper.Create <IOrderService>().GetOrderPay(num)
                    select item.OrderId).ToList();
                try
                {
                    IOrderService orderService = ServiceHelper.Create <IOrderService>();
                    DateTime?     nullable     = paymentInfo.TradeTime;
                    orderService.PaySucceed(list, id, nullable.Value, paymentInfo.TradNo, num);
                    str = plugin.Biz.ConfirmPayResult();
                    string str1 = CacheKeyCollection.PaymentState(string.Join <long>(",", list));
                    Cache.Insert(str1, true, 15);
                    Dictionary <long, ShopBonusInfo> nums = new Dictionary <long, ShopBonusInfo>();
                    string            str2             = string.Concat("http://", base.Request.Url.Host.ToString(), "/m-weixin/shopbonus/index/");
                    IShopBonusService shopBonusService = ServiceHelper.Create <IShopBonusService>();
                    foreach (OrderInfo order in ServiceHelper.Create <IOrderService>().GetOrders(list.AsEnumerable <long>()))
                    {
                        Log.Info(string.Concat("ShopID = ", order.ShopId));
                        ShopBonusInfo byShopId = shopBonusService.GetByShopId(order.ShopId);
                        Log.Info(string.Concat("商家活动价格:", byShopId.GrantPrice));
                        Log.Info(string.Concat("买家支付价格:", order.OrderTotalAmount));
                        if (byShopId.GrantPrice > order.OrderTotalAmount)
                        {
                            continue;
                        }
                        object[] objArray = new object[] { byShopId.Id, order.UserId, order.Id, str2 };
                        Log.Info(string.Format("{0} , {1} , {2} , {3} ", objArray));
                        long num1 = shopBonusService.GenerateBonusDetail(byShopId, order.UserId, order.Id, str2);
                        Log.Info(string.Concat("生成红包组,红包Grantid = ", num1));
                        nums.Add(num1, byShopId);
                    }
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    string    str3      = string.Concat(id, " ", num.ToString());
                    if (paymentInfo.TradeTime.HasValue)
                    {
                        DateTime value = paymentInfo.TradeTime.Value;
                        str3 = string.Concat(str3, " TradeTime:", value.ToString());
                    }
                    str3 = string.Concat(str3, " TradNo:", paymentInfo.TradNo);
                    Log.Error(str3, exception);
                }
            }
            catch (Exception exception3)
            {
                Exception exception2 = exception3;
                string    message    = exception2.Message;
                Log.Error("PayNotify_Post", exception2);
            }
            return(base.Content(str));
        }