예제 #1
0
        // GET: Web/UserInfo
        public ActionResult Index()
        {
            var model          = MemberApplication.GetMembers(CurrentUser.Id);
            var messagePlugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            var sms            = PluginsManagement.GetPlugins <ISMSPlugin>();
            var smsInfo        = sms.Select(item => new PluginsInfo
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(_iMessageService.GetDestination(CurrentUser.Id, item.PluginInfo.PluginId, Entities.MemberContactInfo.UserTypes.General))
            }).FirstOrDefault();
            var email     = PluginsManagement.GetPlugins <IEmailPlugin>();
            var emailInfo = email.Select(item => new PluginsInfo
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(_iMessageService.GetDestination(CurrentUser.Id, item.PluginInfo.PluginId, Entities.MemberContactInfo.UserTypes.General))
            }).FirstOrDefault();


            ViewBag.BindSMS   = smsInfo;
            ViewBag.BindEmail = emailInfo;
            ViewBag.Keyword   = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords  = SiteSettings.HotKeyWords;
            return(View(model));
        }
예제 #2
0
        public ActionResult Edit(string pluginId)
        {
            IEnumerable <object> objs = PluginsManagement.GetPlugins <IMessagePlugin>().Select <Plugin <IMessagePlugin>, object>((Plugin <IMessagePlugin> item) => {
                dynamic expandoObjects  = new ExpandoObject();
                expandoObjects.name     = item.PluginInfo.DisplayName;
                expandoObjects.pluginId = item.PluginInfo.PluginId;
                expandoObjects.enable   = item.PluginInfo.Enable;
                expandoObjects.status   = item.Biz.GetAllStatus();
                return(expandoObjects);
            });

            ViewBag.messagePlugins = objs;
            ViewBag.Id             = pluginId;
            Plugin <IMessagePlugin> plugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.Name      = plugin.PluginInfo.DisplayName;
            ViewBag.ShortName = plugin.Biz.ShortName;
            FormData formData = plugin.Biz.GetFormData();

            //Plugin<ISMSPlugin> plugin1 = PluginsManagement.GetPlugins<ISMSPlugin>().FirstOrDefault<Plugin<ISMSPlugin>>();
            //ViewBag.ShowSMS = false;
            //ViewBag.ShowBuy = false;
            //if (plugin1 = null && pluginId == plugin1.PluginInfo.PluginId)
            //{
            //    ViewBag.ShowSMS = true;
            //    ViewBag.LoginLink = plugin1.Biz.GetLoginLink();
            //    ViewBag.BuyLink = plugin1.Biz.GetBuyLink();
            //    if (plugin1.Biz.IsSettingsValid)
            //    {
            //        ViewBag.Amount = plugin1.Biz.GetSMSAmount();
            //        ViewBag.ShowBuy = true;
            //    }
            //}
            return(View(formData));
        }
예제 #3
0
        public ActionResult EditWXMessage()
        {
            var messagePlugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            var data           = messagePlugins.Select(item =>
            {
                dynamic model  = new ExpandoObject();
                model.name     = item.PluginInfo.DisplayName;
                model.pluginId = item.PluginInfo.PluginId;
                model.enable   = item.PluginInfo.Enable;
                model.status   = item.Biz.GetAllStatus();
                return(model);
            }
                                                       );

            var siteSetting = SiteSettingApplication.SiteSettings;

            ViewBag.WeixinAppletId     = siteSetting.WeixinAppletId;
            ViewBag.WeixinAppletSecret = siteSetting.WeixinAppletSecret;

            ViewBag.messagePlugins = data;

            List <Entities.WeiXinMsgTemplateInfo> wxtempllist = new List <Entities.WeiXinMsgTemplateInfo>();

            wxtempllist = _iWXMsgTemplateService.GetWeiXinMsgTemplateListByApplet();
            return(View(wxtempllist));
        }
예제 #4
0
        public void SendMessageOnFindPassWord(long userId, Core.Plugins.Message.MessageUserInfo info)
        {
            var message = PluginsManagement.GetPlugins <IMessagePlugin>().ToList();

            foreach (var msg in message)
            {
                if (msg.Biz.GetStatus(MessageTypeEnum.FindPassWord) == StatusEnum.Open)
                {
                    string destination = GetDestination(userId, msg.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General);
                    if (!msg.Biz.CheckDestination(destination))
                    {
                        throw new HimallException(msg.Biz.ShortName + "错误");
                    }
                    var content = msg.Biz.SendMessageOnFindPassWord(destination, info);
                    if (msg.Biz.EnableLog)
                    {
                        Context.MessageLog.Add(new MessageLog()
                        {
                            SendTime = DateTime.Now, ShopId = 0, MessageContent = content, TypeId = "短信"
                        });
                        Context.SaveChanges();
                    }
                }
            }
        }
예제 #5
0
 public void SendMessageOnOrderCreate(long userId, MessageOrderInfo info)
 {
     foreach (Plugin <IMessagePlugin> list in PluginsManagement.GetPlugins <IMessagePlugin>().ToList <Plugin <IMessagePlugin> >())
     {
         if (list.Biz.GetStatus(MessageTypeEnum.OrderCreated) != StatusEnum.Open)
         {
             continue;
         }
         string destination = GetDestination(userId, list.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General);
         if (!list.Biz.CheckDestination(destination))
         {
             throw new HimallException(string.Concat(list.Biz.ShortName, "错误"));
         }
         string str = list.Biz.SendMessageOnOrderCreate(destination, info);
         if (!list.Biz.EnableLog)
         {
             continue;
         }
         DbSet <MessageLog> messageLog  = context.MessageLog;
         MessageLog         messageLog1 = new MessageLog()
         {
             SendTime       = new DateTime?(DateTime.Now),
             ShopId         = new long?(info.ShopId),
             MessageContent = str,
             TypeId         = "短信"
         };
         messageLog.Add(messageLog1);
         context.SaveChanges();
     }
 }
예제 #6
0
        // GET: Admin/SiteSetting
        public ActionResult Edit()
        {
            // var siteSetting = _iSiteSettingService.GetSiteSettings();

            //  var settings = siteSetting.Map<SiteSettingModel>();


            var settings = _mapper.Map <SiteSettings, SiteSettingModel>(SiteSettingApplication.SiteSettings);

            //  var  settings = _mapper.Map<SiteSettings>(Site)

            settings.Logo       = Core.MallIO.GetImagePath(settings.Logo);
            settings.MemberLogo = Core.MallIO.GetImagePath(settings.MemberLogo);
            settings.PCLoginPic = Core.MallIO.GetImagePath(settings.PCLoginPic);
            settings.QRCode     = Core.MallIO.GetImagePath(settings.QRCode);
            settings.WXLogo     = Core.MallIO.GetImagePath(settings.WXLogo);

            #region 强制绑定手机参数
            var sms = PluginsManagement.GetPlugins <ISMSPlugin>().FirstOrDefault();
            if (sms != null)
            {
                ViewBag.ShowSMS   = true;
                ViewBag.LoginLink = sms.Biz.GetLoginLink();
                ViewBag.BuyLink   = sms.Biz.GetBuyLink();
            }
            #endregion
            return(View(settings));
        }
예제 #7
0
        public ActionResult Index()
        {
            UserMemberInfo currentUser = base.CurrentUser;

            PluginsManagement.GetPlugins <IMessagePlugin>();
            IEnumerable <Plugin <ISMSPlugin> > plugins = PluginsManagement.GetPlugins <ISMSPlugin>();
            PluginsInfo pluginsInfo = (
                from item in plugins
                select new PluginsInfo()
            {
                ShortName = item.Biz.ShortName,
                PluginId = item.PluginInfo.PluginId,
                Enable = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind = !string.IsNullOrEmpty(ServiceHelper.Create <IMessageService>().GetDestination(base.CurrentUser.Id, item.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General))
            }).FirstOrDefault();
            IEnumerable <Plugin <IEmailPlugin> > plugins1 = PluginsManagement.GetPlugins <IEmailPlugin>();
            PluginsInfo pluginsInfo1 = (
                from item in plugins1
                select new PluginsInfo()
            {
                ShortName = item.Biz.ShortName,
                PluginId = item.PluginInfo.PluginId,
                Enable = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind = !string.IsNullOrEmpty(ServiceHelper.Create <IMessageService>().GetDestination(base.CurrentUser.Id, item.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General))
            }).FirstOrDefault();

            ViewBag.BindSMS   = pluginsInfo;
            ViewBag.BindEmail = pluginsInfo1;
            return(View(base.CurrentUser));
        }
예제 #8
0
        public JsonResult PaymentList(decimal balance)
        {
            string  str;
            decimal needPayCashDepositByShopId = ServiceHelper.Create <ICashDepositsService>().GetNeedPayCashDepositByShopId(base.CurrentSellerManager.ShopId);

            if (balance < needPayCashDepositByShopId)
            {
                throw new HimallException("缴纳保证金必须大于应缴保证金");
            }
            string scheme = base.Request.Url.Scheme;
            string host   = base.HttpContext.Request.Url.Host;

            if (base.HttpContext.Request.Url.Port == 80)
            {
                str = "";
            }
            else
            {
                int port = base.HttpContext.Request.Url.Port;
                str = string.Concat(":", port.ToString());
            }
            string str1 = string.Concat(scheme, "://", host, str);
            string str2 = string.Concat(str1, "/SellerAdmin/CashDeposit/Return/{0}?balance={1}");
            string str3 = string.Concat(str1, "/pay/CashNotify/{0}?str={1}");
            IEnumerable <Plugin <IPaymentPlugin> > plugins =
                from item in PluginsManagement.GetPlugins <IPaymentPlugin>(true)
                where item.Biz.SupportPlatforms.Contains <PlatformType>(PlatformType.PC)
                select item;
            string str4   = DateTime.Now.ToString("yyyyMMddmmss");
            long   shopId = base.CurrentSellerManager.ShopId;
            string str5   = string.Concat(str4, shopId.ToString());
            IEnumerable <PaymentModel> paymentModels = plugins.Select <Plugin <IPaymentPlugin>, PaymentModel>((Plugin <IPaymentPlugin> item) => {
                string empty = string.Empty;
                try
                {
                    empty = item.Biz.GetRequestUrl(string.Format(str2, EncodePaymentId(item.PluginInfo.PluginId), balance), string.Format(str3, EncodePaymentId(item.PluginInfo.PluginId), string.Concat(new object[] { balance, "-", CurrentSellerManager.UserName, "-", CurrentSellerManager.ShopId })), str5, balance, "保证金充值", null);
                }
                catch (Exception exception)
                {
                    Log.Error("支付页面加载支付插件出错", exception);
                }
                return(new PaymentModel()
                {
                    Logo = string.Concat("/Plugins/Payment/", item.PluginInfo.ClassFullName.Split(new char[] { ',' })[1], "/", item.Biz.Logo),
                    RequestUrl = empty,
                    UrlType = item.Biz.RequestUrlType,
                    Id = item.PluginInfo.PluginId
                });
            });

            paymentModels = paymentModels.Where((PaymentModel item) => {
                if (string.IsNullOrEmpty(item.RequestUrl))
                {
                    return(false);
                }
                return(item.Id != "Himall.Plugin.Payment.WeiXinPay");
            });
            return(Json(paymentModels));
        }
예제 #9
0
        public JsonResult PaymentList(decimal balance)
        {
            string str3;
            string scheme = base.Request.Url.Scheme;
            string host   = base.HttpContext.Request.Url.Host;

            if (base.HttpContext.Request.Url.Port == 80)
            {
                str3 = "";
            }
            else
            {
                int port = base.HttpContext.Request.Url.Port;
                str3 = string.Concat(":", port.ToString());
            }
            string str4 = string.Concat(scheme, "://", host, str3);
            string str5 = string.Concat(str4, "/pay/CapitalChargeReturn/{0}");
            string str6 = string.Concat(str4, "/pay/CapitalChargeNotify/{0}");
            IEnumerable <Plugin <IPaymentPlugin> > plugins =
                from item in PluginsManagement.GetPlugins <IPaymentPlugin>(true)
                where item.Biz.SupportPlatforms.Contains <PlatformType>(PlatformType.PC)
                select item;
            long   num  = ServiceHelper.Create <IMemberCapitalService>().CreateCode(CapitalDetailInfo.CapitalDetailType.ChargeAmount);
            string str7 = num.ToString();
            IEnumerable <PaymentModel> paymentModels = plugins.Select <Plugin <IPaymentPlugin>, PaymentModel>((Plugin <IPaymentPlugin> item) =>
            {
                string empty = string.Empty;
                try
                {
                    IPaymentPlugin biz  = item.Biz;
                    string str          = str5;
                    string[] strArrays  = new string[] { EncodePaymentId(item.PluginInfo.PluginId), "-", balance.ToString(), "-", null };
                    strArrays[4]        = CurrentUser.Id.ToString();
                    string str1         = string.Format(str, string.Concat(strArrays));
                    string str2         = str6;
                    string[] strArrays1 = new string[] { EncodePaymentId(item.PluginInfo.PluginId), "-", balance.ToString(), "-", null };
                    strArrays1[4]       = CurrentUser.Id.ToString();
                    empty = biz.GetRequestUrl(str1, string.Format(str2, string.Concat(strArrays1)), str7, balance, "预付款充值", null);
                }
                catch (Exception exception)
                {
                    Log.Error("支付页面加载支付插件出错", exception);
                }
                return(new PaymentModel()
                {
                    Logo = string.Concat("/Plugins/Payment/", item.PluginInfo.ClassFullName.Split(new char[] { ',' })[1], "/", item.Biz.Logo),
                    RequestUrl = empty,
                    UrlType = item.Biz.RequestUrlType,
                    Id = item.PluginInfo.PluginId
                });
            });

            paymentModels =
                from item in paymentModels
                where !string.IsNullOrEmpty(item.RequestUrl)
                select item;

            return(Json(paymentModels));
        }
예제 #10
0
        public ActionResult ManageShip()
        {
            IEnumerable <PluginInfo> plugins =
                from t in PluginsManagement.GetPlugins <IPaymentPlugin>()
                select t.PluginInfo;

            return(View(plugins));
        }
예제 #11
0
        public string getname()
        {
            var testplugins = PluginsManagement.GetPlugins <ITestPlugin>(true);

            var testplugin = testplugins.FirstOrDefault(d => d.PluginInfo.PluginId == "plugins.test");

            return(testplugin.Biz.getname());
        }
예제 #12
0
        public ActionResult Management()
        {
            IEnumerable <object> objs = PluginsManagement.GetPlugins <IOAuthPlugin>().Select <Plugin <IOAuthPlugin>, object>((Plugin <IOAuthPlugin> item) => {
                dynamic expandoObjects  = new ExpandoObject();
                expandoObjects.name     = item.PluginInfo.DisplayName;
                expandoObjects.pluginId = item.PluginInfo.PluginId;
                expandoObjects.enable   = item.PluginInfo.Enable;
                return(expandoObjects);
            });

            return(View(objs));
        }
예제 #13
0
        public ActionResult AccountSafety()
        {
            MemberAccountSafety memberAccountSafety = new MemberAccountSafety()
            {
                AccountSafetyLevel = 1
            };
            string         cointype   = System.Configuration.ConfigurationManager.AppSettings["CoinType"].ToString();
            Finance_Wallet walletInfo = ServiceHelper.Create <IFinance_WalletService>().GetWalletInfo(base.CurrentUser.Id, base.CurrentUser.UserType, int.Parse(cointype));

            if (walletInfo != null && walletInfo.Wallet_PayPassword != null)
            {
                memberAccountSafety.PayPassword = true;
                MemberAccountSafety accountSafetyLevel = memberAccountSafety;
                accountSafetyLevel.AccountSafetyLevel = accountSafetyLevel.AccountSafetyLevel + 1;
            }
            IEnumerable <Plugin <IMessagePlugin> > plugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            IMessageService           create      = Instance <IMessageService> .Create;
            IEnumerable <PluginsInfo> pluginsInfo =
                from item in plugins
                select new PluginsInfo()
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(create.GetDestination(CurrentUser.Id, item.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General))
            };

            foreach (PluginsInfo pluginsInfo1 in pluginsInfo)
            {
                if (pluginsInfo1.PluginId.IndexOf("SMS") <= 0)
                {
                    if (!pluginsInfo1.IsBind)
                    {
                        continue;
                    }
                    memberAccountSafety.BindEmail = true;
                    MemberAccountSafety accountSafetyLevel1 = memberAccountSafety;
                    accountSafetyLevel1.AccountSafetyLevel = accountSafetyLevel1.AccountSafetyLevel + 1;
                }
                else
                {
                    if (!pluginsInfo1.IsBind)
                    {
                        continue;
                    }
                    memberAccountSafety.BindPhone = true;
                    MemberAccountSafety memberAccountSafety1 = memberAccountSafety;
                    memberAccountSafety1.AccountSafetyLevel = memberAccountSafety1.AccountSafetyLevel + 1;
                }
            }
            return(View(memberAccountSafety));
        }
예제 #14
0
        public ActionResult AccountSafety()
        {
            MemberAccountSafety memberAccountSafety = new MemberAccountSafety()
            {
                AccountSafetyLevel = 1
            };

            if (base.CurrentUser.PayPwd != null)
            {
                memberAccountSafety.PayPassword = true;
                MemberAccountSafety accountSafetyLevel = memberAccountSafety;
                accountSafetyLevel.AccountSafetyLevel = accountSafetyLevel.AccountSafetyLevel + 1;
            }
            IEnumerable <Plugin <IMessagePlugin> > plugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            IMessageService           create      = Instance <IMessageService> .Create;
            IEnumerable <PluginsInfo> pluginsInfo =
                from item in plugins
                select new PluginsInfo()
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(create.GetDestination(CurrentUser.Id, item.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General))
            };

            foreach (PluginsInfo pluginsInfo1 in pluginsInfo)
            {
                if (pluginsInfo1.PluginId.IndexOf("SMS") <= 0)
                {
                    if (!pluginsInfo1.IsBind)
                    {
                        continue;
                    }
                    memberAccountSafety.BindEmail = true;
                    MemberAccountSafety accountSafetyLevel1 = memberAccountSafety;
                    accountSafetyLevel1.AccountSafetyLevel = accountSafetyLevel1.AccountSafetyLevel + 1;
                }
                else
                {
                    if (!pluginsInfo1.IsBind)
                    {
                        continue;
                    }
                    memberAccountSafety.BindPhone = true;
                    MemberAccountSafety memberAccountSafety1 = memberAccountSafety;
                    memberAccountSafety1.AccountSafetyLevel = memberAccountSafety1.AccountSafetyLevel + 1;
                }
            }
            return(View(memberAccountSafety));
        }
예제 #15
0
        /// <summary>
        /// 调用第三方支付
        /// </summary>
        /// <param name="type"></param>
        /// <param name="account"></param>
        /// <param name="amount"></param>
        /// <param name="desc"></param>
        /// <param name="no"></param>
        /// <returns></returns>
        private static PaymentInfo Payment(DistributionWithdrawType type, string account, decimal amount, string desc, string no, string withdrawName = "")
        {
            Plugin <IPaymentPlugin> plugin = null;
            /// 支付宝真实姓名验证逻辑
            bool isCheckName = false;

            switch (type)
            {
            case DistributionWithdrawType.Alipay:
                plugin      = PluginsManagement.GetPlugins <IPaymentPlugin>(true).FirstOrDefault(e => e.PluginInfo.PluginId == "Mall.Plugin.Payment.Alipay");
                isCheckName = true;
                break;

            case DistributionWithdrawType.WeChat:
                plugin = PluginsManagement.GetPlugins <IPaymentPlugin>(true).FirstOrDefault(e => e.PluginInfo.PluginId.ToLower().Contains("weixin"));
                break;

            default:
                throw new MallException("不支持的支付类型");
            }
            if (plugin == null)
            {
                throw new MallException("未找到支付插件");
            }

            var pay = new EnterprisePayPara()
            {
                amount       = amount,
                openid       = account,
                out_trade_no = no,
                check_name   = isCheckName,
                re_user_name = withdrawName,
                desc         = desc
            };

            try
            {
                return(plugin.Biz.EnterprisePay(pay));
            }
            catch (PluginException pex)
            {
                //插件异常,直接返回错误信息
                Log.Error("调用付款接口异常:" + pex.Message);
                throw new MallException("调用企业付款接口异常:" + pex.Message);
            }
            catch (Exception ex)
            {
                Log.Error("付款异常:" + ex.Message);
                throw new MallException("企业付款异常:" + ex.Message);
            }
        }
예제 #16
0
        public ActionResult PhoneGroupMessage()
        {
            var pageModel = _iMemberLabelService.GetMemberLabelList(new LabelQuery()
            {
            });
            var sms = PluginsManagement.GetPlugins <ISMSPlugin>().FirstOrDefault();

            if (sms != null && sms.PluginInfo.PluginId == "Himall.Plugin.Message.SMS")
            {
                ViewBag.LoginLink = sms.Biz.GetLoginLink();
            }
            ViewBag.LabelInfos = pageModel.Models.ToList();
            return(View());
        }
예제 #17
0
        // GET: Admin/Payment
        public ActionResult Management()
        {
            var paymentPlugins = PluginsManagement.GetPlugins <IPaymentPlugin>();
            var data           = paymentPlugins.OrderByDescending(d => d.PluginInfo.PluginId).Select(item =>
            {
                dynamic model  = new ExpandoObject();
                model.name     = item.PluginInfo.DisplayName;
                model.pluginId = item.PluginInfo.PluginId;
                model.enable   = item.PluginInfo.Enable;
                return(model);
            }
                                                                                                     );

            ViewBag.IsReceivingAddress = _iPaymentConfigService.IsEnable();
            return(View(data));
        }
예제 #18
0
        // GET: Admin/OAuth
        public ActionResult Management()
        {
            var paymentPlugins = PluginsManagement.GetPlugins <IOAuthPlugin>();

            var data = paymentPlugins.Select(item =>
            {
                dynamic model  = new ExpandoObject();
                model.name     = item.PluginInfo.DisplayName;
                model.pluginId = item.PluginInfo.PluginId;
                model.enable   = item.PluginInfo.Enable;
                return(model);
            }
                                             );

            return(View(data));
        }
예제 #19
0
        public ActionResult Edit(string pluginId)
        {
            if (pluginId == wxtmppluginsid)
            {
                return(RedirectToAction("editwxtm"));
            }
            var messagePlugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            var data           = messagePlugins.Select(item =>
            {
                dynamic model  = new ExpandoObject();
                model.name     = item.PluginInfo.DisplayName;
                model.pluginId = item.PluginInfo.PluginId;
                model.enable   = item.PluginInfo.Enable;
                model.status   = item.Biz.GetAllStatus();
                return(model);
            }
                                                       );

            ViewBag.messagePlugins = data;
            ViewBag.Id             = pluginId;
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.Name      = messagePlugin.PluginInfo.DisplayName;
            ViewBag.ShortName = messagePlugin.Biz.ShortName;
            var formData = messagePlugin.Biz.GetFormData();
            var sms      = PluginsManagement.GetPlugins <ISMSPlugin>().FirstOrDefault();

            ViewBag.ShowSMS = false;
            ViewBag.ShowBuy = false;
            if (sms != null && pluginId == sms.PluginInfo.PluginId)
            {
                ViewBag.ShowSMS   = true;
                ViewBag.LoginLink = sms.Biz.GetLoginLink();
                ViewBag.BuyLink   = sms.Biz.GetBuyLink();
                if (sms.Biz.IsSettingsValid)
                {
                    ViewBag.Amount = sms.Biz.GetSMSAmount();
                    int count = 0;
                    if (int.TryParse(ViewBag.Amount, out count))
                    {
                        ViewBag.ShowBuy = true;
                    }
                }
            }
            return(View(formData));
        }
예제 #20
0
        public ActionResult AccountSafety()
        {
            MemberAccountSafety model = new MemberAccountSafety();

            model.AccountSafetyLevel = 1;
            if (CurrentUser.PayPwd != null)
            {
                model.PayPassword         = true;
                model.AccountSafetyLevel += 1;
            }
            var messagePlugins  = PluginsManagement.GetPlugins <IMessagePlugin>();
            var ImessageService = _iMessageService;
            var data            = messagePlugins.Select(item => new PluginsInfo
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(ImessageService.GetDestination(CurrentUser.Id, item.PluginInfo.PluginId, Entities.MemberContactInfo.UserTypes.General))
            });

            foreach (var messagePlugin in data)
            {
                if (messagePlugin.PluginId.IndexOf("SMS") > 0)
                {
                    if (messagePlugin.IsBind)
                    {
                        model.BindPhone           = true;
                        model.AccountSafetyLevel += 1;
                    }
                }
                else
                {
                    if (messagePlugin.IsBind)
                    {
                        model.BindEmail           = true;
                        model.AccountSafetyLevel += 1;
                    }
                }
            }
            ViewBag.Keyword  = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords = SiteSettings.HotKeyWords;
            return(View(model));
        }
예제 #21
0
        public ActionResult Index()
        {
            ViewBag.SiteName = base.CurrentSiteSetting.SiteName;
            ViewBag.Logo     = base.CurrentSiteSetting.Logo;
            IEnumerable <Plugin <IOAuthPlugin> > plugins = PluginsManagement.GetPlugins <IOAuthPlugin>(true);
            string str     = string.Concat(base.Request.Url.Scheme, "://", base.Request.Url.Host, (base.Request.Url.Port == 80 ? "" : string.Concat(":", base.Request.Url.Port)));
            string mapPath = IOHelper.GetMapPath("/");
            IEnumerable <OAuthInfo> oAuthInfo =
                from item in plugins
                select new OAuthInfo()
            {
                Name        = item.Biz.ShortName,
                Url         = item.Biz.GetOpenLoginUrl(string.Concat(str, "/Login/OauthCallBack?oauthId=", item.PluginInfo.PluginId)),
                LogoDefault = item.Biz.Icon_Default.Replace(mapPath, "/"),
                LogoHover   = item.Biz.Icon_Hover.Replace(mapPath, "/")
            };

            return(View(oAuthInfo));
        }
예제 #22
0
        // GET: Admin/Message
        public ActionResult Management()
        {
            var messagePlugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            var data           = messagePlugins.Select(item =>
            {
                dynamic model  = new ExpandoObject();
                model.name     = item.PluginInfo.DisplayName;
                model.pluginId = item.PluginInfo.PluginId;
                model.enable   = item.PluginInfo.Enable;
                model.status   = item.Biz.GetAllStatus();
                return(model);
            });

            #region 微信模板消息
            List <Entities.WeiXinMsgTemplateInfo> wxtempllist = new List <Entities.WeiXinMsgTemplateInfo>();
            wxtempllist = _iWXMsgTemplateService.GetWeiXinMsgTemplateList();
            var statelist = new Dictionary <MessageTypeEnum, StatusEnum>();
            foreach (var item in Enum.GetValues(typeof(Himall.Core.Plugins.Message.MessageTypeEnum)))
            {
                var _tmpv    = (int)item;
                var _tmpenum = (Himall.Core.Plugins.Message.MessageTypeEnum)item;
                var _tmpdata = wxtempllist.FirstOrDefault(d => d.MessageType == _tmpv);
                if (_tmpdata != null)
                {
                    statelist.Add(_tmpenum, (_tmpdata.IsOpen ? StatusEnum.Open : StatusEnum.Close));
                }
                else
                {
                    statelist.Add(_tmpenum, StatusEnum.Disable);
                }
            }
            dynamic _wxdata = new ExpandoObject();
            _wxdata.name     = "微信模板消息";
            _wxdata.pluginId = wxtmppluginsid;
            _wxdata.enable   = true;
            _wxdata.status   = statelist;
            List <dynamic> data2 = new List <dynamic>();
            data2.Add(_wxdata);
            data = data.Concat(data2);
            #endregion

            return(View(data));
        }
예제 #23
0
        public ActionResult editwxtm()
        {
            var messagePlugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            var data           = messagePlugins.Select(item =>
            {
                dynamic model  = new ExpandoObject();
                model.name     = item.PluginInfo.DisplayName;
                model.pluginId = item.PluginInfo.PluginId;
                model.enable   = item.PluginInfo.Enable;
                model.status   = item.Biz.GetAllStatus();
                return(model);
            }
                                                       );

            ViewBag.messagePlugins = data;

            List <Entities.WeiXinMsgTemplateInfo> wxtempllist = new List <Entities.WeiXinMsgTemplateInfo>();

            wxtempllist = _iWXMsgTemplateService.GetWeiXinMsgTemplateList().Where(e => e.UserInWxApplet == CommonModel.WXMsgTemplateType.WeiXinShop).ToList();
            return(View(wxtempllist));
        }
예제 #24
0
        // GET: Admin/SiteSetting
        public ActionResult Edit()
        {
            Mapper.CreateMap <SiteSettings, SiteSettingModel>().ForMember(a => a.SiteIsOpen, b => b.MapFrom(s => s.SiteIsClose));
            var settings = Mapper.Map <SiteSettings, SiteSettingModel>(SiteSettingApplication.SiteSettings);

            settings.Logo       = Core.HimallIO.GetImagePath(settings.Logo);
            settings.MemberLogo = Core.HimallIO.GetImagePath(settings.MemberLogo);
            settings.PCLoginPic = Core.HimallIO.GetImagePath(settings.PCLoginPic);
            settings.QRCode     = Core.HimallIO.GetImagePath(settings.QRCode);
            settings.WXLogo     = Core.HimallIO.GetImagePath(settings.WXLogo);

            #region 强制绑定手机参数
            var sms = PluginsManagement.GetPlugins <ISMSPlugin>().FirstOrDefault();
            if (sms != null)
            {
                ViewBag.ShowSMS   = true;
                ViewBag.LoginLink = sms.Biz.GetLoginLink();
                ViewBag.BuyLink   = sms.Biz.GetBuyLink();
            }
            #endregion
            return(View(settings));
        }
예제 #25
0
        //找回密码第二步
        public ActionResult Step2(string key)
        {
            var s = Core.Cache.Get <UserMemberInfo>(key);

            if (s == null)
            {
                return(RedirectToAction("Error", "FindPassWord"));
            }
            var messagePlugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            var data           = messagePlugins.Select(item => new PluginsInfo
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(_iMessageService.GetDestination(s.Id, item.PluginInfo.PluginId, Himall.Model.MemberContactsInfo.UserTypes.General))
            });

            ViewBag.BindContactInfo = data;
            ViewBag.Key             = key;
            return(View(s));
        }
예제 #26
0
        public ActionResult Step2(string key)
        {
            UserMemberInfo userMemberInfo = Cache.Get(key) as UserMemberInfo;

            if (userMemberInfo == null)
            {
                return(RedirectToAction("Error", "FindPassWord"));
            }
            IEnumerable <Plugin <IMessagePlugin> > plugins = PluginsManagement.GetPlugins <IMessagePlugin>();
            IEnumerable <PluginsInfo> pluginsInfo          =
                from item in plugins
                select new PluginsInfo()
            {
                ShortName       = item.Biz.ShortName,
                PluginId        = item.PluginInfo.PluginId,
                Enable          = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind          = !string.IsNullOrEmpty(ServiceHelper.Create <IMessageService>().GetDestination(userMemberInfo.Id, item.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General))
            };

            ViewBag.BindContactInfo = pluginsInfo;
            ViewBag.Key             = key;
            return(View(userMemberInfo));
        }
예제 #27
0
        public ActionResult ChargePay(string orderIds)
        {
            string str;

            if (string.IsNullOrEmpty(orderIds))
            {
                return(RedirectToAction("/SellerAdmin"));
            }
            IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>();
            ChargeDetailInfo      chargeDetail         = memberCapitalService.GetChargeDetail(long.Parse(orderIds));

            if (chargeDetail == null || chargeDetail.MemId != base.CurrentSellerManager.Id || chargeDetail.ChargeStatus == ChargeDetailInfo.ChargeDetailStatus.ChargeSuccess)
            {
                Log.Error(string.Concat("未找到充值申请记录:", orderIds));
                return(RedirectToAction("SticsMoneyList"));
            }
            SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings();

            ViewBag.Logo   = siteSettings.Logo;
            ViewBag.Orders = chargeDetail;
            string scheme = base.Request.Url.Scheme;
            string host   = base.HttpContext.Request.Url.Host;

            if (base.HttpContext.Request.Url.Port == 80)
            {
                str = "";
            }
            else
            {
                int port = base.HttpContext.Request.Url.Port;
                str = string.Concat(":", port.ToString());
            }
            string str1 = string.Concat(scheme, "://", host, str);
            string str2 = string.Concat(str1, "/Pay/CapitalChargeReturn/{0}");
            string str3 = string.Concat(str1, "/Pay/CapitalChargeNotify/{0}");
            IEnumerable <Plugin <IPaymentPlugin> > plugins =
                from item in PluginsManagement.GetPlugins <IPaymentPlugin>(true)
                where item.Biz.SupportPlatforms.Contains <PlatformType>(PlatformType.PC)
                select item;
            IEnumerable <PaymentModel> paymentModels = plugins.Select <Plugin <IPaymentPlugin>, PaymentModel>((Plugin <IPaymentPlugin> item) =>
            {
                string empty = string.Empty;
                try
                {
                    empty = item.Biz.GetRequestUrl(string.Format(str2, EncodePaymentId(item.PluginInfo.PluginId)), string.Format(str3, EncodePaymentId(item.PluginInfo.PluginId)), orderIds, chargeDetail.ChargeAmount, "预付款充值", null);
                }
                catch (Exception exception)
                {
                    Log.Error("支付页面加载支付插件出错", exception);
                }
                return(new PaymentModel()
                {
                    Logo = string.Concat("/Plugins/Payment/", item.PluginInfo.ClassFullName.Split(new char[] { ',' })[1], "/", item.Biz.Logo),
                    RequestUrl = empty,
                    UrlType = item.Biz.RequestUrlType,
                    Id = item.PluginInfo.PluginId
                });
            });

            paymentModels =
                from item in paymentModels
                where !string.IsNullOrEmpty(item.RequestUrl)
                select item;

            ViewBag.OrderIds      = orderIds;
            ViewBag.TotalAmount   = chargeDetail.ChargeAmount;
            ViewBag.Step          = 1;
            ViewBag.UnpaidTimeout = siteSettings.UnpaidTimeout;
            return(View());
        }
예제 #28
0
        public JsonResult ConfirmApply(long id, ApplyWithDrawInfo.ApplyWithDrawStatus comfirmStatus, string remark)
        {
            IMemberCapitalService memberCapitalService = this._iMemberCapitalService;

            ApplyWithDrawInfo.ApplyWithDrawStatus status = comfirmStatus;
            ApplyWithDrawInfo applyWithDrawInfo1         = memberCapitalService.GetApplyWithDrawInfo(id);

            if (status == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse)
            {
                memberCapitalService.RefuseApplyWithDraw(id, status, this.CurrentManager.UserName, remark);
                this._iOperationLogService.AddPlatformOperationLog(new LogInfo()
                {
                    Date        = DateTime.Now,
                    Description = string.Format("会员提现审核拒绝,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark),
                    IPAddress   = this.Request.UserHostAddress,
                    PageUrl     = "/Admin/Capital/WithDraw",
                    UserName    = this.CurrentManager.UserName,
                    ShopId      = 0L
                });
                return(this.Json((object)new BaseController.Result()
                {
                    success = true,
                    msg = "审核成功!"
                }));
            }
            UserWithdrawType?applyType = applyWithDrawInfo1.ApplyType;

            if ((applyType.GetValueOrDefault() != UserWithdrawType.ALiPay ? 0 : (applyType.HasValue ? 1 : 0)) != 0)
            {
                if (applyWithDrawInfo1.ApplyStatus == ApplyWithDrawInfo.ApplyWithDrawStatus.PayPending)
                {
                    return(this.Json((object)new BaseController.Result()
                    {
                        success = false,
                        msg = "等待第三方处理中,如有误操作,请先取消后再进行付款操作!"
                    }));
                }
                Plugin <IPaymentPlugin> plugin = Enumerable.FirstOrDefault <Plugin <IPaymentPlugin> >(PluginsManagement.GetPlugins <IPaymentPlugin>(true), (Func <Plugin <IPaymentPlugin>, bool>)(e => e.PluginInfo.PluginId == "Himall.Plugin.Payment.Alipay"));
                if (plugin != null)
                {
                    try
                    {
                        string            format = CurrentUrlHelper.CurrentUrlNoPort() + "/Pay/EnterpriseNotify/{0}?outid={1}";
                        EnterprisePayPara para   = new EnterprisePayPara()
                        {
                            amount       = applyWithDrawInfo1.ApplyAmount,
                            check_name   = false,
                            openid       = applyWithDrawInfo1.OpenId,
                            re_user_name = applyWithDrawInfo1.NickName,
                            out_trade_no = applyWithDrawInfo1.Id.ToString(),
                            desc         = "提现",
                            notify_url   = string.Format(format, (object)this.EncodePaymentId(plugin.PluginInfo.PluginId), (object)applyWithDrawInfo1.Id.ToString())
                        };
                        PaymentInfo       paymentInfo        = plugin.Biz.EnterprisePay(para);
                        ApplyWithDrawInfo applyWithDrawInfo2 = new ApplyWithDrawInfo();
                        applyWithDrawInfo2.PayNo       = paymentInfo.TradNo;
                        applyWithDrawInfo2.ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayPending;
                        ApplyWithDrawInfo applyWithDrawInfo3 = applyWithDrawInfo2;
                        DateTime?         tradeTime          = paymentInfo.TradeTime;
                        DateTime          now;
                        if (!tradeTime.HasValue)
                        {
                            now = DateTime.Now;
                        }
                        else
                        {
                            tradeTime = paymentInfo.TradeTime;
                            now       = tradeTime.Value;
                        }
                        DateTime?nullable = new DateTime?(now);
                        applyWithDrawInfo3.PayTime     = nullable;
                        applyWithDrawInfo2.ConfirmTime = new DateTime?(DateTime.Now);
                        applyWithDrawInfo2.OpUser      = this.CurrentManager.UserName;
                        applyWithDrawInfo2.ApplyAmount = applyWithDrawInfo1.ApplyAmount;
                        applyWithDrawInfo2.Id          = applyWithDrawInfo1.Id;
                        ApplyWithDrawInfo info = applyWithDrawInfo2;
                        memberCapitalService.ConfirmApplyWithDraw(info);
                        this._iOperationLogService.AddPlatformOperationLog(new LogInfo()
                        {
                            Date        = DateTime.Now,
                            Description = string.Format("会员提现审核成功,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark),
                            IPAddress   = this.Request.UserHostAddress,
                            PageUrl     = "/Admin/Capital/WithDraw",
                            UserName    = this.CurrentManager.UserName,
                            ShopId      = 0L
                        });
                        return(this.Json((object)new BaseController.Result()
                        {
                            success = true,
                            msg = "审核操作成功",
                            status = 2,
                            Data = (object)paymentInfo.ResponseContentWhenFinished
                        }));
                    }
                    catch (PluginException ex)
                    {
                        Log.Error((object)("调用企业付款接口异常:" + ex.Message));
                        this._iOperationLogService.AddPlatformOperationLog(new LogInfo()
                        {
                            Date        = DateTime.Now,
                            Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark),
                            IPAddress   = this.Request.UserHostAddress,
                            PageUrl     = "/Admin/Capital/WithDraw",
                            UserName    = this.CurrentManager.UserName,
                            ShopId      = 0L
                        });
                        return(this.Json((object)new BaseController.Result()
                        {
                            success = false,
                            msg = ex.Message
                        }));
                    }
                    catch (Exception ex)
                    {
                        Log.Error((object)("提现审核异常:" + ex.Message));
                        return(this.Json((object)new BaseController.Result()
                        {
                            success = false,
                            msg = "付款接口异常"
                        }));
                    }
                }
                else
                {
                    return(this.Json((object)new BaseController.Result()
                    {
                        success = false,
                        msg = "未找到支付插件"
                    }));
                }
            }
            else
            {
                Plugin <IPaymentPlugin> plugin = Enumerable.FirstOrDefault <Plugin <IPaymentPlugin> >(Enumerable.Where <Plugin <IPaymentPlugin> >(PluginsManagement.GetPlugins <IPaymentPlugin>(true), (Func <Plugin <IPaymentPlugin>, bool>)(e => e.PluginInfo.PluginId.ToLower().Contains("weixin"))));
                if (plugin != null)
                {
                    try
                    {
                        EnterprisePayPara para = new EnterprisePayPara()
                        {
                            amount       = applyWithDrawInfo1.ApplyAmount,
                            check_name   = false,
                            openid       = applyWithDrawInfo1.OpenId,
                            out_trade_no = applyWithDrawInfo1.Id.ToString(),
                            desc         = "提现"
                        };
                        PaymentInfo       paymentInfo        = plugin.Biz.EnterprisePay(para);
                        ApplyWithDrawInfo applyWithDrawInfo2 = new ApplyWithDrawInfo();
                        applyWithDrawInfo2.PayNo       = paymentInfo.TradNo;
                        applyWithDrawInfo2.ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess;
                        applyWithDrawInfo2.Remark      = plugin.PluginInfo.Description;
                        ApplyWithDrawInfo applyWithDrawInfo3 = applyWithDrawInfo2;
                        DateTime?         tradeTime          = paymentInfo.TradeTime;
                        DateTime          now;
                        if (!tradeTime.HasValue)
                        {
                            now = DateTime.Now;
                        }
                        else
                        {
                            tradeTime = paymentInfo.TradeTime;
                            now       = tradeTime.Value;
                        }
                        DateTime?nullable = new DateTime?(now);
                        applyWithDrawInfo3.PayTime     = nullable;
                        applyWithDrawInfo2.ConfirmTime = new DateTime?(DateTime.Now);
                        applyWithDrawInfo2.OpUser      = this.CurrentManager.UserName;
                        applyWithDrawInfo2.ApplyAmount = applyWithDrawInfo1.ApplyAmount;
                        applyWithDrawInfo2.Id          = applyWithDrawInfo1.Id;
                        ApplyWithDrawInfo info = applyWithDrawInfo2;
                        memberCapitalService.ConfirmApplyWithDraw(info);
                        this._iOperationLogService.AddPlatformOperationLog(new LogInfo()
                        {
                            Date        = DateTime.Now,
                            Description = string.Format("会员提现审核成功,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark),
                            IPAddress   = this.Request.UserHostAddress,
                            PageUrl     = "/Admin/Capital/WithDraw",
                            UserName    = this.CurrentManager.UserName,
                            ShopId      = 0L
                        });
                    }
                    catch (PluginException ex)
                    {
                        Log.Error((object)("调用企业付款接口异常:" + ex.Message));
                        this._iOperationLogService.AddPlatformOperationLog(new LogInfo()
                        {
                            Date        = DateTime.Now,
                            Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark),
                            IPAddress   = this.Request.UserHostAddress,
                            PageUrl     = "/Admin/Capital/WithDraw",
                            UserName    = this.CurrentManager.UserName,
                            ShopId      = 0L
                        });
                        return(this.Json((object)new BaseController.Result()
                        {
                            success = false,
                            msg = ex.Message
                        }));
                    }
                    catch (Exception ex)
                    {
                        Log.Error((object)("提现审核异常:" + ex.Message));
                        ApplyWithDrawInfo info = new ApplyWithDrawInfo()
                        {
                            ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail,
                            Remark      = plugin.PluginInfo.Description,
                            ConfirmTime = new DateTime?(DateTime.Now),
                            OpUser      = this.CurrentManager.UserName,
                            ApplyAmount = applyWithDrawInfo1.ApplyAmount,
                            Id          = applyWithDrawInfo1.Id
                        };
                        memberCapitalService.ConfirmApplyWithDraw(info);
                        this._iOperationLogService.AddPlatformOperationLog(new LogInfo()
                        {
                            Date        = DateTime.Now,
                            Description = string.Format("会员提现审核失败,会员Id={0},状态为:{1}, 说明是:{2}", (object)applyWithDrawInfo1.MemId, (object)status, (object)remark),
                            IPAddress   = this.Request.UserHostAddress,
                            PageUrl     = "/Admin/Capital/WithDraw",
                            UserName    = this.CurrentManager.UserName,
                            ShopId      = 0L
                        });
                        return(this.Json((object)new BaseController.Result()
                        {
                            success = false,
                            msg = "付款接口异常"
                        }));
                    }
                    return(this.Json((object)new BaseController.Result()
                    {
                        success = true,
                        msg = "审核操作成功"
                    }));
                }
                return(this.Json((object)new BaseController.Result()
                {
                    success = false,
                    msg = "未找到支付插件"
                }));
            }
        }
예제 #29
0
        public JsonResult Get(string orderIds)
        {
            string str;
            IEnumerable <Plugin <IPaymentPlugin> > plugins =
                from item in PluginsManagement.GetPlugins <IPaymentPlugin>(true)
                where item.Biz.SupportPlatforms.Contains <Himall.Core.PlatformType>(base.PlatformType)
                select item;
            string scheme = base.Request.Url.Scheme;
            string host   = base.HttpContext.Request.Url.Host;

            if (base.HttpContext.Request.Url.Port == 80)
            {
                str = "";
            }
            else
            {
                int port = base.HttpContext.Request.Url.Port;
                str = string.Concat(":", port.ToString());
            }
            string str1 = string.Concat(scheme, "://", host, str);

            object[]      platformType  = new object[] { str1, "/m-", base.PlatformType, "/Payment/" };
            string        str2          = string.Concat(platformType);
            IOrderService orderService  = ServiceHelper.Create <IOrderService>();
            IOrderService orderService1 = orderService;

            char[] chrArray = new char[] { ',' };
            IEnumerable <OrderInfo> list = orderService1.GetOrders(
                from t in orderIds.Split(chrArray)
                select long.Parse(t)).ToList();
            decimal num = list.Sum <OrderInfo>((OrderInfo t) => t.OrderTotalAmount);
            string  productNameDescriptionFromOrders = GetProductNameDescriptionFromOrders(list);
            string  cookie = WebHelper.GetCookie("Himall-User_OpenId");

            if (string.IsNullOrWhiteSpace(cookie))
            {
                MemberOpenIdInfo memberOpenIdInfo = ServiceHelper.Create <IMemberService>().GetMember(base.CurrentUser.Id).MemberOpenIdInfo.FirstOrDefault((MemberOpenIdInfo item) => item.AppIdType == MemberOpenIdInfo.AppIdTypeEnum.Payment);
                if (memberOpenIdInfo != null)
                {
                    cookie = memberOpenIdInfo.OpenId;
                }
            }
            else
            {
                cookie = SecureHelper.AESDecrypt(cookie, "Mobile");
            }
            string[] strArrays = orderIds.Split(new char[] { ',' });
            string   str3      = string.Concat(str2, "Notify/");

            object[] objArray = new object[] { str1, "/m-", base.PlatformType, "/Member/PaymentToOrders?ids=", orderIds };
            string   str4     = string.Concat(objArray);
            IEnumerable <OrderPayInfo> orderPayInfo =
                from item in strArrays
                select new OrderPayInfo()
            {
                PayId   = 0,
                OrderId = long.Parse(item)
            };
            string str5       = orderService.SaveOrderPayInfo(orderPayInfo, Himall.Core.PlatformType.PC).ToString();
            var    collection = plugins.ToArray <Plugin <IPaymentPlugin> >().Select((Plugin <IPaymentPlugin> item) => {
                string empty = string.Empty;
                try
                {
                    empty = item.Biz.GetRequestUrl(str4, string.Concat(str3, item.PluginInfo.PluginId.Replace(".", "-")), str5, num, productNameDescriptionFromOrders, cookie);
                }
                catch (Exception exception)
                {
                    Log.Error("获取支付方式错误:", exception);
                }
                return(new { id = item.PluginInfo.PluginId, name = item.PluginInfo.DisplayName, logo = item.Biz.Logo, url = empty });
            });

            collection =
                from item in collection
                where !string.IsNullOrWhiteSpace(item.url)
                select item;

            return(Json(collection));
        }
예제 #30
0
        public JsonResult ConfirmPay(long id, ApplyWithDrawInfo.ApplyWithDrawStatus status, string remark)
        {
            JsonResult            jsonResult;
            IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>();

            if (status == ApplyWithDrawInfo.ApplyWithDrawStatus.Refuse)
            {
                memberCapitalService.RefuseApplyWithDraw(id, status, base.CurrentManager.UserName, remark);
                return(Json(new { success = true, msg = "审核成功!" }));
            }
            ApplyWithDrawQuery applyWithDrawQuery = new ApplyWithDrawQuery()
            {
                withDrawNo = new long?(id),
                PageNo     = 1,
                PageSize   = 1
            };
            ApplyWithDrawQuery      applyWithDrawQuery1 = applyWithDrawQuery;
            ApplyWithDrawInfo       applyWithDrawInfo   = memberCapitalService.GetApplyWithDraw(applyWithDrawQuery1).Models.FirstOrDefault();
            Plugin <IPaymentPlugin> plugin = (
                from e in PluginsManagement.GetPlugins <IPaymentPlugin>(true)
                where e.PluginInfo.PluginId.ToLower().Contains("weixin")
                select e).FirstOrDefault <Plugin <IPaymentPlugin> >();

            if (plugin == null)
            {
                return(Json(new { success = false, msg = "未找到支付插件" }));
            }
            try
            {
                EnterprisePayPara enterprisePayPara = new EnterprisePayPara()
                {
                    amount       = applyWithDrawInfo.ApplyAmount,
                    check_name   = false,
                    openid       = applyWithDrawInfo.OpenId,
                    out_trade_no = applyWithDrawInfo.Id.ToString(),
                    desc         = "提现"
                };
                PaymentInfo       paymentInfo        = plugin.Biz.EnterprisePay(enterprisePayPara);
                ApplyWithDrawInfo applyWithDrawInfo1 = new ApplyWithDrawInfo()
                {
                    PayNo       = paymentInfo.TradNo,
                    ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WithDrawSuccess,
                    Remark      = plugin.PluginInfo.Description,
                    PayTime     = new DateTime?((paymentInfo.TradeTime.HasValue ? paymentInfo.TradeTime.Value : DateTime.Now)),
                    ConfirmTime = new DateTime?(DateTime.Now),
                    OpUser      = base.CurrentManager.UserName,
                    ApplyAmount = applyWithDrawInfo.ApplyAmount,
                    Id          = applyWithDrawInfo.Id
                };
                memberCapitalService.ConfirmApplyWithDraw(applyWithDrawInfo1);
                return(Json(new { success = true, msg = "付款成功" }));
            }
            catch (Exception exception)
            {
                Log.Error(string.Concat("调用企业付款接口异常:", exception.Message));
                ApplyWithDrawInfo applyWithDrawInfo2 = new ApplyWithDrawInfo()
                {
                    ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.PayFail,
                    Remark      = plugin.PluginInfo.Description,
                    ConfirmTime = new DateTime?(DateTime.Now),
                    OpUser      = base.CurrentManager.UserName,
                    ApplyAmount = applyWithDrawInfo.ApplyAmount,
                    Id          = applyWithDrawInfo.Id
                };
                memberCapitalService.ConfirmApplyWithDraw(applyWithDrawInfo2);
                jsonResult = Json(new { success = false, msg = "付款接口异常" });
            }
            return(jsonResult);
        }