示例#1
0
        public static QueryPageModel <WeiActivityModel> Get(WeiActivityQuery query)
        {
            QueryPageModel <Entities.WeiActivityInfoInfo> weiInfo = Service.Get(query);
            var datas = weiInfo.Models.ToList().Select(m => new WeiActivityModel()
            {
                Id                 = m.Id,
                activityTitle      = m.ActivityTitle,
                activityType       = (WeiActivityType)m.ActivityType,
                activityDetails    = m.ActivityDetails,
                activityUrl        = MallIO.GetImagePath(m.ActivityUrl),
                beginTime          = m.BeginTime,
                endTime            = m.EndTime,
                participationType  = (WeiParticipateType)m.ParticipationType,
                participationCount = Convert.ToInt32(m.ParticipationCount),
                consumePoint       = m.ConsumePoint,
                codeUrl            = m.CodeUrl,
                addDate            = m.AddDate,
                totalNumber        = GetWinNumber(m.Id, "ALL"),
                winNumber          = GetWinNumber(m.Id, "True")
            }).ToList();

            QueryPageModel <WeiActivityModel> t = new QueryPageModel <WeiActivityModel>();

            t.Models = datas;
            t.Total  = weiInfo.Total;
            return(t);
        }
示例#2
0
        private string CreateQR(string shopLogo, string vshopUrl)
        {
            Image qrcode;

            //string logoFullPath = Server.MapPath( vshop.Logo );
            if (string.IsNullOrWhiteSpace(shopLogo) || !MallIO.ExistFile(shopLogo))// || !System.IO.File.Exists( logoFullPath )
            {
                qrcode = Core.Helper.QRCodeHelper.Create(vshopUrl);
            }
            else
            {
                qrcode = Core.Helper.QRCodeHelper.Create(vshopUrl, Core.MallIO.GetRomoteImagePath(shopLogo));
            }

            Bitmap       bmp = new Bitmap(qrcode);
            MemoryStream ms  = new MemoryStream();

            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            byte[] arr = new byte[ms.Length];
            ms.Position = 0;
            ms.Read(arr, 0, (int)ms.Length);
            ms.Close();

            qrcode.Dispose();
            return(Convert.ToBase64String(arr));
        }
示例#3
0
        /// <summary>
        /// 获取客服电话
        /// </summary>
        /// <param name="context"></param>
        ///

        //public object GetServicePhone()
        //{
        //    var siteSettings = SiteSettingApplication.SiteSettings;
        //    return Json(new
        //    {
        //        ServicePhone = siteSettings.SitePhone
        //    });
        //}
        /// <summary>
        /// 获取首页数据
        /// </summary>
        /// <param name="openId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        //public object GetIndexData(string openId = "", int pageIndex = 10, int pageSize = 1)
        //{
        //    //CheckUserLogin();
        //    MemberInfo member = CurrentUser;
        //    var sitesetting = SiteSettingApplication.SiteSettings;
        //    string homejson = Request.RequestUri.Scheme + "://" + Request.RequestUri.Authority + "/AppletHome/data/default.json";

        //    long vidnumber = sitesetting.XcxHomeVersionCode;
        //    return Json(new
        //    {
        //        HomeTopicPath = homejson,
        //        Vid = vidnumber,
        //        QQMapKey = CommonConst.QQMapKey
        //    });
        //}
        /// <summary>
        /// 检查版本号
        /// </summary>
        /// <param name="context"></param>
        //public JsonResult<Result<int>> GetInitVeCode(string vid)
        //{
        //    if (string.IsNullOrEmpty(vid))
        //    {
        //        return Json(ErrorResult<int>("版本号不允许为空", 100, 100));
        //    }

        //    var sitesetting = SiteSettingApplication.SiteSettings;
        //    long xcxvid = sitesetting.XcxHomeVersionCode;

        //    if (xcxvid > long.Parse(vid))
        //    {
        //        return Json(ErrorResult("版本需要更新", 101, 101));
        //    }
        //    else
        //    {
        //        return JsonResult(100, "版本不需要更新", 100);
        //    }
        //}

        //public JsonResult<Result<List<dynamic>>> GetIndexProductData(string openId = "", int pageIndex = 1, int pageSize = 10)
        //{
        //    var homeProducts = ServiceProvider.Instance<IWXSmallProgramService>.Create.GetWXSmallHomeProducts(pageIndex,pageSize);
        //    decimal discount = 1M;
        //    long SelfShopId = 0;
        //    var CartInfo = new ShoppingCartInfo();
        //    var ids = homeProducts.Models.Select(p => p.Id).ToList();
        //    var productList = new List<dynamic>();
        //    var cartitems = new List<Mall.Entities.ShoppingCartItem>();
        //    long userId = 0;
        //    if (CurrentUser != null)
        //    {
        //        userId = CurrentUser.Id;
        //        discount = CurrentUser.MemberDiscount;
        //        var shopInfo = ShopApplication.GetSelfShop();
        //        SelfShopId = shopInfo.Id;
        //        CartInfo = ServiceProvider.Instance<ICartService>.Create.GetCart(CurrentUser.Id);
        //        cartitems = CartApplication.GetCartQuantityByIds(CurrentUser.Id, ids);
        //    }

        //    foreach (var item in homeProducts.Models)
        //    {
        //        long activeId = 0;
        //        int activetype = 0;
        //        item.ImagePath = MallIO.GetRomoteProductSizeImage(Core.MallIO.GetImagePath(item.ImagePath), 1, (int)Mall.CommonModel.ImageSize.Size_350);
        //        if (item.ShopId == SelfShopId)
        //            item.MinSalePrice = item.MinSalePrice * discount;
        //        var limitBuy = ServiceProvider.Instance<ILimitTimeBuyService>.Create.GetLimitTimeMarketItemByProductId(item.Id);
        //        if (limitBuy != null)
        //        {
        //            item.MinSalePrice = limitBuy.MinPrice;
        //            activeId = limitBuy.Id;
        //            activetype = 1;
        //        }
        //        int quantity = 0;
        //        quantity = cartitems.Where(d => d.ProductId == item.Id).Sum(d => d.Quantity);

        //        long stock = 0;

        //        var productInfo = ServiceProvider.Instance<IProductService>.Create.GetProduct(item.Id);
        //        if (productInfo != null)
        //        {
        //            var skus = ProductManagerApplication.GetSKUs(productInfo.Id);
        //            stock = skus.Sum(x => x.Stock);
        //            if (productInfo.MaxBuyCount > 0)
        //            {
        //                stock = productInfo.MaxBuyCount;
        //            }
        //        }
        //        if (productInfo.AuditStatus == ProductInfo.ProductAuditStatus.Audited)
        //        {
        //            var ChoiceProducts = new
        //            {
        //                ProductId = item.Id,
        //                ProductName = item.ProductName,
        //                SalePrice = item.MinSalePrice.ToString("0.##"),
        //                ThumbnailUrl160 = item.ImagePath,
        //                MarketPrice = item.MarketPrice.ToString("0.##"),
        //                CartQuantity = quantity,
        //                HasSKU = item.HasSKU,
        //                SkuId = GetSkuIdByProductId(item.Id),
        //                ActiveId = activeId,
        //                ActiveType = activetype,//获取该商品是否参与活动
        //                Stock = stock
        //            };
        //            productList.Add(ChoiceProducts);
        //        }
        //    }
        //    return JsonResult(productList);
        //}

        private object GetMember(Entities.MemberInfo member, string openId)
        {
            var model = MemberApplication.GetUserCenterModel(member.Id, false);
            //获取会员未使用的优惠券数目
            int couponsCount = model.UserCoupon;

            return(Json(new
            {
                couponsCount = couponsCount,
                picture = MallIO.GetRomoteImagePath(member.Photo),
                points = model.Intergral,
                waitPayCount = model.WaitPayOrders,
                waitSendCount = model.WaitDeliveryOrders,
                waitFinishCount = model.WaitReceivingOrders,
                waitReviewCount = model.WaitEvaluationOrders,
                afterSalesCount = model.RefundCount,
                realName = string.IsNullOrEmpty(member.ShowNick) ? (string.IsNullOrEmpty(member.RealName) ? member.UserName : member.RealName) : member.ShowNick,
                gradeId = model.GradeId,
                gradeName = model.GradeName,
                UserName = member.UserName,
                UserId = member.Id,
                OpenId = openId,
                ServicePhone = SiteSettingApplication.SiteSettings.SitePhone
            }));
        }
示例#4
0
        public JsonResult GetOrder(long id)
        {
            if (CurrentUser == null)
            {
                throw new MallException("错误的用户信息");
            }
            var orderdata = _iGiftsOrderService.GetOrder(id, CurrentUser.Id);

            if (orderdata == null)
            {
                throw new MallException("错误的订单编号");
            }
            //Mapper.CreateMap<GiftOrderInfo, GiftsOrderDtoModel>();
            // Mapper.CreateMap<GiftOrderItemInfo, GiftsOrderItemDtoModel>();

            //_iGiftsOrderService.OrderAddUserInfo(orderlist);
            orderdata.Address     = ClearHtmlString(orderdata.Address);
            orderdata.CloseReason = ClearHtmlString(orderdata.CloseReason);
            orderdata.UserRemark  = ClearHtmlString(orderdata.UserRemark);

            var result = orderdata.Map <GiftsOrderDtoModel>();

            result.Items = new List <GiftsOrderItemDtoModel>();
            var orderitems = _iGiftsOrderService.GetOrderItemByOrder(orderdata.Id);

            foreach (var subitem in orderitems)
            {
                var tmporditemobj = subitem.Map <GiftsOrderItemDtoModel>();
                tmporditemobj.DefaultImage = MallIO.GetRomoteProductSizeImage(tmporditemobj.ImagePath, 1, ImageSize.Size_150.GetHashCode());
                result.Items.Add(tmporditemobj);
            }
            result.success = true;
            return(Json(result));
        }
示例#5
0
        /// <summary>
        /// 根据商品搜索周边门店-分页
        /// </summary>
        /// <param name="search"></param>
        /// <returns>标签的过滤</returns>
        public static QueryPageModel <ShopBranch> StoreByProductNearShopBranchs(ShopBranchQuery search)
        {
            var shopBranchInfos = Service.StoreByProductNearShopBranchs(search);
            QueryPageModel <ShopBranch> shopBranchs = new QueryPageModel <ShopBranch>
            {
                Models = shopBranchInfos.Models.Select(e => new ShopBranch
                {
                    AddressDetail     = RenderAddress(e.AddressPath, e.AddressDetail, 1),
                    ContactPhone      = e.ContactPhone,
                    Id                = e.Id,
                    ShopBranchName    = e.ShopBranchName,
                    Status            = e.Status,
                    DistanceUnit      = e.Distance >= 1 ? e.Distance + "KM" : e.Distance * 1000 + "M",
                    Distance          = e.Distance,
                    ServeRadius       = e.ServeRadius,
                    Latitude          = e.Latitude,
                    Longitude         = e.Longitude,
                    DeliveFee         = e.DeliveFee,
                    DeliveTotalFee    = e.DeliveTotalFee,
                    IsAboveSelf       = e.IsAboveSelf,
                    IsStoreDelive     = e.IsStoreDelive,
                    ShopImages        = MallIO.GetRomoteImagePath(e.ShopImages),
                    ShopId            = e.ShopId,
                    FreeMailFee       = e.FreeMailFee,
                    IsFreeMail        = e.IsFreeMail,
                    IsRecommend       = e.IsRecommend,
                    RecommendSequence = e.RecommendSequence == 0 ? long.MaxValue : e.RecommendSequence//非推荐门店取最大值,便于显示排序
                }).ToList(),
                Total = shopBranchInfos.Total
            };

            return(shopBranchs);
        }
示例#6
0
        public JsonResult List(int page, int rows)
        {
            var shopId = CurrentSellerManager.ShopId;
            var result = _iBrandService.GetShopBrandApplys(shopId, null, page, rows, "");
            var brands = result.Models.ToArray().Select(item => new BrandApplyModel()
            {
                Id           = item.Id,
                BrandId      = item.BrandId,
                ShopId       = item.ShopId,
                BrandName    = item.BrandName,
                BrandLogo    = MallIO.GetImagePath(item.Logo),
                BrandDesc    = item.Description == null ? "" : item.Description,
                BrandAuthPic = item.AuthCertificate,
                Remark       = item.Remark,
                BrandMode    = item.ApplyMode,
                PlatRemark   = item.PlatRemark,
                AuditStatus  = item.AuditStatus,
            });
            DataGridModel <BrandApplyModel> model = new DataGridModel <BrandApplyModel>()
            {
                rows = brands, total = result.Total
            };

            return(Json(model));
        }
示例#7
0
        public ActionResult GetOtherReceive(long id)
        {
            List <ShopBonusOtherReceiveModel> models = new List <ShopBonusOtherReceiveModel>();
            var result      = this._bonusService.GetDetailByGrantId(id);
            int randomIndex = 0;

            foreach (var re in result)
            {
                models.Add(new ShopBonusOtherReceiveModel
                {
                    Name        = re.WXName,
                    HeadImg     = MallIO.GetImagePath(re.WXHead),
                    Copywriter  = RandomStr(randomIndex),
                    Price       = (decimal)re.Price,
                    ReceiveTime = ((DateTime)re.ReceiveTime).ToString("yyyy-MM-dd HH:mm")
                });
                randomIndex++;
                if (randomIndex > 4)
                {
                    randomIndex = 0;
                }
            }

            return(SuccessResult <dynamic>(data: models));
        }
示例#8
0
        public ActionResult Index()
        {
            var userId   = CurrentUser.Id;
            var model    = _iMemberInviteService.GetMemberInviteInfo(userId);
            var rule     = _iMemberInviteService.GetInviteRule();
            var Integral = _iMemberIntegralService.GetIntegralChangeRule();

            if (Integral != null && Integral.IntegralPerMoney > 0)
            {
                ViewBag.IntergralMoney = (rule.InviteIntegral / Integral.IntegralPerMoney).ToString("f2");
            }
            string host = CurrentUrlHelper.CurrentUrlNoPort();

            model.InviteLink = String.Format("{0}/Register/index/{1}", host, userId);
            //rule.ShareIcon = string.Format("http://{0}{1}", host, rule.ShareIcon);
            rule.ShareIcon = !string.IsNullOrWhiteSpace(rule.ShareIcon) ? MallIO.GetRomoteImagePath(rule.ShareIcon) : "";
            var          map = Core.Helper.QRCodeHelper.Create(model.InviteLink);
            MemoryStream ms  = new MemoryStream();

            map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            //  将图片内存流转成base64,图片以DataURI形式显示
            string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray());

            ms.Dispose();
            model.QR       = strUrl;
            ViewBag.WeiXin = PlatformType == PlatformType.WeiXin;
            var m = new Tuple <UserInviteModel, Entities.InviteRuleInfo, Entities.MemberInfo>(model, rule, CurrentUser);

            return(View(m));
        }
示例#9
0
        public object GetUser(string UserKey)
        {
            CheckUserLogin();
            dynamic data   = SuccessResult();
            long    userId = CurrentUser.Id;

            var member = MemberApplication.GetMember(userId);

            data.UserId    = member.Id;
            data.UserName  = member.UserName;
            data.Photo     = string.IsNullOrEmpty(member.Photo) ? "" : MallIO.GetRomoteImagePath(member.Photo);
            data.CellPhone = member.CellPhone;

            data.QQ       = member.QQ;
            data.BirthDay = member.BirthDay;
            data.Nick     = member.Nick;
            data.RealName = member.RealName;
            data.Sex      = (int)member.Sex;


            var orderStatic = StatisticApplication.GetMemberOrderStatistic(userId, true);

            //用户所有订单
            data.AllOrders = orderStatic.OrderCount;
            //待付款订单
            data.WaitingForPay = orderStatic.WaitingForPay;
            //待发货订单
            data.WaitingForDelivery = orderStatic.WaitingForDelivery;//获取待发货订单数
            //未评论订单
            data.WaitingForComments = orderStatic.WaitingForComments;
            //待收货订单/待消费
            data.WaitingForRecieve = orderStatic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(userId);
            //待处理的售后
            data.RefundOrders    = orderStatic.RefundCount;
            data.FavoriteShop    = ShopApplication.GetUserConcernShopsCount(userId);
            data.FavoriteProduct = FavoriteApplication.GetFavoriteCountByUser(userId);
            data.Coupon          = MemberApplication.GetAvailableCouponCount(userId);
            data.Integral        = MemberIntegralApplication.GetAvailableIntegral(userId);
            data.Balance         = MemberCapitalApplication.GetBalanceByUserId(userId);


            //用户参与的团数量
            var seastatus = new List <FightGroupOrderJoinStatus>
            {
                FightGroupOrderJoinStatus.Ongoing,
                FightGroupOrderJoinStatus.JoinSuccess,
                FightGroupOrderJoinStatus.BuildFailed,
                FightGroupOrderJoinStatus.BuildSuccess
            };

            //TODO:FG 查询待优化
            data.GroupTotal = ServiceProvider.Instance <IFightGroupService> .Create.GetJoinGroups(userId, seastatus, 1, 1).Total;

            data.MyGroup = ServiceProvider.Instance <IFightGroupService> .Create.CountJoiningOrder(userId);

            data.IsOpenRechargePresent = SiteSettingApplication.SiteSettings.IsOpenRechargePresent;

            MemberApplication.AddIntegel(member);//给用户加积分//执行登录后初始化相关操作
            return(data);
        }
示例#10
0
        /// <summary>
        /// 获取拼团项用于新增活动
        /// </summary>
        /// <param name="productId">商品编号</param>
        /// <returns></returns>
        public static FightGroupGetSkuListModel GetNewActiveItems(long productId)
        {
            FightGroupGetSkuListModel result = new FightGroupGetSkuListModel();
            var pro = GetService <IProductService>().GetProduct(productId);

            result.ProductImg = MallIO.GetProductSizeImage(pro.RelativePath, 1, (int)Mall.CommonModel.ImageSize.Size_150);
            result.skulist    = new List <FightGroupActiveItemModel>();
            var price = 0m;

            if (pro.IsOpenLadder)
            {
                var ladder = ProductManagerApplication.GetLadderPriceByProductIds(productId);
                if (ladder.Any())
                {
                    price = ladder.OrderBy(m => m.MinBath).FirstOrDefault().Price;
                }
            }
            var skus = ProductManagerApplication.GetSKUs(pro.Id);

            foreach (var item in skus)
            {
                FightGroupActiveItemModel data = new FightGroupActiveItemModel();
                data.ProductId    = productId;
                data.SkuId        = item.Id;
                data.SkuName      = item.Color + " " + item.Size + " " + item.Version;
                data.ProductPrice = price > 0 ? price : item.SalePrice;
                data.ProductStock = item.Stock;
                data.ActivePrice  = data.ProductPrice;
                data.ActiveStock  = 0; //活动库存置空
                result.skulist.Add(data);
            }
            return(result);
        }
示例#11
0
        /// <summary>
        /// 生成二维码
        /// </summary>
        private string GenerateQR(string path, long shopId, string logo)
        {
            string fileName = shopId + "_QRCode.jpg";

            try
            {
                Bitmap map;
                if (!string.IsNullOrWhiteSpace(logo) && MallIO.ExistFile(logo))
                {
                    map = Core.Helper.QRCodeHelper.Create(path, MallIO.GetImagePath(logo));
                }
                else
                {
                    map = Core.Helper.QRCodeHelper.Create(path);
                }
                string fileFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Storage", "Shop", "VShop");
                string fileFullPath   = Path.Combine(fileFolderPath, fileName);
                if (!Directory.Exists(fileFolderPath))
                {
                    Directory.CreateDirectory(fileFolderPath);
                }
                map.Save(fileFullPath);
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            return("/Storage/Shop/VShop/" + fileName);
        }
示例#12
0
        /// <summary>
        /// 获取邮件发送内容
        /// </summary>
        /// <returns></returns>
        public static MessageContent GetMessageContentConfig()
        {
            Log.Info("email2---sss");
            MessageContent config = Core.Cache.Get <MessageContent>("EmailMessageContent") as MessageContent;

            if (config == null)
            {
                string sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/MessageContent.xml";

                if (MallIO.ExistFile(sDirectory))
                {
                    XmlSerializer xs  = new XmlSerializer(typeof(MessageContent));
                    byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                    string        str = System.Text.Encoding.Default.GetString(b);
                    MemoryStream  fs  = new MemoryStream(b);
                    config = (MessageContent)xs.Deserialize(fs);
                }
                else
                {
                    SaveMessageContentConfig(config);
                }
            }
            Log.Info("email2---eee");
            return(config);
        }
示例#13
0
        public object GetUserCollectionShop(int pageNo = 1, int pageSize = 8)
        {
            CheckUserLogin();
            if (CurrentUser != null)
            {
                var model = ServiceProvider.Instance <IShopService> .Create.GetUserConcernShops(CurrentUser.Id, pageNo, pageSize);

                var result = model.Models.Select(item =>
                {
                    var shop  = ShopApplication.GetShop(item.ShopId);
                    var vShop = VshopApplication.GetVShopByShopId(item.ShopId);
                    return(new
                    {
                        //Id = item.Id,
                        Id = vShop?.Id ?? 0,
                        ShopId = item.ShopId,
                        Logo = vShop == null ? MallIO.GetRomoteImagePath(shop.Logo) : MallIO.GetRomoteImagePath(vShop.Logo),
                        Name = shop.ShopName,
                        Status = shop.ShopStatus,
                        ConcernTime = item.Date,
                        ConcernTimeStr = item.Date.ToString("yyyy-MM-dd"),
                        ConcernCount = FavoriteApplication.GetFavoriteShopCountByShop(item.ShopId)
                    });
                });
                return(new { success = true, data = result });
            }
            else
            {
                return(new Result {
                    success = false, msg = "未登录"
                });
            }
        }
示例#14
0
        public object GetUserCollectionProduct(int pageNo = 1, int pageSize = 16)
        {
            CheckUserLogin();
            if (CurrentUser != null)
            {
                var model = ServiceProvider.Instance <IProductService> .Create.GetUserConcernProducts(CurrentUser.Id, pageNo, pageSize);

                var result = model.Models.ToArray().Select(item =>
                {
                    var pro = ProductManagerApplication.GetProduct(item.ProductId);
                    return(new
                    {
                        Id = item.ProductId,
                        Image = MallIO.GetRomoteProductSizeImage(pro.RelativePath, 1, (int)Mall.CommonModel.ImageSize.Size_220),
                        ProductName = pro.ProductName,
                        SalePrice = pro.MinSalePrice.ToString("F2"),
                        Evaluation = CommentApplication.GetCommentCountByProduct(pro.Id),
                        Status = ProductManagerApplication.GetProductShowStatus(pro)
                    });
                });
                return(new { success = true, data = result, total = model.Total });
            }
            else
            {
                return(new Result {
                    success = false, msg = "未登录"
                });
            }
        }
示例#15
0
        public object GetGiftOrderDetail(long id)
        {
            CheckUserLogin();
            var orderdata = GiftsOrderApplication.GetOrder(id, CurrentUser.Id);

            if (orderdata == null)
            {
                return(Json(ErrorResult <dynamic>("错误的订单编号!")));
            }
            //Mapper.CreateMap<GiftOrderInfo, GiftsOrderDtoModel>();
            // Mapper.CreateMap<GiftOrderItemInfo, GiftOrderItemDtoModel>();
            //_iGiftsOrderService.OrderAddUserInfo(orderlist);
            orderdata.Address     = ClearHtmlString(orderdata.Address);
            orderdata.CloseReason = ClearHtmlString(orderdata.CloseReason);
            orderdata.UserRemark  = ClearHtmlString(orderdata.UserRemark);

            var result = orderdata.Map <GiftsOrderDtoModel>();

            result.Items        = new List <GiftOrderItemDtoModel>();
            result.OrderDateStr = result.OrderDate.ToString("yyyy-MM-dd HH:mm:ss");
            var items = GiftsOrderApplication.GetOrderItemByOrder(orderdata.Id);

            foreach (var subitem in items)
            {
                var tmporditemobj = subitem.Map <GiftOrderItemDtoModel>();
                tmporditemobj.DefaultImage = MallIO.GetRomoteProductSizeImage(tmporditemobj.ImagePath, 1, ImageSize.Size_150.GetHashCode());
                result.Items.Add(tmporditemobj);
            }
            return(Json(result));
        }
示例#16
0
        /// <summary>
        /// 获取信息内容
        /// </summary>
        /// <returns></returns>
        public static MessageContent GetMessageContentConfig()
        {
            MessageContent config = Core.Cache.Get <MessageContent>("SMSMessageContent") as MessageContent;

            if (config == null)
            {
                //using (FileStream fs = new FileStream(WorkDirectory + "\\Data\\MessageContent.xml", FileMode.Open))
                //{
                //    XmlSerializer xs = new XmlSerializer(typeof(MessageContent));
                //    config = (MessageContent)xs.Deserialize(fs);
                //    Core.Cache.Insert("MessageContent", config);
                //}

                string sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/MessageContent.xml";

                if (MallIO.ExistFile(sDirectory))
                {
                    XmlSerializer xs  = new XmlSerializer(typeof(MessageContent));
                    byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                    string        str = System.Text.Encoding.Default.GetString(b);
                    MemoryStream  fs  = new MemoryStream(b);
                    config = (MessageContent)xs.Deserialize(fs);
                    Core.Cache.Insert("SMSMessageContent", config);
                }
            }
            return(config);
        }
示例#17
0
        /// <summary>
        /// 递归获取类别下所有子类
        /// </summary>
        /// <param name="allCategoies">所有分类</param>
        /// <param name="categoryId">分类ID</param>
        /// <param name="depth"></param>
        /// <returns></returns>
        public static List <Category> GetSubCategories(IEnumerable <Mall.Entities.CategoryInfo> allCategoies, long categoryId, int depth)
        {
            var categories = allCategoies
                             .Where(item => item.ParentCategoryId == categoryId && item.IsShow)
                             .Select(item =>
            {
                string image = string.Empty;
                if (depth == 2)
                {
                    image = item.Icon;
                    if (string.IsNullOrWhiteSpace(image))
                    {
                        image = string.Empty;
                    }
                }
                return(new Category()
                {
                    Id = item.Id,
                    Name = item.Name,
                    Image = MallIO.GetImagePath(image),
                    SubCategories = GetSubCategories(allCategoies, item.Id, depth + 1),
                    Depth = 1,
                    DisplaySequence = item.DisplaySequence
                });
            })
                             .OrderBy(c => c.DisplaySequence).ToList();

            return(categories);
        }
示例#18
0
        public static WeiActivityModel GetActivityModel(long id, string url = "")
        {
            var model = Service.GetActivityModel(id, url);

            var viewModel = new WeiActivityModel
            {
                Id                 = model.Id,
                activityTitle      = model.ActivityTitle,
                activityType       = (WeiActivityType)model.ActivityType,
                activityDetails    = model.ActivityDetails,
                activityUrl        = MallIO.GetImagePath(model.ActivityUrl),
                beginTime          = model.BeginTime,
                endTime            = model.EndTime,
                participationType  = (WeiParticipateType)model.ParticipationType,
                participationCount = Convert.ToInt32(model.ParticipationCount),
                consumePoint       = model.ConsumePoint,
                codeUrl            = model.CodeUrl,
                addDate            = model.AddDate
            };
            var awards = Service.GetActivityAwards(model.Id);

            viewModel.awards = awards.Select(item => new WeiActivityAwardModel
            {
                Id         = item.Id,
                activityId = item.ActivityId,
                awardCount = item.AwardCount,
                awardLevel = item.AwardLevel,
                awardType  = (WeiActivityAwardType)item.AwardType,
                bonusId    = item.BonusId,
                couponId   = item.CouponId,
                integral   = item.Integral,
                proportion = item.Proportion
            }).ToList();
            return(viewModel);
        }
示例#19
0
        public JsonResult Index(
            string keywords = "", /* 搜索关键字 */
            long cid        = 0,  /* 分类ID */
            long b_id       = 0,  /* 品牌ID */
            string a_id     = "", /* 属性ID, 表现形式:attrId_attrValueId */
            int orderKey    = 1,  /* 排序项(1:默认,2:销量,3:价格,4:评论数,5:上架时间) */
            int orderType   = 1,  /* 排序方式(1:升序,2:降序) */
            int pageNo      = 1,  /*页码*/
            int pageSize    = 10, /*每页显示数据量*/
            long vshopId    = 0,  //店铺ID
            bool t          = false
            )
        {
            var result = DoSearch(keywords, cid, b_id, a_id, orderKey, orderType, pageNo, pageSize, vshopId);

            if (Core.MallIO.GetMallIO().GetType().FullName.Equals("Mall.Strategy.OSS"))
            {
                foreach (var item in result.Data)
                {
                    item.ImagePath = MallIO.GetProductSizeImage(item.ImagePath, 1, (int)Mall.CommonModel.ImageSize.Size_220);
                }
            }
            else
            {
                result.Data.ForEach(p =>
                {
                    p.ImagePath = System.IO.Path.Combine(p.ImagePath, "1_220.png");
                });
            }
            return(SuccessResult(data: result.Data));
        }
示例#20
0
        //已领取过
        public ActionResult HasReceive(long id)
        {
            BonusModel model = new BonusModel(this._iBonusService.Get(id));

            model.ImagePath = MallIO.GetFilePath(model.ImagePath);
            return(View(model));
        }
示例#21
0
        //未开始
        public ActionResult NotStart(long id, string openId = "")
        {
            BonusModel model = new BonusModel(this._iBonusService.Get(id));

            model.ImagePath = MallIO.GetFilePath(model.ImagePath);
            ViewBag.OpenId  = openId;
            return(View(model));
        }
示例#22
0
        //完成
        public ActionResult Completed(long id, string openId = "", decimal price = 0)
        {
            ViewBag.Price = price;
            BonusModel model = new BonusModel(this._iBonusService.Get(id));

            model.ImagePath = MallIO.GetFilePath(model.ImagePath);
            ViewBag.OpenId  = openId;
            return(View(model));
        }
示例#23
0
        public object GetRefundLogs(int refundId)
        {
            CheckUserLogin();

            var refund = RefundApplication.GetOrderRefund(refundId);

            if (refund == null || refund.ShopId != CurrentShopBranch.ShopId)
            {
                return(ErrorResult("无效的售后申请编号"));
            }

            var order = Application.OrderApplication.GetOrder(refund.OrderId);

            if (order == null || order.ShopBranchId != this.CurrentUser.ShopBranchId)
            {
                return(ErrorResult("无效的售后申请编号"));
            }

            var refundLogs = RefundApplication.GetRefundLogs(refundId);

            var logs = new List <object>();

            var roleMap = new Dictionary <OrderRefundStep, int>();//操作步骤 由谁完成的

            roleMap.Add(OrderRefundStep.Confirmed, 2);
            roleMap.Add(OrderRefundStep.UnAudit, 1);
            roleMap.Add(OrderRefundStep.UnConfirm, 1);
            roleMap.Add(OrderRefundStep.WaitAudit, 0);
            roleMap.Add(OrderRefundStep.WaitDelivery, 1);
            roleMap.Add(OrderRefundStep.WaitReceiving, 1);

            foreach (var log in refundLogs)
            {
                logs.Add(new
                {
                    Role = roleMap[log.Step],//操作者角色,0:买家,1:门店,2:平台
                    Step = log.Step,
                    log.OperateDate,
                    log.Remark
                });
            }

            var model = new OrderRefundApiModel();

            refund.Map(model);
            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);

            return(new
            {
                success = true,
                Refund = model,
                Logs = logs
            });
        }
示例#24
0
        public JsonResult GetCouponList(int page = 1, int pagesize = 10)
        {
            QueryPageModel <CouponInfo> coupons = _iCouponService.GetIntegralCoupons(page, pagesize);
            //Mapper.CreateMap<CouponInfo, CouponGetIntegralCouponModel>();
            QueryPageModel <CouponGetIntegralCouponModel> result = new QueryPageModel <CouponGetIntegralCouponModel>();

            result.Total = coupons.Total;
            if (result.Total > 0)
            {
                var datalist = coupons.Models.ToList();
                var objlist  = new List <CouponGetIntegralCouponModel>();
                foreach (var item in datalist)
                {
                    var tmp = item.Map <CouponGetIntegralCouponModel>();
                    tmp.ShowIntegralCover = MallIO.GetRomoteImagePath(item.IntegralCover);
                    var vshopobj = _iVShopService.GetVShopByShopId(tmp.ShopId);
                    if (vshopobj != null)
                    {
                        tmp.VShopId = vshopobj.Id;
                        //优惠价封面为空时,取微店Logo,微店Logo为空时,取商城微信Logo
                        if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                        {
                            if (!string.IsNullOrWhiteSpace(vshopobj.WXLogo))
                            {
                                tmp.ShowIntegralCover = Core.MallIO.GetRomoteImagePath(vshopobj.WXLogo);
                            }
                        }
                    }
                    if (string.IsNullOrWhiteSpace(tmp.ShowIntegralCover))
                    {
                        var siteset = SiteSettingApplication.SiteSettings;
                        tmp.ShowIntegralCover = MallIO.GetRomoteImagePath(siteset.WXLogo);
                    }
                    objlist.Add(tmp);
                }
                result.Models = objlist.ToList();
            }

            int MemberAvailableIntegrals = 0;

            //用户积分与等级
            if (CurrentUser != null)
            {
                //登录后处理会员积分
                var userInte = MemberIntegralApplication.GetMemberIntegral(CurrentUser.Id);
                MemberAvailableIntegrals = userInte.AvailableIntegrals;
            }

            var _result = new
            {
                success = true,
                MemberAvailableIntegrals = MemberAvailableIntegrals,
                data = result.Models
            };

            return(Json(_result));
        }
示例#25
0
        /// <summary>
        /// 我的拼团详情
        /// </summary>
        /// <param name="id"></param>
        /// <param name="aid"></param>
        /// <returns></returns>
        public ActionResult GroupDetail(long id, long aid)
        {
            FightGroupActiveModel gpact = FightGroupApplication.GetActive(aid, false);

            if (gpact == null)
            {
                throw new MallException("错误的活动信息");
            }
            FightGroupsModel groupsdata = FightGroupApplication.GetGroup(aid, id);

            if (groupsdata == null)
            {
                throw new MallException("错误的拼团信息");
            }
            if (groupsdata.BuildStatus == FightGroupBuildStatus.Opening)
            {
                //throw new MallException("开团未成功,等待团长付款中");
                return(Redirect(string.Format("/m-{0}/Member/Center/", PlatformType.ToString())));
            }
            MyFightGroupDetailModel model = new MyFightGroupDetailModel();

            model.ActiveData = gpact;
            model.GroupsData = groupsdata;

            model.ShareUrl   = string.Format("{0}/m-{1}/FightGroup/GroupDetail/{2}?aid={3}", CurrentUrlHelper.CurrentUrlNoPort(), "WeiXin", groupsdata.Id, groupsdata.ActiveId);
            model.ShareTitle = "我参加了(" + groupsdata.ProductName + ")的拼团";
            model.ShareImage = gpact.ProductDefaultImage;
            if (!string.IsNullOrWhiteSpace(model.ShareImage))
            {
                if (model.ShareImage.Substring(0, 4) != "http")
                {
                    model.ShareImage = MallIO.GetRomoteImagePath(model.ShareImage);
                }
            }

            int neednum = groupsdata.LimitedNumber - groupsdata.JoinedNumber;

            neednum = neednum < 0 ? 0 : neednum;
            if (neednum > 0)
            {
                model.ShareDesc = "还差" + neednum + "人即可成团";
            }
            if (!string.IsNullOrWhiteSpace(gpact.ProductShortDescription))
            {
                if (!string.IsNullOrWhiteSpace(model.ShareDesc))
                {
                    model.ShareDesc += ",(" + gpact.ProductShortDescription + ")";
                }
                else
                {
                    model.ShareDesc += gpact.ProductShortDescription;
                }
            }
            return(View(model));
        }
示例#26
0
        public object GetComments([FromQuery] 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 = data.Models.Map <List <HomeGetCommentListModel> >();
            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 = Mall.Core.MallIO.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 = MallIO.GetRomoteImagePath(pitem.CommentImage);
                }
            }
            return(Json(new { total = data.Total, rows = datalist }));
        }
示例#27
0
        public JsonResult GetOrderList(string skey = "", Mall.Entities.GiftOrderInfo.GiftOrderStatus?status = null, int page = 1, int pagesize = 10)
        {
            if (CurrentUser == null)
            {
                throw new MallException("错误的用户信息");
            }
            int             rows  = pagesize;
            GiftsOrderQuery query = new GiftsOrderQuery();

            query.Skey = skey;
            if (status != null)
            {
                if ((int)status != 0)
                {
                    query.Status = status;
                }
            }
            query.UserId   = CurrentUser.Id;
            query.PageSize = rows;
            query.PageNo   = page;
            var orderdata = _iGiftsOrderService.GetOrders(query);
            List <Mall.Entities.GiftOrderInfo> orderlist = orderdata.Models.ToList();
            //_iGiftsOrderService.OrderAddUserInfo(orderlist);
            var result = orderlist.ToList();
            // Mapper.CreateMap<GiftOrderInfo, GiftsOrderDtoModel>();
            // Mapper.CreateMap<GiftOrderItemInfo, GiftsOrderItemDtoModel>();
            List <GiftsOrderDtoModel> pagedata = new List <GiftsOrderDtoModel>();

            foreach (var order in result)
            {
                order.Address     = ClearHtmlString(order.Address);
                order.CloseReason = ClearHtmlString(order.CloseReason);
                order.UserRemark  = ClearHtmlString(order.UserRemark);

                var tmpordobj = order.Map <GiftsOrderDtoModel>();
                tmpordobj.Items = new List <GiftsOrderItemDtoModel>();
                var orderitems = _iGiftsOrderService.GetOrderItemByOrder(order.Id);
                foreach (var subitem in orderitems)
                {
                    var tmporditemobj = subitem.Map <GiftsOrderItemDtoModel>();
                    tmporditemobj.DefaultImage = MallIO.GetRomoteProductSizeImage(tmporditemobj.ImagePath, 1, ImageSize.Size_150.GetHashCode());
                    tmpordobj.Items.Add(tmporditemobj);
                }
                pagedata.Add(tmpordobj);
            }

            var pageresult = SuccessResult(data: new
            {
                total = orderdata.Total,
                rows  = pagedata
            });

            return(pageresult);
        }
示例#28
0
        public GiftOrderConfirmPageModel ConfirmOrder(GiftConfirmOrder value)
        {
            if (value.Count < 1)
            {
                value.Count = 1;
            }
            var id       = value.ID;
            var regionId = value.RegionId;
            var count    = value.Count;
            //Checkout
            GiftOrderConfirmPageModel    data         = new GiftOrderConfirmPageModel();
            List <GiftOrderItemDtoModel> gorditemlist = new List <GiftOrderItemDtoModel>();
            GiftOrderItemDtoModel        gorditem; //订单项

            #region 礼品信息判断
            //礼品信息
            GiftInfo giftdata = _iGiftService.GetById(id);
            if (giftdata == null)
            {
                throw new Exception("错误的礼品编号!");
            }
            #endregion

            gorditem              = new GiftOrderItemDtoModel(); //补充订单项
            gorditem.GiftId       = giftdata.Id;
            gorditem.GiftName     = giftdata.GiftName;
            gorditem.GiftValue    = giftdata.GiftValue;
            gorditem.ImagePath    = giftdata.ImagePath;
            gorditem.OrderId      = 0;
            gorditem.Quantity     = count;
            gorditem.SaleIntegral = giftdata.NeedIntegral;
            if (!string.IsNullOrWhiteSpace(gorditem.ImagePath))
            {
                gorditem.DefaultImage = MallIO.GetRomoteProductSizeImage(gorditem.ImagePath, 1, ImageSize.Size_100.GetHashCode());
            }
            gorditemlist.Add(gorditem);

            data.GiftList = gorditemlist;

            data.GiftValueTotal = (decimal)data.GiftList.Sum(d => d.Quantity * d.GiftValue);
            data.TotalAmount    = (int)data.GiftList.Sum(d => d.SaleIntegral * d.Quantity);

            //用户地址
            Entities.ShippingAddressInfo shipdata = GetShippingAddress(regionId);
            if (shipdata != null)
            {
                // Mapper.CreateMap<Entities.ShippingAddressInfo, ShippingAddressDtoModel>();
                ShippingAddressDtoModel shipobj = shipdata.Map <ShippingAddressDtoModel>();
                shipobj.Address  = shipobj.Address + " " + shipdata.AddressDetail;
                data.ShipAddress = shipobj;
            }
            data.success = true;
            return(data);
        }
示例#29
0
        public List <Entities.SlideAdInfo> GetSlideAds()
        {
            ISlideAdsService _ISlideAdsService = ServiceApplication.Create <ISlideAdsService>();
            var sql    = _ISlideAdsService.GetSlidAds(0, Entities.SlideAdInfo.SlideAdType.AppGifts);
            var result = sql.ToList();

            foreach (var item in result)
            {
                item.ImageUrl = MallIO.GetRomoteImagePath(item.ImageUrl);
            }
            return(result);
        }
示例#30
0
        public ActionResult Edit(long id)
        {
            GiftViewModel model = new GiftViewModel();
            GiftInfo      data  = new GiftInfo();

            data = _iGiftService.GetById(id);
            if (data == null)
            {
                throw new MallException("错误的礼品编号。");
            }
            model = data.Map <GiftViewModel>();
            //补充图片数据
            if (string.IsNullOrWhiteSpace(model.ImagePath))
            {
                model.ImagePath = string.Format(@"/Storage/Gift/{0}", id);
            }
            string path     = model.ImagePath;
            string paths    = model.ImagePath;
            string _imgpath = paths + "/1.png";

            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl1 = Core.MallIO.GetImagePath(path + "/1.png");
            }
            _imgpath = paths + "/2.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl2 = Core.MallIO.GetImagePath(path + "/2.png");
            }
            _imgpath = paths + "/3.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl3 = Core.MallIO.GetImagePath(path + "/3.png");
            }
            _imgpath = paths + "/4.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl4 = Core.MallIO.GetImagePath(path + "/4.png");
            }
            _imgpath = paths + "/5.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl5 = Core.MallIO.GetImagePath(path + "/5.png");
            }
            #region 会员等级列表
            List <SelectListItem> MemGradeSelList = GetMemberGradeSelectList(model.NeedGrade);
            ViewBag.MemberGradeSelect = MemGradeSelList;
            #endregion

            return(View(model));
        }