Пример #1
0
        /// <summary>
        /// 个人入驻商家信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Steps1()
        {
            long   CompanyRegionId         = 0;
            long   BusinessLicenceRegionId = 0;
            string RefuseReason            = "";
            var    step1 = ShopApplication.GetShopProfileSteps1(CurrentSellerManager.ShopId, out CompanyRegionId, out BusinessLicenceRegionId, out RefuseReason);

            ViewBag.CompanyRegionIds         = RegionApplication.GetRegionPath((int)CompanyRegionId);
            ViewBag.BusinessLicenceRegionIds = RegionApplication.GetRegionPath((int)BusinessLicenceRegionId);
            ViewBag.RefuseReason             = RefuseReason;

            long uid = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            //管理员信息
            var model = MemberApplication.GetMembers(uid);

            step1.RealName = model.RealName;
            Mall.DTO.MemberAccountSafety mMemberAccountSafety = MemberApplication.GetMemberAccountSafety(uid);
            step1.MemberEmail = mMemberAccountSafety.Email;
            step1.MemberPhone = mMemberAccountSafety.Phone;

            //温馨提示
            ModelState.AddModelError("Phone", "多个联系方式用,号分隔");
            ModelState.AddModelError("ContactPhone", "多个联系方式用,号分隔");
            return(View(step1));
        }
Пример #2
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));
        }
Пример #3
0
        public JsonResult DetailList(long id, int page = 1, int rows = 20)
        {
            var result  = _iBonusService.GetDetail(id, page, rows);
            var members = MemberApplication.GetMembers(result.Models.Where(p => p.UserId.HasValue).Select(p => p.UserId.Value).ToList());
            var datas   = result.Models.Select(item =>
            {
                var username = string.Empty;
                if (item.UserId.HasValue)
                {
                    username = members.FirstOrDefault(p => p.Id == item.UserId)?.UserName ?? string.Empty;
                }
                return(new BonusReceiveModel()
                {
                    OpenId = item.OpenId,
                    Price = item.Price,
                    ReceiveTime = item.ReceiveTime == null ? "" : ((DateTime)item.ReceiveTime).ToString("yyyy-MM-dd"),
                    UserName = username,
                    IsTransformedDeposit = item.IsTransformedDeposit
                });
            }).ToList();
            var model = new DataGridModel <BonusReceiveModel> {
                rows = datas, total = result.Total
            };

            return(Json(model));
        }
Пример #4
0
        /// <summary>
        /// 会员详情页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult MemberDetail(long id)
        {
            var member = MemberApplication.GetMembers(id);
            var model  = new MemberViewModels.MemberDetail();

            member.Map(model);

            return(View(model));
        }
Пример #5
0
        /// <summary>
        /// 获取评价
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetComments([FromUri] ProductCommentQuery query)
        {
            if (query.PageNo == 0)
            {
                query.PageNo = 1;
            }
            if (query.PageSize == 0)
            {
                query.PageSize = 5;
            }
            var data = CommentApplication.GetProductComments(query);

            AutoMapper.Mapper.CreateMap <ProductComment, HomeGetCommentListModel>();
            var datalist = Mapper.Map <List <ProductComment>, List <HomeGetCommentListModel> >(data.Models);
            var users    = MemberApplication.GetMembers(datalist.Select(d => d.UserId).ToList());
            var products = ProductManagerApplication.GetAllProductByIds(datalist.Select(d => d.ProductId).ToList());

            //补充数据信息
            foreach (var item in datalist)
            {
                var u       = users.FirstOrDefault(d => d.Id == item.UserId);
                var product = products.FirstOrDefault(d => d.Id == item.ProductId);
                if (u != null)
                {
                    item.UserPhoto = Himall.Core.HimallIO.GetRomoteImagePath(u.Photo);
                }
                if (product != null)
                {
                    item.ProductName = product.ProductName;
                }
                //规格
                var sku = ProductManagerApplication.GetSKU(item.SkuId);
                if (sku != null)
                {
                    List <string> skucs = new List <string>();
                    if (!string.IsNullOrWhiteSpace(sku.Color))
                    {
                        skucs.Add(sku.Color);
                    }
                    if (!string.IsNullOrWhiteSpace(sku.Size))
                    {
                        skucs.Add(sku.Size);
                    }
                    if (!string.IsNullOrWhiteSpace(sku.Version))
                    {
                        skucs.Add(sku.Version);
                    }
                    item.SKU = string.Join("+", skucs);
                }
                foreach (var pitem in item.Images)
                {
                    pitem.CommentImage = HimallIO.GetRomoteImagePath(pitem.CommentImage);
                }
            }
            return(JsonResult <dynamic>(new { total = data.Total, rows = datalist }));
        }
Пример #6
0
        public JsonResult EditProfiles1(ShopProfileSteps1 shopProfileStep1)
        {
            //公司信息
            Cache.Remove(CacheKeyCollection.CACHE_SHOP(CurrentSellerManager.ShopId, false));
            Cache.Remove(CacheKeyCollection.CACHE_SHOPDTO(CurrentSellerManager.ShopId, false));
            Himall.DTO.Shop shopInfo = ShopApplication.GetShop(CurrentSellerManager.ShopId);
            shopInfo.Id                   = CurrentSellerManager.ShopId;
            shopInfo.CompanyName          = shopProfileStep1.CompanyName;
            shopInfo.CompanyAddress       = shopProfileStep1.Address;
            shopInfo.CompanyRegionId      = shopProfileStep1.CityRegionId;
            shopInfo.CompanyRegionAddress = shopProfileStep1.Address;
            shopInfo.Stage                = ShopInfo.ShopStage.FinancialInfo;
            shopInfo.BusinessLicenseCert  = Request.Form["BusinessLicenseCert"];
            shopInfo.ProductCert          = Request.Form["ProductCert"];
            shopInfo.OtherCert            = Request.Form["OtherCert"];
            shopInfo.IDCard               = shopProfileStep1.IDCard;
            shopInfo.IDCardUrl            = shopProfileStep1.IDCardUrl;
            shopInfo.IDCardUrl2           = shopProfileStep1.IDCardUrl2;
            ShopApplication.UpdateShop(shopInfo);

            long uid = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            //管理员信息
            var model = MemberApplication.GetMemberAccountSafety(uid);

            if (shopProfileStep1.MemberPhone.Equals(""))
            {
                return(Json(new { success = false, msg = "必须认证手机!" }));
            }

            //修改真实姓名
            var member = MemberApplication.GetMembers(uid);

            member.RealName = shopProfileStep1.RealName;
            MemberApplication.UpdateMember(member);

            if (shopProfileStep1.MemberPhone != null && !shopProfileStep1.MemberPhone.Equals(model.Phone))
            {
                string pluginId = "Himall.Plugin.Message.SMS";
                int    result   = MemberApplication.CheckMemberCode(pluginId, shopProfileStep1.PhoneCode, shopProfileStep1.MemberPhone, uid);
                string strMsg   = "";
                switch (result)
                {
                case 0: strMsg = "手机验证码错误!"; break;

                case -1: strMsg = "此手机号已绑定!"; break;
                }
                if (!strMsg.Equals(""))
                {
                    return(Json(new { success = false, msg = strMsg }));
                }
            }
            return(Json(new { success = true, msg = "成功!" }));
        }
Пример #7
0
        public JsonResult SendCode(string pluginId, string destination)
        {
            long uid    = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            var  member = MemberApplication.GetMembers(uid);
            var  status = MemberApplication.SendMemberCode(pluginId, destination, member.UserName, SiteSettings.SiteName);
            bool result = status == SendMemberCodeReturn.success;

            return(Json(new Result()
            {
                success = result, msg = status.ToDescription()
            }));
        }
Пример #8
0
        public ActionResult SendPhoneCode(string pluginId, string destination)
        {
            long uid   = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            var  model = MemberApplication.GetMembers(uid);

            Himall.CommonModel.SendMemberCodeReturn status = MemberApplication.SendMemberCode(pluginId, destination, model.UserName, SiteSettings.SiteName);

            bool bo = status.Equals(Himall.CommonModel.SendMemberCodeReturn.success);

            return(Json(new Result()
            {
                success = bo, msg = status.ToDescription()
            }));
        }
Пример #9
0
 public JsonResult Edit5(string RealName)
 {
     if (!RealName.Equals(""))
     {
         long uid    = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
         var  member = MemberApplication.GetMembers(uid);
         member.RealName = RealName;
         MemberApplication.UpdateMember(member);
         return(Json(new { success = true }));
     }
     else
     {
         return(Json(new { success = false, msg = "真实姓名不能为空" }));
     }
 }
Пример #10
0
        public ActionResult SendCode(string pluginId, string destination)
        {
            long uid   = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            var  model = MemberApplication.GetMembers(uid);

            if (!MemberApplication.SendCode(pluginId, destination, model.UserName, SiteSettings.SiteName))
            {
                return(Json(new Result()
                {
                    success = false, msg = "120秒内只允许请求一次,请稍后重试!"
                }));
            }
            return(Json(new Result()
            {
                success = true, msg = "发送成功"
            }));
        }
Пример #11
0
        /// <summary>
        /// 个人或企业账户信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Step3()
        {
            var modelShop = ShopApplication.GetShop(CurrentSellerManager.ShopId);

            #region 个人/企业信息
            long   companyRegionId         = 0;
            long   businessLicenceRegionId = 0;
            string refuseReason            = "";
            if (modelShop.BusinessType.Equals(Himall.CommonModel.ShopBusinessType.Personal))
            {
                var step1 = ShopApplication.GetShopProfileSteps1(CurrentSellerManager.ShopId, out companyRegionId, out businessLicenceRegionId, out refuseReason);
                ViewBag.CompanyRegionIds = RegionApplication.GetRegionPath((int)companyRegionId);
                ViewBag.RefuseReason     = refuseReason;
                ViewBag.fullName         = RegionApplication.GetFullName((int)companyRegionId);

                long uid   = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
                var  model = MemberApplication.GetMembers(uid);
                step1.RealName = model.RealName;
                Himall.DTO.MemberAccountSafety mMemberAccountSafety = MemberApplication.GetMemberAccountSafety(uid);
                step1.MemberEmail = mMemberAccountSafety.Email;
                step1.MemberPhone = mMemberAccountSafety.Phone;

                ModelState.AddModelError("Phone", "多个联系方式用,号分隔");
                ModelState.AddModelError("ContactPhone", "多个联系方式用,号分隔");
                return(View("Steps3", step1));
            }
            else
            {
                var step1 = ShopApplication.GetShopProfileStep1(CurrentSellerManager.ShopId, out companyRegionId, out businessLicenceRegionId, out refuseReason);
                ViewBag.CompanyRegionIds = RegionApplication.GetRegionPath((int)companyRegionId);
                ViewBag.RefuseReason     = refuseReason;
                ViewBag.fullName         = RegionApplication.GetFullName((int)companyRegionId);

                long uid   = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
                var  model = MemberApplication.GetMembers(uid);
                step1.RealName = model.RealName;
                Himall.DTO.MemberAccountSafety mMemberAccountSafety = MemberApplication.GetMemberAccountSafety(uid);
                step1.MemberEmail = mMemberAccountSafety.Email;
                step1.MemberPhone = mMemberAccountSafety.Phone;

                ModelState.AddModelError("Phone", "多个联系方式用,号分隔");
                ModelState.AddModelError("ContactPhone", "多个联系方式用,号分隔");
                return(View(step1));
            }
            #endregion
        }
Пример #12
0
        /// <summary>
        /// 验证码验证,认证管理员
        /// </summary>
        /// <param name="pluginId">信息类别</param>
        /// <param name="code">验证码</param>
        /// <param name="destination">联系号码</param>
        /// <param name="userId">会员ID</param>
        /// <returns></returns>
        public static int CheckShopCode(string pluginId, string code, string destination, long userId)
        {
            var member    = MemberApplication.GetMembers(userId);
            int result    = 0;
            var cache     = CacheKeyCollection.MemberPluginCheck(member.UserName, pluginId + destination);
            var cacheCode = Core.Cache.Get <string>(cache);

            if (cacheCode != null && cacheCode == code)
            {
                if (MessageApplication.GetMemberContactsInfo(pluginId, destination, Entities.MemberContactInfo.UserTypes.General) != null)
                {
                    result = -1;
                }
                else
                {
                    if (pluginId.ToLower().Contains("email"))
                    {
                        member.Email = destination;
                    }
                    else if (pluginId.ToLower().Contains("sms"))
                    {
                        member.CellPhone = destination;
                    }

                    MemberApplication.UpdateMember(member);

                    MessageApplication.UpdateMemberContacts(new Entities.MemberContactInfo()
                    {
                        Contact         = destination,
                        ServiceProvider = pluginId,
                        UserId          = userId,
                        UserType        = Entities.MemberContactInfo.UserTypes.General
                    });

                    Core.Cache.Remove(CacheKeyCollection.MemberPluginCheck(member.UserName, pluginId));
                    Core.Cache.Remove(CacheKeyCollection.Member(userId));//移除用户缓存
                    Core.Cache.Remove("Rebind" + userId);
                    result = 1;
                }
            }
            return(result);
        }
Пример #13
0
        /// <summary>
        /// 发送优惠券
        /// </summary>
        /// <param name="labelids">发送标签</param>
        /// <param name="labelinfos">标签名称</param>
        /// <param name="couponIds">优惠券名称</param>
        /// <returns>-1:优惠券不足;-2:请选择发送的优惠券;-3:标签中用户数为0</returns>
        public static string SendCouponMsg(string labelids, string labelinfos, string couponIds, string url)
        {
            var    messageEmali = PluginsManagement.GetPlugin <IMessagePlugin>("Mall.Plugin.Message.Email");
            var    messageSMS   = PluginsManagement.GetPlugin <IMessagePlugin>("Mall.Plugin.Message.SMS");
            string result       = "";

            if (!couponIds.TrimEnd(',').Equals(""))
            {
                //取出标签对应的会员信息
                long[] lids = string.IsNullOrWhiteSpace(labelids) ? null : labelids.Split(',').Select(s => long.Parse(s)).ToArray();
                int    pageNo = 1, pageSize = 100;
                var    pageMode = MemberApplication.GetMembers(new MemberQuery
                {
                    Labels   = lids,
                    PageNo   = pageNo,
                    PageSize = pageSize
                });
                if (pageMode.Total > 0)
                {
                    List <Mall.Entities.MemberInfo> mUserMember = new List <Mall.Entities.MemberInfo>();
                    while (pageMode.Models.Count() > 0)//循环批量获取用户信息
                    {
                        string[] dests = pageMode.Models.Select(e => e.Email).ToArray();
                        foreach (var item in pageMode.Models)
                        {
                            mUserMember.Add(item);
                        }
                        pageNo  += 1;
                        pageMode = MemberApplication.GetMembers(new MemberQuery
                        {
                            Labels   = lids,
                            PageNo   = pageNo,
                            PageSize = pageSize
                        });
                    }

                    string[] arrStr       = couponIds.TrimEnd(',').Split(',');
                    long[]   arrcouponIds = arrStr.Select(a => long.Parse(a)).ToArray();

                    var model = Service.GetCouponInfo(arrcouponIds);//获取所选优惠券集合

                    //查询优惠券领取状况
                    var mCouponRecord = Service.GetCouponRecordTotal(arrcouponIds);

                    decimal price = 0;
                    List <SendmessagerecordCouponInfo>   lsendInfo = new List <SendmessagerecordCouponInfo>();
                    List <SendmessagerecordCouponSNInfo> lsendSN   = new List <SendmessagerecordCouponSNInfo>();
                    var records = Service.GetRecordCountByCoupon(model.Select(p => p.Id).ToList());
                    //验证优惠券是否充足
                    foreach (var item in model)
                    {
                        price += item.Price;
                        lsendInfo.Add(new SendmessagerecordCouponInfo()
                        {
                            CouponId = item.Id
                        });
                        var record = records.ContainsKey(item.Id) ? records[item.Id] : 0;
                        if (item.Num - record < mUserMember.Count)
                        {
                            result = item.CouponName + "优惠券的数量不足,无法赠送";
                            break;
                        }
                    }
                    var siteName = SiteSettingApplication.SiteSettings.SiteName;
                    if (result == "")
                    {
                        //发送优惠券
                        bool alTotal = false;
                        for (int i = 0; i < mUserMember.Count; i++)
                        {
                            bool suTotal = false;//会员发送优惠券成功数
                            foreach (var item in model)
                            {
                                //判断会员领取限制,是否可领取此优惠券
                                bool isf = true;
                                if (item.PerMax > 0)
                                {
                                    int total = mCouponRecord.Where(p => p.UserId == mUserMember[i].Id && p.CouponId == item.Id).ToList().Count;
                                    if (item.PerMax <= total)
                                    {
                                        isf = false;
                                    }
                                }

                                if (isf)
                                {
                                    suTotal = true;
                                    alTotal = true;

                                    CouponRecordInfo info = new CouponRecordInfo();
                                    info.UserId   = mUserMember[i].Id;
                                    info.UserName = mUserMember[i].UserName;
                                    info.ShopId   = item.ShopId;
                                    info.CouponId = item.Id;
                                    var couponRecord = Service.AddCouponRecord(info);
                                    lsendSN.Add(new SendmessagerecordCouponSNInfo()
                                    {
                                        CouponSN = couponRecord.CounponSN
                                    });
                                }
                            }

                            if (suTotal)
                            {
                                MessageCouponInfo info = new MessageCouponInfo();
                                info.Money    = price;
                                info.SiteName = siteName;
                                info.UserName = mUserMember[i].UserName;
                                MessageApplication.SendMessageOnCouponSuccess(mUserMember[i].Id, info);
                            }
                        }

                        Log.Debug("sendCoupon:" + alTotal);
                        //查看成功发送会员数
                        if (alTotal)
                        {
                            //记录发送历史
                            var sendRecord = new SendMessageRecordInfo
                            {
                                ContentType = WXMsgType.wxcard,
                                MessageType = MsgType.Coupon,
                                SendContent = "",
                                SendState   = 1,
                                SendTime    = DateTime.Now,
                                ToUserLabel = labelinfos ?? "",
                            };
                            WXMsgTemplateApplication.AddSendRecord(sendRecord, lsendInfo);
                            foreach (var item in lsendSN)
                            {
                                item.MessageId = sendRecord.Id;
                            }
                            Service.AddSendmessagerecordCouponSN(lsendSN);
                        }
                        else
                        {
                            result = "此标签下无符合领取此优惠券的会员";
                        }
                    }
                }
                else
                {
                    result = "该标签下无任何会员";
                }
            }
            else
            {
                result = "请选择发送的优惠券";
            }
            return(result);
        }
Пример #14
0
        public ActionResult ShopDetail()
        {
            //Note:DZY[151010] 有form数据返回,传参暂时不能改
            var shopid = CurrentSellerManager.ShopId;
            var shop   = _iShopService.GetShop(shopid, true);
            var model  = new ShopModel(shop);

            model.BusinessCategory = new List <CategoryKeyVal>();
            foreach (var key in shop.BusinessCategory.Keys)
            {
                model.BusinessCategory.Add(new CategoryKeyVal
                {
                    CommisRate = shop.BusinessCategory[key],
                    Name       = _iCategoryService.GetCategory(key).Name
                });
            }
            ViewBag.CompanyRegionIds    = _iRegionService.GetRegionPath(shop.CompanyRegionId);
            ViewBag.BusinessLicenseCert = shop.BusinessLicenseCert;
            //var model= _iShopService.GetShopBasicInfo(shopid);

            string businessLicenseCerts = "";
            string productCerts         = "";
            string otherCerts           = "";

            for (int i = 0; i < 3; i++)
            {
                if (HimallIO.ExistFile(shop.BusinessLicenseCert + string.Format("{0}.png", i + 1)))
                {
                    businessLicenseCerts += HimallIO.GetImagePath(shop.BusinessLicenseCert + string.Format("{0}.png", i + 1)) + ",";
                }
                else
                {
                    businessLicenseCerts += "null,";
                }
                if (HimallIO.ExistFile(shop.ProductCert + string.Format("{0}.png", i + 1)))
                {
                    productCerts += HimallIO.GetImagePath(shop.ProductCert + string.Format("{0}.png", i + 1)) + ",";
                }
                else
                {
                    productCerts += "null,";
                }
                if (HimallIO.ExistFile(shop.OtherCert + string.Format("{0}.png", i + 1)))
                {
                    otherCerts = HimallIO.GetImagePath(shop.OtherCert + string.Format("{0}.png", i + 1)) + ",";
                }
                else
                {
                    otherCerts += "null,";
                }
            }
            ViewBag.BusinessLicenseCerts = businessLicenseCerts.TrimEnd(',');
            ViewBag.ProductCerts         = productCerts.TrimEnd(',');
            ViewBag.OtherCerts           = otherCerts.TrimEnd(',');

            //管理员信息
            long uid   = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            var  mUser = MemberApplication.GetMembers(uid);

            ViewBag.RealName = mUser.RealName;
            Himall.DTO.MemberAccountSafety mMemberAccountSafety = MemberApplication.GetMemberAccountSafety(uid);
            ViewBag.MemberEmail = mMemberAccountSafety.Email;
            ViewBag.MemberPhone = mMemberAccountSafety.Phone;

            if (model.BusinessType.Equals(Himall.CommonModel.ShopBusinessType.Enterprise))
            {
                return(View(model));
            }
            else
            {
                return(View("ShopPersonalDetail", model));
            }
        }
Пример #15
0
        public JsonResult EditProfiles1(ShopProfileSteps1 shopProfileStep1)
        {
            //公司信息
            Mall.DTO.Shop shopInfo = ShopApplication.GetShop(CurrentSellerManager.ShopId);
            shopInfo.Id                   = CurrentSellerManager.ShopId;
            shopInfo.CompanyName          = shopProfileStep1.CompanyName;
            shopInfo.CompanyAddress       = shopProfileStep1.Address;
            shopInfo.CompanyRegionId      = shopProfileStep1.CityRegionId;
            shopInfo.CompanyRegionAddress = shopProfileStep1.Address;
            shopInfo.Stage                = Entities.ShopInfo.ShopStage.CompanyInfo;
            shopInfo.BusinessLicenseCert  = Request.Form["BusinessLicenseCert"];
            shopInfo.ProductCert          = Request.Form["ProductCert"];
            shopInfo.OtherCert            = Request.Form["OtherCert"];
            shopInfo.IDCard               = shopProfileStep1.IDCard;
            shopInfo.IDCardUrl            = shopProfileStep1.IDCardUrl;
            shopInfo.IDCardUrl2           = shopProfileStep1.IDCardUrl2;

            ShopApplication.UpdateShop(shopInfo);

            long uid = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            //管理员信息
            var mTheme = ShopApplication.GetSettled();
            var model  = MemberApplication.GetMemberAccountSafety(uid);

            if (!mTheme.SelfVerificationType.Equals(Mall.CommonModel.VerificationType.VerifyEmail) && shopProfileStep1.MemberPhone.Equals(""))
            {
                return(Json(new { success = false, msg = "必须认证手机!" }));
            }
            if (!mTheme.SelfVerificationType.Equals(Mall.CommonModel.VerificationType.VerifyPhone) && shopProfileStep1.MemberEmail.Equals(""))
            {
                return(Json(new { success = false, msg = "必须认证邮箱!" }));
            }

            //修改真实姓名
            var member = MemberApplication.GetMembers(uid);

            member.RealName = shopProfileStep1.RealName;
            MemberApplication.UpdateMember(member);

            //手机认证
            if (shopProfileStep1.MemberPhone != null && !shopProfileStep1.MemberPhone.Equals(model.Phone))
            {
                string pluginId = "Mall.Plugin.Message.SMS";
                int    result   = MemberApplication.CheckMemberCode(pluginId, shopProfileStep1.PhoneCode, shopProfileStep1.MemberPhone, uid);
                string strMsg   = "";
                switch (result)
                {
                case 0: strMsg = "手机验证码错误!"; break;

                case -1: strMsg = "此手机号已绑定!"; break;
                }
                if (!strMsg.Equals(""))
                {
                    return(Json(new { success = false, msg = strMsg }));
                }
            }

            //邮箱认证
            if (shopProfileStep1.MemberEmail != null && !shopProfileStep1.MemberEmail.ToString().Equals(model.Email))
            {
                string pluginId = "Mall.Plugin.Message.Email";
                int    result   = MemberApplication.CheckMemberCode(pluginId, shopProfileStep1.EmailCode, shopProfileStep1.MemberEmail, uid);
                string strMsg   = "";
                switch (result)
                {
                case 0: strMsg = "邮箱验证码错误!"; break;

                case -1: strMsg = "此邮箱已绑定!"; break;
                }
                if (!strMsg.Equals(""))
                {
                    return(Json(new { success = false, msg = strMsg }));
                }
            }


            ShopApplication.SetShopStage(Entities.ShopInfo.ShopStage.FinancialInfo, CurrentSellerManager.ShopId);//设置成功,则才是进入财务信息
            return(Json(new { success = true, msg = "成功!" }));
        }
Пример #16
0
        public JsonResult EditProfile1(ShopProfileStep1 shopProfileStep1)
        {
            if (ShopApplication.ExistCompanyName(shopProfileStep1.CompanyName, CurrentSellerManager.ShopId))
            {
                return(Json(new { success = false, msg = "该公司名已存在!" }));
            }
            if (ShopApplication.ExistBusinessLicenceNumber(shopProfileStep1.BusinessLicenceNumber, CurrentSellerManager.ShopId))
            {
                return(Json(new { success = false, msg = "该营业执照号已存在!" }));
            }

            //公司信息
            Mall.DTO.Shop shopInfo = ShopApplication.GetShop(CurrentSellerManager.ShopId);
            shopInfo.Id                         = CurrentSellerManager.ShopId;
            shopInfo.CompanyName                = shopProfileStep1.CompanyName;
            shopInfo.CompanyAddress             = shopProfileStep1.Address;
            shopInfo.CompanyRegionId            = shopProfileStep1.CityRegionId;
            shopInfo.CompanyRegionAddress       = shopProfileStep1.Address;
            shopInfo.CompanyPhone               = shopProfileStep1.Phone;
            shopInfo.CompanyEmployeeCount       = shopProfileStep1.EmployeeCount;
            shopInfo.CompanyRegisteredCapital   = shopProfileStep1.RegisterMoney;
            shopInfo.ContactsName               = shopProfileStep1.ContactName;
            shopInfo.ContactsPhone              = shopProfileStep1.ContactPhone;
            shopInfo.ContactsEmail              = shopProfileStep1.Email;
            shopInfo.BusinessLicenceNumber      = shopProfileStep1.BusinessLicenceNumber;
            shopInfo.BusinessLicenceRegionId    = shopProfileStep1.BusinessLicenceArea;
            shopInfo.BusinessLicenceStart       = shopProfileStep1.BusinessLicenceValidStart;
            shopInfo.BusinessLicenceEnd         = shopProfileStep1.BusinessLicenceValidEnd;
            shopInfo.BusinessSphere             = shopProfileStep1.BusinessSphere;
            shopInfo.BusinessLicenceNumberPhoto = shopProfileStep1.BusinessLicenceNumberPhoto;
            shopInfo.OrganizationCode           = shopProfileStep1.OrganizationCode;
            shopInfo.OrganizationCodePhoto      = shopProfileStep1.OrganizationCodePhoto;
            shopInfo.GeneralTaxpayerPhot        = shopProfileStep1.GeneralTaxpayerPhoto;
            shopInfo.Stage                      = Entities.ShopInfo.ShopStage.CompanyInfo;
            shopInfo.BusinessLicenseCert        = Request.Form["BusinessLicenseCert"];
            shopInfo.ProductCert                = Request.Form["ProductCert"];
            shopInfo.OtherCert                  = Request.Form["OtherCert"];
            shopInfo.legalPerson                = shopProfileStep1.legalPerson;
            shopInfo.CompanyFoundingDate        = shopProfileStep1.CompanyFoundingDate;

            ShopApplication.UpdateShop(shopInfo);

            //管理员信息
            long uid    = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            var  mTheme = ShopApplication.GetSettled();
            var  model  = MemberApplication.GetMemberAccountSafety(uid);

            if (!mTheme.CompanyVerificationType.Equals(VerificationType.VerifyEmail) && shopProfileStep1.MemberPhone.Equals(""))
            {
                return(Json(new { success = false, msg = "必须认证手机!" }));
            }
            if (!mTheme.CompanyVerificationType.Equals(Mall.CommonModel.VerificationType.VerifyPhone) && shopProfileStep1.MemberEmail.Equals(""))
            {
                return(Json(new { success = false, msg = "必须认证邮箱!" }));
            }

            //修改真实姓名
            var member = MemberApplication.GetMembers(uid);

            member.RealName = shopProfileStep1.RealName;
            MemberApplication.UpdateMember(member);

            //手机认证
            if (!shopProfileStep1.MemberPhone.Equals(model.Phone))
            {
                string pluginId = "Mall.Plugin.Message.SMS";
                int    result   = MemberApplication.CheckMemberCode(pluginId, shopProfileStep1.PhoneCode, shopProfileStep1.MemberPhone, uid);
                string strMsg   = "";
                switch (result)
                {
                case 0: strMsg = "手机验证码错误!"; break;

                case -1: strMsg = "此手机号已绑定!"; break;
                }
                if (!strMsg.Equals(""))
                {
                    return(Json(new { success = false, msg = strMsg }));
                }
            }

            //邮箱认证
            if (!shopProfileStep1.MemberEmail.Equals(model.Email))
            {
                string pluginId = "Mall.Plugin.Message.Email";
                int    result   = MemberApplication.CheckMemberCode(pluginId, shopProfileStep1.EmailCode, shopProfileStep1.MemberEmail, uid);
                string strMsg   = "";
                switch (result)
                {
                case 0: strMsg = "邮箱验证码错误!"; break;

                case -1: strMsg = "此邮箱已绑定!"; break;
                }
                if (!strMsg.Equals(""))
                {
                    return(Json(new { success = false, msg = strMsg }));
                }
            }

            ShopApplication.SetShopStage(Entities.ShopInfo.ShopStage.FinancialInfo, CurrentSellerManager.ShopId);//设置成功,则才是进入财务信息

            return(Json(new { success = true, msg = "成功!" }));
        }
Пример #17
0
        /// <summary>
        /// 发送优惠券,根据会员ID
        /// </summary>
        /// <param name="userIds">发送对象</param>
        /// <param name="couponIds">优惠券名称</param>
        public static void SendCouponByUserIds(List <long> userIds, IEnumerable <long> couponIds)
        {
            var     model         = Service.GetCouponInfo(couponIds.ToArray());
            var     siteName      = SiteSettingApplication.SiteSettings.SiteName;
            var     mCouponRecord = Service.GetCouponRecordTotal(couponIds.ToArray());
            var     mUserMember   = MemberApplication.GetMembers(userIds);
            decimal price         = 0;
            string  result        = "";
            List <SendmessagerecordCouponInfo> lsendInfo = new List <SendmessagerecordCouponInfo>();
            var records = Service.GetRecordCountByCoupon(model.Select(p => p.Id).ToList());

            //验证优惠券是否充足
            foreach (var item in model)
            {
                price += item.Price;
                lsendInfo.Add(new SendmessagerecordCouponInfo()
                {
                    CouponId = item.Id
                });
                var record = records.ContainsKey(item.Id) ? records[item.Id] : 0;
                if (item.Num - record < mUserMember.Count)
                {
                    result = item.CouponName + "优惠券的数量不足,无法赠送";
                    break;
                }
            }
            if (result == "")
            {
                //发送优惠券
                bool alTotal = false;
                for (int i = 0; i < mUserMember.Count; i++)
                {
                    bool suTotal = false;//会员发送优惠券成功数
                    foreach (var item in model)
                    {
                        //判断会员领取限制,是否可领取此优惠券
                        bool isf = true;
                        if (item.PerMax > 0)
                        {
                            int total = mCouponRecord.Where(p => p.UserId == mUserMember[i].Id && p.CouponId == item.Id).ToList().Count;
                            if (item.PerMax <= total)
                            {
                                isf = false;
                            }
                        }

                        if (isf)
                        {
                            suTotal = true;
                            alTotal = true;

                            CouponRecordInfo info = new CouponRecordInfo();
                            info.UserId   = mUserMember[i].Id;
                            info.UserName = mUserMember[i].UserName;
                            info.ShopId   = item.ShopId;
                            info.CouponId = item.Id;
                            Service.AddCouponRecord(info);
                        }
                    }

                    if (suTotal)
                    {
                        MessageCouponInfo info = new MessageCouponInfo();
                        info.Money    = price;
                        info.SiteName = siteName;
                        info.UserName = mUserMember[i].UserName;
                        MessageApplication.SendMessageOnCouponSuccess(mUserMember[i].Id, info);
                    }
                }

                Log.Debug("sendCoupon:" + alTotal);
                //查看成功发送会员数
                if (alTotal)
                {
                    //记录发送历史
                    var sendRecord = new SendMessageRecordInfo
                    {
                        ContentType = WXMsgType.wxcard,
                        MessageType = MsgType.Coupon,
                        SendContent = "",
                        SendState   = 1,
                        SendTime    = DateTime.Now,
                        ToUserLabel = "",
                    };
                    WXMsgTemplateApplication.AddSendRecord(sendRecord, lsendInfo);
                }
                else
                {
                    result = "无符合领取此优惠券的会员";
                }
            }
            else
            {
                result = "该标签下无任何会员";
            }
            if (!string.IsNullOrWhiteSpace(result))
            {
                throw new MallException(result);
            }
        }