protected override object OnCheckCheckCodeSuccess(string contact) { CheckUserLogin(); string pluginId = PluginsManagement.GetInstalledPluginInfos(Core.Plugins.PluginType.SMS).First().PluginId; var _iMemberIntegralConversionFactoryService = ServiceProvider.Instance <IMemberIntegralConversionFactoryService> .Create; var _iMemberIntegralService = ServiceProvider.Instance <IMemberIntegralService> .Create; var _iMemberInviteService = ServiceProvider.Instance <IMemberInviteService> .Create; var member = CurrentUser; if (Application.MessageApplication.GetMemberContactsInfo(pluginId, contact, Entities.MemberContactInfo.UserTypes.General) != null) { return(new { success = false, msg = contact + "已经绑定过了!" }); } member.CellPhone = contact; MemberApplication.UpdateMember(member.Map <DTO.Members>()); Application.MessageApplication.UpdateMemberContacts(new Entities.MemberContactInfo() { Contact = contact, ServiceProvider = pluginId, UserId = CurrentUser.Id, UserType = Entities.MemberContactInfo.UserTypes.General }); Core.Cache.Remove(CacheKeyCollection.MemberPluginCheck(CurrentUser.UserName, pluginId)); Core.Cache.Remove(CacheKeyCollection.Member(CurrentUser.Id));//移除用户缓存 Core.Cache.Remove("Rebind" + CurrentUser.Id); Entities.MemberInfo inviteMember = MemberApplication.GetMember(member.InviteUserId); var info = new MemberIntegralRecordInfo(); info.UserName = member.UserName; info.MemberId = member.Id; info.RecordDate = DateTime.Now; info.TypeId = MemberIntegralInfo.IntegralType.Reg; info.ReMark = "绑定手机"; var memberIntegral = _iMemberIntegralConversionFactoryService.Create(Himall.Entities.MemberIntegralInfo.IntegralType.Reg); _iMemberIntegralService.AddMemberIntegral(info, memberIntegral); if (inviteMember != null) { _iMemberInviteService.AddInviteIntegel(member, inviteMember, true); } return(base.OnCheckCheckCodeSuccess(contact)); }
/// <summary> /// 申请成为销售员 /// </summary> /// <param name="memberId"></param> /// <param name="shopLogo"></param> /// <param name="shopName"></param> /// <returns></returns> public static DistributorInfo ApplyDistributor(long memberId, string shopLogo, string shopName) { DistributorInfo result = _iDistributionService.GetDistributor(memberId); bool isadd = false; if (result == null) { result = new DistributorInfo(); isadd = true; result.ProductCount = 0; result.OrderCount = 0; result.SettlementAmount = 0; } result.MemberId = memberId; result.ShopLogo = shopLogo; result.IsShowShopLogo = true; result.ShopName = shopName; result.ApplyTime = DateTime.Now; result.DistributionStatus = (int)DistributorStatus.UnAudit; if (!SiteSettingApplication.SiteSettings.DistributorNeedAudit) { result.DistributionStatus = (int)DistributorStatus.Audited; } var gradeId = GetDistributorGrades().OrderByDescending(d => d.Quota).FirstOrDefault(d => d.Quota <= result.SettlementAmount)?.Id; result.GradeId = gradeId ?? 0; if (isadd) { _iDistributionService.AddDistributor(result); } else { _iDistributionService.UpdateDistributor(result); } var uobj = MemberApplication.GetMember(result.MemberId); //发送短信通知 Task.Factory.StartNew(() => { MessageApplication.SendMessageOnDistributorApply(result.MemberId, uobj.UserName); if (result.DistributionStatus == (int)DistributorStatus.Audited) { MessageApplication.SendMessageOnDistributorAuditSuccess(result.MemberId, uobj.UserName); } }); return(result); }
/// <summary> /// 支付提现 /// </summary> public static void PaymentWithdraw(long withdrawId) { var model = Service.GetWithdraw(withdrawId); try { switch (model.WithdrawType) { case DistributionWithdrawType.Alipay: var result = Payment(DistributionWithdrawType.Alipay, model.WithdrawAccount, model.Amount, $"(单号 {withdrawId})", model.Id.ToString(), model.WithdrawName); Service.SuccessWithdraw(withdrawId, result.TradNo.ToString()); break; case DistributionWithdrawType.Capital: var no = MemberCapitalApplication.BrokerageTransfer(model.MemberId, model.Amount, $"(单号 {withdrawId})", model.Id.ToString()); Service.SuccessWithdraw(withdrawId, no.ToString()); break; case DistributionWithdrawType.WeChat: var resultWechat = Payment(DistributionWithdrawType.WeChat, model.WithdrawAccount, model.Amount, $"(单号 {withdrawId})", model.Id.ToString()); Service.SuccessWithdraw(withdrawId, resultWechat.TradNo.ToString()); break; } } catch (Exception ex) { //支付失败(回滚提现状态) Service.FailWithdraw(withdrawId, ex.Message); throw ex; } //发送消息 var member = MemberApplication.GetMember(model.MemberId); var message = new MessageWithDrawInfo(); message.UserName = member != null ? member.UserName : ""; message.Amount = model.Amount; message.ApplyType = model.WithdrawType.GetHashCode(); message.ApplyTime = model.ApplyTime; message.Remark = model.Remark; message.SiteName = SiteSettingApplication.SiteSettings.SiteName; Task.Factory.StartNew(() => ServiceProvider.Instance <IMessageService> .Create.SendMessageOnDistributionMemberWithDrawSuccess(model.MemberId, message)); }
/// <summary> /// 个人中心主页 /// </summary> /// <returns></returns> public new JsonResult <Result <dynamic> > GetUser() { CheckUserLogin(); dynamic d = new System.Dynamic.ExpandoObject(); long id = CurrentUser.Id; var member = MemberApplication.GetMember(id); DistributorInfo currentDistributor = DistributionApplication.GetDistributor(member.Id); d.UserName = member.UserName; //用户名 d.RealName = member.RealName; //真实姓名 d.Nick = member.Nick; //昵称 d.UserId = member.Id.ToString(); d.CellPhone = member.CellPhone; //绑定的手机号码 d.Photo = String.IsNullOrEmpty(member.Photo) ? "" : HimallIO.GetRomoteImagePath(member.Photo); //头像 var statistic = StatisticApplication.GetMemberOrderStatistic(id, true); d.AllOrders = statistic.OrderCount; d.WaitingForPay = statistic.WaitingForPay; d.WaitingForRecieve = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(id); d.WaitingForDelivery = statistic.WaitingForDelivery; d.WaitingForComments = statistic.WaitingForComments; d.RefundOrders = statistic.RefundCount; d.FavoriteShop = ShopApplication.GetUserConcernShopsCount(member.Id); //收藏的店铺数 d.FavoriteProduct = FavoriteApplication.GetFavoriteCountByUser(member.Id); //收藏的商品数 d.Counpon = MemberApplication.GetAvailableCouponCount(id); d.Integral = MemberIntegralApplication.GetAvailableIntegral(member.Id); //我的积分 d.Balance = MemberCapitalApplication.GetBalanceByUserId(member.Id); //我的资产 d.IsOpenRechargePresent = SiteSettingApplication.SiteSettings.IsOpenRechargePresent; var phone = SiteSettingApplication.SiteSettings.SitePhone; d.ServicePhone = string.IsNullOrEmpty(phone) ? "" : phone; d.IsDistributor = (currentDistributor != null && currentDistributor.DistributionStatus == (int)DistributorStatus.Audited); return(JsonResult <dynamic>(d)); }
/// <summary> /// 是否可以申请销售员 /// </summary> /// <returns></returns> public JsonResult CanOpenMyShop() { if (SiteSettings.DistributorApplyNeedQuota > 0) { var _u = MemberApplication.GetMember(CurrentUser.Id); if (_u.NetAmount < SiteSettings.DistributorApplyNeedQuota) { return(Json(new Result { success = false, msg = "需要累计消费金额达到" + SiteSettings.DistributorApplyNeedQuota + "元才可申请哦" })); } } if (CurrentDistributor != null) { if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.NotAvailable) { return(Json(new Result { success = true, msg = "您己经被清退,不可以申请!", code = 12 })); } if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.Audited) { return(Json(new Result { success = true, msg = "您己经是销售员,不可以重复申请!", code = 11 })); } if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.UnAudit) { return(Json(new Result { success = true, msg = "您己经提交销售员申请,请耐心等待!", code = 13 })); } } return(Json(new Result { success = true })); }
public JsonResult List(int page, int rows, string productName, bool?isReply = null, int Rank = -1, bool hasAppend = false) { if (!string.IsNullOrEmpty(productName)) { productName = productName.Trim(); } var orderItemService = _iOrderService; var iTypeService = _iTypeService; var query = new CommentQuery() { PageNo = page, PageSize = rows, HasAppend = hasAppend, ProductName = productName, Rank = Rank, ShopID = base.CurrentSellerManager.ShopId, IsReply = isReply }; var result = _iCommentService.GetComments(query); var orderItemIds = result.Models.Select(a => a.SubOrderId).ToList(); var orderItems = orderItemService.GetOrderItemsByOrderItemId(orderItemIds).ToDictionary(item => item.Id, item => item); var comments = result.Models.Select(item => { var product = ProductManagerApplication.GetProduct(item.ProductId); return(new ProductCommentModel() { CommentContent = item.ReviewContent, CommentDate = item.ReviewDate, ReplyContent = item.ReplyContent, AppendContent = item.AppendContent, AppendDate = item.AppendDate, ReplyAppendDate = item.ReplyAppendDate, CommentMark = item.ReviewMark, ReplyDate = item.ReplyDate, Id = item.Id, ProductName = (product == null) ? "" : product.ProductName, ProductId = item.ProductId, ImagePath = orderItems[item.SubOrderId].ThumbnailsUrl, UserName = item.UserName, OderItemId = item.SubOrderId, Color = "", Version = "", Size = "", UserId = item.UserId }); }).ToList(); //TODO LRL 2015/08/06 从评价信息添加商品的规格信息 foreach (var item in comments) { item.ImagePath = Core.MallIO.GetProductSizeImage(item.ImagePath, 1, (int)ImageSize.Size_100); if (item.OderItemId.HasValue) { var obj = orderItemService.GetOrderItem(item.OderItemId.Value); if (obj != null) { item.Color = obj.Color; item.Size = obj.Size; item.Version = obj.Version; item.OrderId = obj.OrderId; var member = MemberApplication.GetMember(item.UserId); if (member != null) { item.UserName = member.UserName; item.UserPhone = member.CellPhone; } } } Entities.TypeInfo typeInfo = iTypeService.GetTypeByProductId(item.ProductId); item.ColorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; item.SizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; item.VersionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; var productInfo = ProductManagerApplication.GetProduct(item.ProductId); if (productInfo != null) { item.ColorAlias = !string.IsNullOrWhiteSpace(productInfo.ColorAlias) ? productInfo.ColorAlias : item.ColorAlias; item.SizeAlias = !string.IsNullOrWhiteSpace(productInfo.SizeAlias) ? productInfo.SizeAlias : item.SizeAlias; item.VersionAlias = !string.IsNullOrWhiteSpace(productInfo.VersionAlias) ? productInfo.VersionAlias : item.VersionAlias; } } DataGridModel <ProductCommentModel> model = new DataGridModel <ProductCommentModel>() { rows = comments, total = result.Total }; return(Json(model)); }
/// <summary> /// 提交申请销售员 /// </summary> /// <returns></returns> public JsonResult <Result <bool> > PostApplyDistributor(PostSaveShopConfigModel model) { CheckUserLogin(); var sitesettings = SiteSettingApplication.SiteSettings; DistributorInfo currentDistributor = DistributionApplication.GetDistributor(CurrentUser.Id); if (sitesettings.DistributorApplyNeedQuota > 0) { var _u = MemberApplication.GetMember(CurrentUser.Id); if (_u.NetAmount < sitesettings.DistributorApplyNeedQuota) { return(Json(ErrorResult <bool>("需要累计消费金额达到" + sitesettings.DistributorApplyNeedQuota + "元才可申请哦!"))); } } if (currentDistributor == null) { currentDistributor = new DistributorInfo { MemberId = CurrentUser.Id }; } if (string.IsNullOrWhiteSpace(currentDistributor.ShopLogo)) { currentDistributor.ShopLogo = CurrentUser.Photo; } if (string.IsNullOrWhiteSpace(model.logoUrl)) { if (currentDistributor == null || string.IsNullOrWhiteSpace(currentDistributor.ShopLogo)) { return(Json(ErrorResult <bool>("请上传小店logo!"))); } } if (string.IsNullOrWhiteSpace(model.shopName)) { return(Json(ErrorResult <bool>("请填写小店名称!"))); } if (model.shopName.Length > 10) { return(Json(ErrorResult <bool>("小店名称不能超过10个字符!"))); } if (currentDistributor != null) { if (currentDistributor.DistributionStatus == (int)DistributorStatus.NotAvailable) { return(Json(ErrorResult <bool>("您己经被清退,不可以申请!"))); } if (currentDistributor.DistributionStatus == (int)DistributorStatus.Audited) { return(Json(ErrorResult <bool>("您己经是销售员,不可以重复申请!"))); } if (currentDistributor.DistributionStatus == (int)DistributorStatus.UnAudit) { return(Json(ErrorResult <bool>("您己经提交销售员申请,请耐心等待!"))); } } string shoplogo = currentDistributor != null ? currentDistributor.ShopLogo : ""; if (!string.IsNullOrWhiteSpace(model.logoUrl)) { //shoplogo = DownloadWxImage(model.logoWXmediaId); shoplogo = model.logoUrl; } if (string.IsNullOrWhiteSpace(shoplogo)) { return(Json(ErrorResult <bool>("请上传小店logo!"))); } var oldname = Path.GetFileName(shoplogo); string ImageDir = string.Empty; if (!string.IsNullOrWhiteSpace(shoplogo)) { //转移图片 string relativeDir = DISTRIBUTOR_LOGO_PATH; Random ra = new Random(); string fileName = DateTime.Now.ToString("yyyyMMddHHmmssffffff") + ra.Next(4) + ".jpg"; if (shoplogo.Replace("\\", "/").Contains("/temp/"))//只有在临时目录中的图片才需要复制 { var de = shoplogo.Substring(shoplogo.LastIndexOf("/temp/")); Core.HimallIO.CopyFile(de, relativeDir + fileName, true); shoplogo = relativeDir + fileName; } //目标地址 else if (shoplogo.Contains("/Storage")) { shoplogo = shoplogo.Substring(shoplogo.LastIndexOf("/Storage")); } } var d = DistributionApplication.ApplyDistributor(CurrentUser.Id, shoplogo, model.shopName); if (d == null) { return(Json(ErrorResult <bool>("申请失败,系统异常!"))); } if (d.DistributionStatus == (int)DistributorStatus.Audited) { return(JsonResult(true, "申请销售员成功!")); } return(JsonResult(true, "提交销售员申请成功!")); }
public object PostSubmitOrder(GiftConfirmOrderModel value) { CheckUserLogin(); long id = value.ID; var addressId = value.AddressId; if (addressId < 1) { return(Json(ErrorResult <bool>("错误的收货地址!", code: -8))); } int count = value.Count; if (count < 1) { return(Json(ErrorResult <bool>("错误的兑换数量!", code: -8))); } List <GiftOrderItemModel> gorditemlist = new List <GiftOrderItemModel>(); var curUser = MemberApplication.GetMember(CurrentUser.Id); if (curUser == null) { return(Json(ErrorResult <bool>("用户登录错误!", code: -6))); } var userInte = MemberIntegralApplication.GetMemberIntegral(curUser.Id); //礼品信息 var giftdata = GiftApplication.GetById(id); if (giftdata == null) { return(Json(ErrorResult <bool>("礼品不存在!", code: -2))); } if (giftdata.GetSalesStatus != Entities.GiftInfo.GiftSalesStatus.Normal) { return(Json(ErrorResult <bool>("礼品已失效!", code: -2))); } //库存判断 if (count > giftdata.StockQuantity) { return(Json(ErrorResult <bool>("礼品库存不足,仅剩 " + giftdata.StockQuantity.ToString() + " 件!", code: -3))); } //积分数 if (giftdata.NeedIntegral < 1) { return(Json(ErrorResult <bool>("礼品关联等级信息有误或礼品积分数据有误!", code: -5))); } //限购数量 if (giftdata.LimtQuantity > 0) { int ownbuynumber = GiftsOrderApplication.GetOwnBuyQuantity(CurrentUser.Id, id); if (ownbuynumber + count > giftdata.LimtQuantity) { return(Json(ErrorResult <bool>("超过礼品限兑数量!", code: -4))); } } if (giftdata.NeedIntegral * count > userInte.AvailableIntegrals) { return(Json(ErrorResult <bool>("积分不足!", code: -6))); } //等级判定 if (!MemberGradeApplication.IsAllowGrade(CurrentUser.Id, giftdata.NeedGrade)) { return(Json(ErrorResult <bool>("用户等级不足!", code: -6))); } Entities.ShippingAddressInfo shipdata = GetShippingAddress(addressId); if (shipdata == null) { return(Json(ErrorResult <bool>("错误的收货人地址信息!", code: -6))); } gorditemlist.Add(new GiftOrderItemModel { GiftId = giftdata.Id, Counts = count }); GiftOrderModel createorderinfo = new GiftOrderModel(); createorderinfo.Gifts = gorditemlist; createorderinfo.CurrentUser = curUser; createorderinfo.ReceiveAddress = shipdata; var orderdata = GiftsOrderApplication.CreateOrder(createorderinfo); return(Json(new { success = true, msg = orderdata.Id.ToString(), code = 1 })); }
/// <summary> /// 提交申请销售员 /// </summary> /// <returns></returns> public JsonResult PostApplyDistributor(string logoWXmediaId, string shopname) { if (SiteSettings.DistributorApplyNeedQuota > 0) { var _u = MemberApplication.GetMember(CurrentUser.Id); if (_u.NetAmount < SiteSettings.DistributorApplyNeedQuota) { throw new MallException("需要累计消费金额达到" + SiteSettings.DistributorApplyNeedQuota + "元才可申请哦"); } } if (CurrentDistributor == null) { CurrentDistributor = new DistributorInfo { MemberId = CurrentUser.Id }; } if (string.IsNullOrWhiteSpace(CurrentDistributor.ShopLogo)) { CurrentDistributor.ShopLogo = CurrentUser.Photo; } if (string.IsNullOrWhiteSpace(logoWXmediaId)) { if (CurrentDistributor == null || string.IsNullOrWhiteSpace(CurrentDistributor.ShopLogo)) { throw new MallException("请上传小店logo"); } } if (string.IsNullOrWhiteSpace(shopname)) { throw new MallException("请填写小店名称"); } if (shopname.Length > 10) { throw new MallException("小店名称不能超过10个字符"); } if (CurrentDistributor != null) { if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.NotAvailable) { return(Json(new Result { success = true, msg = "您己经被清退,不可以申请!", code = 12 })); } if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.Audited) { return(Json(new Result { success = true, msg = "您己经是销售员,不可以重复申请!", code = 11 })); } if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.UnAudit) { return(Json(new Result { success = true, msg = "您己经提交销售员申请,请耐心等待!", code = 13 })); } } string shoplogo = CurrentDistributor != null ? CurrentDistributor.ShopLogo : ""; if (!string.IsNullOrWhiteSpace(logoWXmediaId)) { shoplogo = DownloadWxImage(logoWXmediaId); } if (string.IsNullOrWhiteSpace(shoplogo)) { throw new MallException("请上传小店logo"); } var oldname = Path.GetFileName(shoplogo); string ImageDir = string.Empty; if (!string.IsNullOrWhiteSpace(shoplogo)) { //转移图片 string relativeDir = DISTRIBUTOR_LOGO_PATH; Random ra = new Random(); string fileName = DateTime.Now.ToString("yyyyMMddHHmmssffffff") + ra.Next(4) + ".jpg"; if (shoplogo.Replace("\\", "/").Contains("/temp/"))//只有在临时目录中的图片才需要复制 { var de = shoplogo.Substring(shoplogo.LastIndexOf("/temp/")); Core.MallIO.CopyFile(de, relativeDir + fileName, true); shoplogo = relativeDir + fileName; } //目标地址 else if (shoplogo.Contains("/Storage")) { shoplogo = shoplogo.Substring(shoplogo.LastIndexOf("/Storage")); } } var d = DistributionApplication.ApplyDistributor(CurrentUser.Id, shoplogo, shopname); if (d == null) { return(Json(new Result { success = false, msg = "申请失败,系统异常!", code = 41 })); } if (d.DistributionStatus == (int)DistributorStatus.Audited) { return(Json(new Result { success = true, msg = "申请销售员成功!" })); } return(Json(new Result { success = true, msg = "提交销售员申请成功!", code = 21 })); }
private List <OrderRefundApiModel> FullModel(List <OrderRefund> refunds) { var orders = Application.OrderApplication.GetOrders(refunds.Select(p => p.OrderId)); var orderItems = Application.OrderApplication.GetOrderItemsByOrderId(refunds.Select(p => p.OrderId)); var result = refunds.Select(item => { var orditems = new List <DTO.OrderItem>(); var order = orders.FirstOrDefault(o => o.Id == item.OrderId); if (item.RefundMode == OrderRefundInfo.OrderRefundMode.OrderRefund) { orditems = orderItems.Where(d => d.OrderId == item.OrderId).ToList(); } else { orditems.Add(orderItems.FirstOrDefault(oi => oi.Id == item.OrderItemId)); } foreach (var orderItem in orditems) { orderItem.ThumbnailsUrl = MallIO.GetRomoteProductSizeImage(orderItem.ThumbnailsUrl, 1, (int)Mall.CommonModel.ImageSize.Size_100); Entities.TypeInfo typeInfo = ServiceProvider.Instance <ITypeService> .Create.GetTypeByProductId(orderItem.ProductId); orderItem.ColorAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias; orderItem.SizeAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias; orderItem.VersionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias; var productInfo = ProductManagerApplication.GetProduct(orderItem.ProductId); if (productInfo != null) { orderItem.ColorAlias = !string.IsNullOrWhiteSpace(productInfo.ColorAlias) ? productInfo.ColorAlias : orderItem.ColorAlias; orderItem.SizeAlias = !string.IsNullOrWhiteSpace(productInfo.SizeAlias) ? productInfo.SizeAlias : orderItem.SizeAlias; orderItem.VersionAlias = !string.IsNullOrWhiteSpace(productInfo.VersionAlias) ? productInfo.VersionAlias : orderItem.VersionAlias; } } var member = MemberApplication.GetMember(order.UserId); var model = new OrderRefundApiModel(); item.Map(model); model.Status = item.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited ? (int)item.ManagerConfirmStatus : (int)item.SellerAuditStatus; model.StatusDescription = item.SellerAuditStatus == OrderRefundInfo.OrderRefundAuditStatus.Audited ? item.ManagerConfirmStatus.ToDescription() : (order.ShopBranchId > 0 ? ((CommonModel.Enum.OrderRefundShopAuditStatus)item.SellerAuditStatus).ToDescription() : item.SellerAuditStatus.ToDescription()); model.StatusDescription = model.StatusDescription.Replace("商家", "门店"); model.RefundStatus = model.RefundStatus.Replace("商家", "门店"); //model.UserName = member.RealName; //model.UserCellPhone = member.CellPhone; model.UserName = item.ContactPerson; model.UserCellPhone = item.ContactCellPhone; model.OrderItem = orditems; model.CertPics = new string[3]; model.CertPics[0] = MallIO.GetRomoteImagePath(model.CertPic1); model.CertPics[1] = MallIO.GetRomoteImagePath(model.CertPic2); model.CertPics[2] = MallIO.GetRomoteImagePath(model.CertPic3); string shopBranchName = order.ShopName; if (order.ShopBranchId > 0) { var shopBranchInfo = ShopBranchApplication.GetShopBranchById(order.ShopBranchId); if (shopBranchInfo != null) { shopBranchName = shopBranchInfo.ShopBranchName; } } model.ShopName = shopBranchName; model.ReasonDetail = item.ReasonDetail; return(model); }); return(result.ToList()); }
public ActionResult Apply(long productId = 0) { var setting = _iDistributionService.GetRecruitmentSetting(); if (setting == null) { throw new HimallException("平台未设置招募审核!"); } PromoterModel model = new PromoterModel(); model.Member = MemberApplication.GetMember(curUserId); model.RecruitSetting = setting; if (setting.MustAddress) { model.RegionPath = _iRegionService.GetRegionPath(model.Member.RegionId); } if (setting.MustMobile) { var mobile = _iMessageService.GetDestination(curUserId, SMSPLUGIN, Himall.Model.MemberContactsInfo.UserTypes.General); model.IsBindMobile = !string.IsNullOrEmpty(mobile); } var promoter = _iDistributionService.GetPromoterByUserId(curUserId); model.IsHavePostData = false; if (promoter != null) { model.ShopName = promoter.ShopName; model.Status = promoter.Status; model.IsHavePostData = true; if (promoter.Status == PromoterInfo.PromoterStatus.Refused) { model.IsRefused = true; } switch (model.Status) { case PromoterInfo.PromoterStatus.Audited: return(RedirectToAction("Index", "DistributionMarket")); break; case PromoterInfo.PromoterStatus.NotAvailable: return(RedirectToAction("Performance")); break; case PromoterInfo.PromoterStatus.UnAudit: return(RedirectToAction("WaitAudit")); break; } } else { model.RegionPath = string.Empty;//申请新使用员时,取消默认地址显示 } //处理无必填自动完成 ViewBag.ProductId = productId; return(View(model)); }
public static Entities.MemberInfo GetUser(HttpRequest request) { /* * long id = UserCookieEncryptHelper.Decrypt(WebHelper.GetCookie("Mall-User"), "2"); * if (id == 0L) * { * string userIdCookie = request.Query["token"].ToString(); * //string userIdCookie = Guid.NewGuid().ToString(); * id = UserCookieEncryptHelper.Decrypt(userIdCookie, "2"); * if (id != 0L) * { * WebHelper.SetCookie("Mall-User", userIdCookie); * } * } * if (id != 0L) * { * var userInfo = MemberApplication.GetMember(id); * var siteInfo = SiteSettingApplication.SiteSettings; * if (siteInfo != null) * { * if (!(siteInfo.IsOpenPC || siteInfo.IsOpenH5 || siteInfo.IsOpenMallSmallProg || siteInfo.IsOpenApp))//授权模块影响会员折扣功能 * { * userInfo.MemberDiscount = 1M; * } * * } * return userInfo; * } * return null; * */ long userId = 0; var token = request.Query["token"].ToString(); if (!string.IsNullOrEmpty(token)) { userId = UserCookieEncryptHelper.Decrypt(token, CookieKeysCollection.USERROLE_USER); if (userId != 0) { WebHelper.SetCookie(CookieKeysCollection.Mall_USER, token); } } if (userId == 0) { var cookieValue = WebHelper.GetCookie(CookieKeysCollection.Mall_USER); userId = UserCookieEncryptHelper.Decrypt(cookieValue, CookieKeysCollection.USERROLE_USER); } if (userId != 0) { var userInfo = MemberApplication.GetMember(userId); var siteInfo = SiteSettingApplication.SiteSettings; if (siteInfo != null) { if (!(siteInfo.IsOpenPC || siteInfo.IsOpenH5 || siteInfo.IsOpenMallSmallProg || siteInfo.IsOpenApp))//授权模块影响会员折扣功能 { userInfo.MemberDiscount = 1M; } } return(userInfo); } return(null); }
/// <summary> /// 提现申请 /// </summary> /// <param name="apply"></param> public static void ApplyWithdraw(DistributionApplyWithdraw apply) { if (!MemberApplication.VerificationPayPwd(apply.MemberId, apply.Password)) { throw new MallException("交易密码错误"); } if (apply.Amount > SiteSettingApplication.SiteSettings.DistributorWithdrawMaxLimit) { throw new MallException("超过最大提现额限"); } if (apply.Amount < SiteSettingApplication.SiteSettings.DistributorWithdrawMinLimit) { throw new MallException("小于最低提现额限"); } var distributor = Service.GetDistributor(apply.MemberId); if (apply.Amount > distributor.Balance) { throw new MallException("超过最多提现金额"); } var settings = SiteSettingApplication.SiteSettings; if (apply.Type == DistributionWithdrawType.Alipay) { if (!settings.DistributorWithdrawTypes.ToLower().Contains("alipay")) { throw new MallException("暂不支持支付宝提现"); } if (string.IsNullOrEmpty(apply.WithdrawAccount)) { throw new MallException("支付宝账户不可为空"); } if (string.IsNullOrEmpty(apply.WithdrawName)) { throw new MallException("真实姓名不可为空"); } } else if (apply.Type == DistributionWithdrawType.WeChat) { if (!settings.DistributorWithdrawTypes.ToLower().Contains("wechat")) { throw new MallException("暂不支持微信提现"); } if (string.IsNullOrEmpty(apply.WithdrawAccount)) { throw new MallException("尚未绑定微信,请先绑定微信账户"); } } var info = new DistributionWithdrawInfo { Amount = apply.Amount, WithdrawType = apply.Type, MemberId = apply.MemberId, WithdrawAccount = apply.WithdrawAccount, WithdrawName = apply.WithdrawName }; Service.ApplyWithdraw(info); //发送消息 var member = MemberApplication.GetMember(apply.MemberId); var message = new MessageWithDrawInfo(); message.UserName = member != null ? member.UserName : ""; message.Amount = info.Amount; message.ApplyType = info.WithdrawType.GetHashCode(); message.ApplyTime = info.ApplyTime; message.Remark = info.Remark; message.SiteName = SiteSettingApplication.SiteSettings.SiteName; Task.Factory.StartNew(() => MessageApplication.SendMessageOnDistributionMemberWithDrawApply(apply.MemberId, message)); //预付款提现,自动审核 if (info.WithdrawType == DistributionWithdrawType.Capital) { AuditingWithdraw(info.Id, "System", "预存款提现,自动审核"); } }
public static void WinnerSubmit(WeiActivityWinModel winModel) { Entities.WeiActivityInfoInfo model = _iActivityInfoService.GetActivityModel(winModel.activityId); //添加中奖信息记录 Entities.WeiActivityWinInfoInfo activityWinInfo = new Entities.WeiActivityWinInfoInfo(); activityWinInfo.ActivityId = winModel.activityId; activityWinInfo.AddDate = DateTime.Now; activityWinInfo.UserId = winModel.userId; activityWinInfo.IsWin = winModel.isWin; //消耗积分 if (winModel.integrals > 0) { var factoryService = ServiceProvider.Instance <IMemberIntegralConversionFactoryService> .Create; Mall.Entities.MemberIntegralRecordInfo info = new Mall.Entities.MemberIntegralRecordInfo(); info.UserName = MemberApplication.GetMember(activityWinInfo.UserId).UserName; info.MemberId = activityWinInfo.UserId; info.RecordDate = DateTime.Now; info.ReMark = ((WeiActivityType)model.ActivityType).ToDescription() + "消耗"; info.TypeId = Entities.MemberIntegralInfo.IntegralType.WeiActivity; var memberIntegral = factoryService.Create(Mall.Entities.MemberIntegralInfo.IntegralType.WeiActivity, -winModel.integrals); MemberIntegralApplication.AddMemberIntegral(info, memberIntegral); } if (activityWinInfo.IsWin) { if (winModel.awardType == WeiActivityAwardType.Integral)//积分 { activityWinInfo.AwardName = winModel.awardName + " 积分"; //新增积分记录 var factoryService = ServiceProvider.Instance <IMemberIntegralConversionFactoryService> .Create; Entities.MemberIntegralRecordInfo info = new Entities.MemberIntegralRecordInfo(); info.UserName = MemberApplication.GetMember(activityWinInfo.UserId).UserName; info.MemberId = activityWinInfo.UserId; info.RecordDate = DateTime.Now; info.ReMark = ((WeiActivityType)model.ActivityType).ToDescription() + "中奖"; info.TypeId = Mall.Entities.MemberIntegralInfo.IntegralType.WeiActivity; var memberIntegral = factoryService.Create(Entities.MemberIntegralInfo.IntegralType.WeiActivity, Convert.ToInt32(winModel.awardName));//winModel.integrals为消耗积分 此处不是用户总积分 MemberIntegralApplication.AddMemberIntegral(info, memberIntegral); } else if (winModel.awardType == WeiActivityAwardType.Bonus)//红包 { activityWinInfo.AwardName = winModel.awardName; BonusApplication.SetShareByUserId(winModel.bonusId, false, winModel.userId);//添加红包记录 BonusApplication.IncrReceiveCount(winModel.bonusId); } else { activityWinInfo.AwardName = winModel.awardName; //添加优惠券记录 Entities.CouponRecordInfo recordInfo = new Entities.CouponRecordInfo(); recordInfo.UserId = winModel.userId; recordInfo.UserName = MemberApplication.GetMember(winModel.userId).UserName; recordInfo.ShopId = CouponApplication.GetCouponInfo(winModel.couponId).ShopId; recordInfo.CouponId = winModel.couponId; CouponApplication.AddCouponRecord(recordInfo); } } else { activityWinInfo.AwardName = winModel.awardName; } activityWinInfo.AwardId = winModel.awardId; _iWeiActivityWinService.AddWinner(activityWinInfo); }