コード例 #1
0
ファイル: PaymentController.cs プロジェクト: Shikyoh/HSWB2B2C
        public JsonResult Save(string pluginId, string values)
        {
            IPaymentPlugin biz = PluginsManagement.GetPlugin <IPaymentPlugin>(pluginId).Biz;

            biz.SetFormValues(JsonConvert.DeserializeObject <IEnumerable <KeyValuePair <string, string> > >(values));
            return(Json(new { success = true }));
        }
コード例 #2
0
        public ContentResult PayNotify_Charge(string id)
        {
            string result = string.Empty;

            try
            {
                id = DecodePaymentId(id);
                var payPlugin = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                if (payPlugin != null)
                {
                    var paymentInfo = payPlugin.Biz.ProcessNotify(Request);
                    var service     = _iMemberCapitalService;
                    var chargeInfo  = service.GetChargeDetail(paymentInfo.OrderIds.FirstOrDefault());
                    if (chargeInfo != null && chargeInfo.ChargeStatus != ChargeDetailInfo.ChargeDetailStatus.ChargeSuccess)
                    {
                        chargeInfo.ChargeWay    = payPlugin.PluginInfo.DisplayName;
                        chargeInfo.ChargeStatus = ChargeDetailInfo.ChargeDetailStatus.ChargeSuccess;
                        chargeInfo.ChargeTime   = paymentInfo.TradeTime.HasValue ? paymentInfo.TradeTime.Value : DateTime.Now;
                        service.UpdateChargeDetail(chargeInfo);
                        result = payPlugin.Biz.ConfirmPayResult();
                        string payStateKey = CacheKeyCollection.PaymentState(chargeInfo.Id.ToString()); //获取支付状态缓存键
                        Cache.Insert(payStateKey, true, 15);                                            //标记为已支付
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("预付款充值回调出错:" + ex.Message);
            }
            return(Content(result));
        }
コード例 #3
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));
        }
コード例 #4
0
        public ActionResult PayReturn_Charge(string id)
        {
            string result = string.Empty;

            try
            {
                id = DecodePaymentId(id);
                var payPlugin = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                if (payPlugin != null)
                {
                    var paymentInfo = payPlugin.Biz.ProcessReturn(Request);
                    var service     = _iMemberCapitalService;
                    var chargeInfo  = service.GetChargeDetail(paymentInfo.OrderIds.FirstOrDefault());
                    if (chargeInfo != null && chargeInfo.ChargeStatus != Himall.Entities.ChargeDetailInfo.ChargeDetailStatus.ChargeSuccess)
                    {
                        //chargeInfo.ChargeWay = payPlugin.PluginInfo.DisplayName;
                        chargeInfo.ChargeWay    = PaymentApplication.GetForeGroundPaymentName(payPlugin.PluginInfo.Description);
                        chargeInfo.ChargeStatus = Himall.Entities.ChargeDetailInfo.ChargeDetailStatus.ChargeSuccess;
                        chargeInfo.ChargeTime   = paymentInfo.TradeTime.HasValue ? paymentInfo.TradeTime.Value : DateTime.Now;
                        service.UpdateChargeDetail(chargeInfo);
                        result = payPlugin.Biz.ConfirmPayResult();
                        string payStateKey = CacheKeyCollection.PaymentState(chargeInfo.Id.ToString()); //获取支付状态缓存键
                        Cache.Insert(payStateKey, true, 15);                                            //标记为已支付
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("预存款充值回调出错:" + ex.Message);
            }
            ViewBag.Keyword = SiteSettings.Keyword;
            return(View());
        }
コード例 #5
0
        public ActionResult OauthCallBack(string oauthId)
        {
            Plugin <IOAuthPlugin> plugin          = PluginsManagement.GetPlugin <IOAuthPlugin>(oauthId);
            OAuthUserInfo         userInfo        = plugin.Biz.GetUserInfo(base.Request.QueryString);
            UserMemberInfo        memberByUnionId = null;

            if (!string.IsNullOrWhiteSpace(userInfo.UnionId))
            {
                memberByUnionId = ServiceHelper.Create <IMemberService>().GetMemberByUnionId(oauthId, userInfo.UnionId);
            }
            if (memberByUnionId == null && !string.IsNullOrWhiteSpace(userInfo.OpenId))
            {
                memberByUnionId = ServiceHelper.Create <IMemberService>().GetMemberByOpenId(oauthId, userInfo.OpenId);
            }
            if (memberByUnionId != null)
            {
                SellerLoginIn(memberByUnionId.UserName, memberByUnionId.Password, false);
                string str = UserCookieEncryptHelper.Encrypt(memberByUnionId.Id, "Web");
                WebHelper.SetCookie("ChemCloud-User", str.ToString());
                BizAfterLogin.Run(memberByUnionId.Id);
                return(Redirect("/"));
            }
            if (string.IsNullOrWhiteSpace(userInfo.OpenId))
            {
                return(View());
            }
            object[] objArray = new object[] { oauthId, userInfo.OpenId, userInfo.NickName, userInfo.UnionId, userInfo.OpenId };
            return(Redirect(string.Format("/Login/BindUser?oauthId={0}&openId={1}&name={2}&unionid={3}&unionopenid={4}", objArray)));
        }
コード例 #6
0
        public JsonResult Send(string pluginId, string destination)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            if (string.IsNullOrEmpty(destination))
            {
                return(Json(new Result {
                    success = false, msg = "你填写的" + messagePlugin.Biz.ShortName + "不能为空!"
                }));
            }

            if (!messagePlugin.Biz.CheckDestination(destination))
            {
                return(Json(new Result {
                    success = false, msg = "你填写的" + messagePlugin.Biz.ShortName + "不正确"
                }));
            }
            var siteName = SiteSettingApplication.SiteSettings.SiteName;
            var result   = messagePlugin.Biz.SendTestMessage(destination, "该条信息,请勿回复!【" + siteName + "】", "这是一封测试邮件");

            if (result == "发送成功")
            {
                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new Result {
                    success = false, msg = result
                }));
            }
        }
コード例 #7
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);
                if (paymentInfo != null)
                {
                    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);
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                empty = exception.Message;
                Log.Error(string.Concat("移动端同步返回出错,支持方式:", id), exception);
            }
            ViewBag.Error = empty;
            return(View());
        }
コード例 #8
0
        public ActionResult PayReturn_Charge(string id)
        {
            string empty = string.Empty;

            try
            {
                id = DecodePaymentId(id);
                Plugin <IPaymentPlugin> plugin = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                if (plugin != null)
                {
                    PaymentInfo           paymentInfo          = plugin.Biz.ProcessReturn(base.Request);
                    IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>();
                    ChargeDetailInfo      chargeDetail         = memberCapitalService.GetChargeDetail(paymentInfo.OrderIds.FirstOrDefault());
                    if (chargeDetail != null && chargeDetail.ChargeStatus != ChargeDetailInfo.ChargeDetailStatus.ChargeSuccess)
                    {
                        chargeDetail.ChargeWay    = plugin.PluginInfo.DisplayName;
                        chargeDetail.ChargeStatus = ChargeDetailInfo.ChargeDetailStatus.ChargeSuccess;
                        chargeDetail.ChargeTime   = new DateTime?((paymentInfo.TradeTime.HasValue ? paymentInfo.TradeTime.Value : DateTime.Now));
                        memberCapitalService.UpdateChargeDetail(chargeDetail);
                        plugin.Biz.ConfirmPayResult();
                        string str = CacheKeyCollection.PaymentState(chargeDetail.Id.ToString());
                        Cache.Insert(str, true, 15);
                    }
                }
            }
            catch (Exception exception)
            {
                Log.Error(string.Concat("预付款充值回调出错:", exception.Message));
            }
            return(View());
        }
コード例 #9
0
        public JsonResult SendEmailMsg(string labelids, string title, string content, string labelinfos)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>("Himall.Plugin.Message.Email");
            var lids = string.IsNullOrWhiteSpace(labelids) ? null : labelids.Split(',').Select(s => long.Parse(s)).ToArray();
            int pageNo = 1, pageSize = 100;
            var pageMode = _iMemberService.GetMembers(new MemberQuery
            {
                IsHaveEmail = true,
                Labels      = lids,
                PageNo      = pageNo,
                PageSize    = pageSize
            });

            if (pageMode.Total == 0)
            {
                return(Json(new Result {
                    success = false, msg = "未找到可发送邮件的会员信息!"
                }));
            }
            while (pageMode.Models.Count() > 0)
            {//暂时循环处理
                string[] dests = pageMode.Models.Select(e => e.Email).ToArray();
                foreach (var dest in dests)
                {
                    if (!messagePlugin.Biz.CheckDestination(dest))
                    {
                        return(Json(new Result {
                            success = false, msg = "非法Email地址:" + dest
                        }));
                    }
                }
                var siteName = SiteSettingApplication.SiteSettings.SiteName;
                messagePlugin.Biz.SendMessages(dests, content, title);
                pageNo  += 1;
                pageMode = _iMemberService.GetMembers(new MemberQuery
                {
                    IsHaveEmail = true,
                    Labels      = lids,
                    PageNo      = pageNo,
                    PageSize    = pageSize
                });
            }
            if (!string.IsNullOrEmpty(title))
            {
                content = "####Title■■" + title.Trim() + "####" + content;//把邮件标题保存在内容里面,用5个特殊符号隔开
            }
            var sendRecord = new Entities.SendMessageRecordInfo
            {
                ContentType = WXMsgType.text,
                MessageType = MsgType.Email,
                SendContent = content == null ? "" : content,
                SendState   = 1,
                SendTime    = DateTime.Now,
                ToUserLabel = labelinfos == null ? "" : labelinfos
            };

            _iWXMsgTemplateService.AddSendRecord(sendRecord);
            return(Json(new { success = true }));
        }
コード例 #10
0
        public ActionResult Bind(string pluginId)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName = messagePlugin.Biz.ShortName;
            ViewBag.id        = pluginId;
            return(View());
        }
コード例 #11
0
        public JsonResult Save(string pluginId, string values)
        {
            var oauthPlugin = PluginsManagement.GetPlugin <IOAuthPlugin>(pluginId);
            var items       = Newtonsoft.Json.JsonConvert.DeserializeObject <IEnumerable <KeyValuePair <string, string> > >(values);

            oauthPlugin.Biz.SetFormValues(items);
            return(Json(new { success = true }));
        }
コード例 #12
0
ファイル: OAuthController.cs プロジェクト: Shikyoh/HSWB2B2C
        public JsonResult Save(string pluginId, string values)
        {
            Plugin <IOAuthPlugin> plugin = PluginsManagement.GetPlugin <IOAuthPlugin>(pluginId);
            IEnumerable <KeyValuePair <string, string> > keyValuePairs = JsonConvert.DeserializeObject <IEnumerable <KeyValuePair <string, string> > >(values);

            plugin.Biz.SetFormValues(keyValuePairs);
            return(Json(new { success = true }));
        }
コード例 #13
0
ファイル: OAuthController.cs プロジェクト: Shikyoh/HSWB2B2C
        public ActionResult Edit(string pluginId)
        {
            ViewBag.Id = pluginId;
            Plugin <IOAuthPlugin> plugin = PluginsManagement.GetPlugin <IOAuthPlugin>(pluginId);

            ViewBag.Name = plugin.PluginInfo.DisplayName;
            return(View(plugin.Biz.GetFormData()));
        }
コード例 #14
0
        public ActionResult ReBind(string pluginId)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName   = messagePlugin.Biz.ShortName;
            ViewBag.id          = pluginId;
            ViewBag.ContactInfo = _iMessageService.GetDestination(CurrentUser.Id, pluginId, MemberContactsInfo.UserTypes.General);
            return(View());
        }
コード例 #15
0
        public ActionResult ReBind(string pluginId)
        {
            Plugin <IMessagePlugin> plugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName   = plugin.Biz.ShortName;
            ViewBag.id          = pluginId;
            ViewBag.ContactInfo = ServiceHelper.Create <IMessageService>().GetDestination(base.CurrentUser.Id, pluginId, MemberContactsInfo.UserTypes.General);
            return(View());
        }
コード例 #16
0
        public ActionResult Bind(string pluginId)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName = messagePlugin.Biz.ShortName;
            ViewBag.id        = pluginId;
            ViewBag.Keyword   = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords  = SiteSettings.HotKeyWords;
            return(View());
        }
コード例 #17
0
        public ActionResult Edit(string pluginId)
        {
            ViewBag.Id = pluginId;

            var payment = PluginsManagement.GetPlugin <IPaymentPlugin>(pluginId);

            ViewBag.Name = payment.PluginInfo.DisplayName;
            var formData = payment.Biz.GetFormData();

            return(View(formData));
        }
コード例 #18
0
        public JsonResult SendPhoneMsg(string labelids, string content, string labelinfos)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>("Himall.Plugin.Message.SMS");
            var lids = string.IsNullOrWhiteSpace(labelids) ? null : labelids.Split(',').Select(s => long.Parse(s)).ToArray();
            int pageNo = 1, pageSize = 100;
            var pageMode = _iMemberService.GetMembers(new MemberQuery
            {
                IsHavePhone = true,
                LabelId     = lids,
                PageNo      = pageNo,
                PageSize    = pageSize
            });

            if (pageMode.Total == 0)
            {
                return(Json(new Result {
                    success = false, msg = "未找到可发送短信的会员信息!"
                }));
            }
            var siteName = SiteSettingApplication.GetSiteSettings().SiteName;

            content = content + "【" + siteName + "】";
            while (pageMode.Models.Count() > 0)
            {//暂时循环处理
                string[] dests = pageMode.Models.Select(e => e.CellPhone).ToArray();
                foreach (var phone in dests)
                {
                    if (!string.IsNullOrWhiteSpace(phone))
                    {
                        messagePlugin.Biz.SendTestMessage(phone, content);
                    }
                }
                pageNo  += 1;
                pageMode = _iMemberService.GetMembers(new MemberQuery
                {
                    IsHavePhone = true,
                    LabelId     = lids,
                    PageNo      = pageNo,
                    PageSize    = pageSize
                });
            }
            var sendRecord = new Himall.Model.SendMessageRecordInfo
            {
                ContentType = WXMsgType.text,
                MessageType = MsgType.SMS,
                SendContent = content == null ? "" : content,
                SendState   = 1,
                SendTime    = DateTime.Now,
                ToUserLabel = labelinfos == null ? "" : labelinfos
            };

            _iWXMsgTemplateService.AddSendRecord(sendRecord);
            return(Json(new { success = true }));
        }
コード例 #19
0
        public ActionResult ReBind(string pluginId)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName   = messagePlugin.Biz.ShortName;
            ViewBag.id          = pluginId;
            ViewBag.ContactInfo = _iMessageService.GetDestination(CurrentUser.Id, pluginId, Entities.MemberContactInfo.UserTypes.General);
            ViewBag.Keyword     = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords    = SiteSettings.HotKeyWords;
            return(View());
        }
コード例 #20
0
        public ActionResult ReBindStep2(string pluginId, string key)
        {
            if (Cache.Get(string.Concat("Rebind", key)) as string != "step2")
            {
                RedirectToAction("ReBind", new { pluginId = pluginId });
            }
            Plugin <IMessagePlugin> plugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName   = plugin.Biz.ShortName;
            ViewBag.id          = pluginId;
            ViewBag.ContactInfo = ServiceHelper.Create <IMessageService>().GetDestination(base.CurrentUser.Id, pluginId, MemberContactsInfo.UserTypes.General);
            return(View());
        }
コード例 #21
0
        public ActionResult BindUser(string oauthId, string openId, string name, string unionid = null, string unionopenid = null)
        {
            ViewBag.Logo             = base.CurrentSiteSetting.Logo;
            ViewBag.OauthId          = oauthId;
            ViewBag.NickName         = name;
            ViewBag.OpenId           = openId;
            base.ViewBag.unionid     = (unionid == null ? string.Empty : unionid);
            base.ViewBag.unionopenid = (unionopenid == null ? string.Empty : unionopenid);
            IOAuthPlugin biz = PluginsManagement.GetPlugin <IOAuthPlugin>(oauthId).Biz;

            ViewBag.ServiceProvider = biz.ShortName;
            return(View());
        }
コード例 #22
0
        public ActionResult ReBindStep2(string pluginId, string key)
        {
            if (Core.Cache.Get("Rebind" + key) as string != "step2")
            {
                RedirectToAction("ReBind", new { pluginId = pluginId });
            }
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName   = messagePlugin.Biz.ShortName;
            ViewBag.id          = pluginId;
            ViewBag.ContactInfo = _iMessageService.GetDestination(CurrentUser.Id, pluginId, MemberContactsInfo.UserTypes.General);
            return(View());
        }
コード例 #23
0
        public ActionResult Return(string id, decimal balance)
        {
            id = DecodePaymentId(id);
            string empty = string.Empty;

            try
            {
                Plugin <IPaymentPlugin> plugin                = PluginsManagement.GetPlugin <IPaymentPlugin>(id);
                PaymentInfo             paymentInfo           = plugin.Biz.ProcessReturn(base.HttpContext.Request);
                ICashDepositsService    cashDepositsService   = ServiceHelper.Create <ICashDepositsService>();
                CashDepositDetailInfo   cashDepositDetailInfo = new CashDepositDetailInfo();
                if ((Cache.Get(CacheKeyCollection.PaymentState(string.Join <long>(",", paymentInfo.OrderIds))) == null ? true : false))
                {
                    cashDepositDetailInfo.AddDate     = DateTime.Now;
                    cashDepositDetailInfo.Balance     = balance;
                    cashDepositDetailInfo.Description = "保证金充值";
                    cashDepositDetailInfo.Operator    = base.CurrentSellerManager.UserName;
                    List <CashDepositDetailInfo> cashDepositDetailInfos = new List <CashDepositDetailInfo>()
                    {
                        cashDepositDetailInfo
                    };
                    if (cashDepositsService.GetCashDepositByShopId(base.CurrentSellerManager.ShopId) != null)
                    {
                        cashDepositDetailInfo.CashDepositId = cashDepositsService.GetCashDepositByShopId(base.CurrentSellerManager.ShopId).Id;
                        ServiceHelper.Create <ICashDepositsService>().AddCashDepositDetails(cashDepositDetailInfo);
                    }
                    else
                    {
                        CashDepositInfo cashDepositInfo = new CashDepositInfo()
                        {
                            CurrentBalance           = balance,
                            Date                     = DateTime.Now,
                            ShopId                   = base.CurrentSellerManager.ShopId,
                            TotalBalance             = balance,
                            EnableLabels             = true,
                            Himall_CashDepositDetail = cashDepositDetailInfos
                        };
                        cashDepositsService.AddCashDeposit(cashDepositInfo);
                    }
                    string str = CacheKeyCollection.PaymentState(string.Join <long>(",", paymentInfo.OrderIds));
                    Cache.Insert(str, true);
                }
            }
            catch (Exception exception)
            {
                empty = exception.Message;
            }
            ViewBag.Error = empty;
            ViewBag.Logo  = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings().Logo;
            return(View());
        }
コード例 #24
0
        public JsonResult Enable(string pluginId, MessageTypeEnum messageType, bool enable)
        {
            Plugin <IMessagePlugin> plugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            if (!enable)
            {
                plugin.Biz.Disable(messageType);
            }
            else
            {
                plugin.Biz.Enable(messageType);
            }
            return(Json(new { success = true }));
        }
コード例 #25
0
        /// <summary>
        /// 发送短信,根据搜索条件
        /// </summary>
        /// <param name="query"></param>
        /// <param name="couponIds"></param>
        public static void SendMsg(MemberPowerQuery query, string sendCon, string labelinfos = "会员分组")
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>("Himall.Plugin.Message.SMS");
            int result        = 0;

            //循环执行发送
            for (int i = 0; i < int.MaxValue; i++)
            {
                query.PageNo   = i + 1;
                query.PageSize = 1000;
                var members = MemberApplication.GetPurchasingPowerMember(query);

                string[]      dests  = members.Models.Select(e => e.CellPhone).ToArray();
                List <string> phones = new List <string>();
                foreach (var dest in dests)
                {
                    if (messagePlugin.Biz.CheckDestination(dest))
                    {
                        phones.Add(dest);
                        result++;
                    }
                }

                messagePlugin.Biz.SendMessages(phones.ToArray(), sendCon);

                if (members.Models.Count == 0)
                {
                    break;
                }
            }

            //记录发送历史
            if (result > 0)
            {
                var sendRecord = new Himall.Model.SendMessageRecordInfo
                {
                    ContentType = Himall.CommonModel.WXMsgType.wxcard,
                    MessageType = Himall.CommonModel.MsgType.Coupon,
                    SendContent = "",
                    SendState   = 1,
                    SendTime    = DateTime.Now,
                    ToUserLabel = labelinfos                     //"会员分组"
                };
                WXMsgTemplateApplication.AddSendRecord(sendRecord);
            }
            else
            {
                throw new HimallException("此标签下无符发送的会员;");
            }
        }
コード例 #26
0
        public ActionResult ReBindStep2(string pluginId, string key)
        {
            if (Core.Cache.Get <string>("Rebind" + key) != "step2")
            {
                RedirectToAction("ReBind", new { pluginId = pluginId });
            }
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            ViewBag.ShortName   = messagePlugin.Biz.ShortName;
            ViewBag.id          = pluginId;
            ViewBag.ContactInfo = _iMessageService.GetDestination(CurrentUser.Id, pluginId, Entities.MemberContactInfo.UserTypes.General);
            ViewBag.Keyword     = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword;
            ViewBag.Keywords    = SiteSettings.HotKeyWords;
            return(View());
        }
コード例 #27
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());
        }
コード例 #28
0
        public ActionResult ChargeSuccess(string id)
        {
            Log.Info("pluginId:" + id);
            Plugin <IPaymentPlugin> plugin = PluginsManagement.GetPlugin <IPaymentPlugin>(id.Replace("-", "."));
            PaymentInfo             info   = plugin.Biz.ProcessNotify(base.HttpContext.Request);

            if (info != null)
            {
                long chargeDetailId = info.OrderIds.FirstOrDefault <long>();
                Log.Info("chargeApplyId:" + chargeDetailId);
                MemberCapitalApplication.ChargeSuccess(chargeDetailId);
                string content = plugin.Biz.ConfirmPayResult();
                return(base.Content(content));
            }
            Log.Info("payInfo:为空");
            return(base.Content(string.Empty));
        }
コード例 #29
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));
        }
コード例 #30
0
        public void SendMessageCode(string destination, string pluginId, Core.Plugins.Message.MessageUserInfo info)
        {
            var messagePlugin = PluginsManagement.GetPlugin <IMessagePlugin>(pluginId);

            if (string.IsNullOrEmpty(destination) || !messagePlugin.Biz.CheckDestination(destination))
            {
                throw new HimallException(messagePlugin.Biz.ShortName + "错误");
            }
            var content = messagePlugin.Biz.SendMessageCode(destination, info);

            if (messagePlugin.Biz.EnableLog)
            {
                Context.MessageLog.Add(new MessageLog()
                {
                    SendTime = DateTime.Now, ShopId = 0, MessageContent = content, TypeId = "短信"
                });
                Context.SaveChanges();
            }
        }