/// <summary>
        /// 商铺拼团列表
        /// </summary>
        /// <param name="userKey">用户key</param>
        /// <param name="status">拼团状态</param>
        /// <returns></returns>
        public object GetFightGroupInfo(string userKey, int status)
        {
            IFightGroupService _ifightGroupService = ServiceProvider.Instance <IFightGroupService> .Create;
            IMemberService     _imemberService     = ServiceProvider.Instance <IMemberService> .Create;
            long userId  = UserCookieEncryptHelper.Decrypt(userKey, CookieKeysCollection.USERROLE_SELLERADMIN);
            var  manager = ServiceProvider.Instance <IManagerService> .Create.GetSellerManager(userId);

            if (manager != null)
            {
                List <ShopFightGroupModel> list           = new List <ShopFightGroupModel>();
                List <FightGroupsInfo>     fightGroupList = _ifightGroupService.GetFightGroupsByShopId(manager.ShopId, status);
                if (fightGroupList != null)
                {
                    for (int i = 0; i < fightGroupList.Count; i++)
                    {
                        ShopFightGroupModel model = new ShopFightGroupModel();
                        var list1 = fightGroupList[i];
                        model.Id            = list1.Id;
                        model.HeadUserId    = list1.HeadUserId;
                        model.JoinedNumber  = list1.JoinedNumber;
                        model.LimitedNumber = list1.LimitedNumber;
                        model.GroupStatus   = list1.GroupStatus;
                        model.ActiveId      = list1.ActiveId;
                        var memberInfo = _imemberService.GetMember((long)model.HeadUserId);
                        if (memberInfo != null)
                        {
                            model.Photo = memberInfo.Photo;
                            model.Nick  = memberInfo.Nick;
                        }
                        var fightGroupActive = _ifightGroupService.GetFightGroupActiveById((long)model.ActiveId);
                        if (fightGroupActive != null)
                        {
                            model.ProductName      = fightGroupActive.ProductName;
                            model.IconUrl          = fightGroupActive.IconUrl;
                            model.ReturnMoney      = fightGroupActive.ReturnMoney;
                            model.OpenGroupReward  = fightGroupActive.OpenGroupReward;
                            model.InvitationReward = fightGroupActive.InvitationReward;
                            model.EndTime          = fightGroupActive.EndTime;
                        }
                        var fightGroupActiveItem = _ifightGroupService.GetActiveItemByActiveId((long)model.ActiveId);
                        if (fightGroupActiveItem != null)
                        {
                            model.ActivePrice = fightGroupActiveItem.ActivePrice;
                        }
                        model.TotalPrice = model.JoinedNumber * model.ActivePrice - model.OpenGroupReward - (model.JoinedNumber - 1) * (model.InvitationReward + model.ReturnMoney);
                        model.SalePrice  = decimal.Round((decimal)(model.TotalPrice / model.JoinedNumber), 2);
                        list.Add(model);
                    }
                    return(Json(new { Status = "OK", Data = list, Message = "数据返回成功" }));
                }
                else
                {
                    return(Json(new { Status = "OK", Data = "", Message = "没有数据" }));
                }
            }
            else
            {
                return(Json(new { Status = "NO", Message = "当前用户不存在" }));
            }
        }
 public UserOrderController(
     IShopBonusService iShopBonusService,
     ICashDepositsService iCashDepositsService,
     ISiteSettingService iSiteSettingService,
     IOrderService iOrderService,
     IRefundService iRefundService,
     ICustomerService iCustomerService,
     IProductService iProductService,
     ICouponService iCouponService,
     ICommentService iCommentService,
     IFightGroupService iFightGroupService, ITypeService iTypeService
     )
 {
     _iShopBonusService    = iShopBonusService;
     _iCashDepositsService = iCashDepositsService;
     _iSiteSettingService  = iSiteSettingService;
     _iOrderService        = iOrderService;
     _iRefundService       = iRefundService;
     _iCustomerService     = iCustomerService;
     _iProductService      = iProductService;
     _iCouponService       = iCouponService;
     _iCommentService      = iCommentService;
     _iFightGroupService   = iFightGroupService;
     _iTypeService         = iTypeService;
 }
Exemple #3
0
 public TradeHelper()
 {
     regionService       = Himall.ServiceProvider.Instance <IRegionService> .Create;
     _iOrderService      = Himall.ServiceProvider.Instance <IOrderService> .Create;
     _iMemberService     = Himall.ServiceProvider.Instance <IMemberService> .Create;
     _iFightGroupService = Himall.ServiceProvider.Instance <IFightGroupService> .Create;
     _iTypeService       = Himall.ServiceProvider.Instance <ITypeService> .Create;
 }
Exemple #4
0
 public OrderController(IOrderService iOrderService, IExpressService iExpressService, IPaymentConfigService iPaymentConfigService
                        , IFightGroupService iFightGroupService)
 {
     _iOrderService         = iOrderService;
     _iExpressService       = iExpressService;
     _iPaymentConfigService = iPaymentConfigService;
     _iFightGroupService    = iFightGroupService;
 }
Exemple #5
0
 public PaymentController(IOrderService iOrderService, IMemberService iMemberService
                          , IMemberCapitalService iMemberCapitalService, IFightGroupService iFightGroupService
                          )
 {
     _iOrderService         = iOrderService;
     _iMemberService        = iMemberService;
     _iMemberCapitalService = iMemberCapitalService;
     _iFightGroupService    = iFightGroupService;
 }
 public PaymentController(IOrderService iOrderService, IMemberService iMemberService
                          , IMemberCapitalService iMemberCapitalService, IFightGroupService iFightGroupService,
                          IHttpContextAccessor httpContextAccessor
                          )
 {
     _iOrderService         = iOrderService;
     _iMemberService        = iMemberService;
     _iMemberCapitalService = iMemberCapitalService;
     _iFightGroupService    = iFightGroupService;
 }
Exemple #7
0
 public PayController(IOrderService iOrderService, ICashDepositsService iCashDepositsService, IMemberCapitalService iMemberCapitalService
                      , IRefundService iRefundService, IShopService iShopService, IFightGroupService iFightGroupService)
 {
     _iOrderService         = iOrderService;
     _iCashDepositsService  = iCashDepositsService;
     _iMemberCapitalService = iMemberCapitalService;
     _iRefundService        = iRefundService;
     _iShopService          = iShopService;
     _iFightGroupService    = iFightGroupService;
 }
 public LimitTimeBuyController(ILimitTimeBuyService iLimitTimeBuyService,
                               IMarketService iMarketService,
                               IOrderService iOrderService,
                               IShopService iShopService,
                               IProductService iProductService,
                               IFightGroupService iFightGroupService
                               )
 {
     _iLimitTimeBuyService = iLimitTimeBuyService;
     _iOrderService        = iOrderService;
     _iShopService         = iShopService;
     _iProductService      = iProductService;
     _iMarketService       = iMarketService;
     _iFightGroupService   = iFightGroupService;
 }
Exemple #9
0
        public PayController(IOrderService iOrderService, ICashDepositsService iCashDepositsService, IMemberCapitalService iMemberCapitalService
                             , IRefundService iRefundService, IShopService iShopService, IFightGroupService iFightGroupService,
                             IHttpContextAccessor httpContextAccessor,
                             IWebHostEnvironment environment
                             )
        {
            _iOrderService         = iOrderService;
            _iCashDepositsService  = iCashDepositsService;
            _iMemberCapitalService = iMemberCapitalService;
            _iRefundService        = iRefundService;
            _iShopService          = iShopService;
            _iFightGroupService    = iFightGroupService;

            _httpContextAccessor = httpContextAccessor;
            _hostingEnvironment  = environment;
        }
 public BranchOrderController()
 {
     _iOrderService = new OrderService();
     _iCartService = new CartService();
     _iMemberService = new MemberService();
     _iProductService = new ProductService();
     _iPaymentConfigService = new PaymentConfigService();
     _iCashDepositsService = new CashDepositsService();
     _iShopService = ServiceProvider.Instance<IShopService>.Create;
     _iLimitTimeBuyService = new LimitTimeBuyService();
     _iCouponService = new CouponService();
     _iShopBonusService = new ShopBonusService();
     _iCollocationService = new CollocationService();
     _iMemberCapitalService = new MemberCapitalService();
     _iShippingAddressService = new ShippingAddressService();
     _iMemberIntegralService = new MemberIntegralService();
     _iRegionService = new RegionService();
     _iVShopService = new VShopService();
     _iRefundService = new RefundService();
     _iFightGroupService = new FightGroupService();
 }
 public BranchOrderController()
 {
     this._iOrderService           = (IOrderService) new OrderService();
     this._iCartService            = (ICartService) new CartService();
     this._iMemberService          = (IMemberService) new MemberService();
     this._iProductService         = (IProductService) new ProductService();
     this._iPaymentConfigService   = (IPaymentConfigService) new PaymentConfigService();
     this._iCashDepositsService    = (ICashDepositsService) new CashDepositsService();
     this._iSiteSettingService     = (ISiteSettingService) new SiteSettingService();
     this._iShopService            = (IShopService) new ShopService();
     this._iLimitTimeBuyService    = (ILimitTimeBuyService) new LimitTimeBuyService();
     this._iCouponService          = (ICouponService) new CouponService();
     this._iShopBonusService       = (IShopBonusService) new ShopBonusService();
     this._iCollocationService     = (ICollocationService) new CollocationService();
     this._iMemberCapitalService   = (IMemberCapitalService) new MemberCapitalService();
     this._iShippingAddressService = (IShippingAddressService) new ShippingAddressService();
     this._iMemberIntegralService  = (IMemberIntegralService) new MemberIntegralService();
     this._iRegionService          = (IRegionService) new RegionService();
     this._iVShopService           = (IVShopService) new VShopService();
     this._iRefundService          = (IRefundService) new RefundService();
     this._iFightGroupService      = (IFightGroupService) new FightGroupService();
 }
Exemple #12
0
        public object GetUserCollectionProduct(int pageNo, int pageSize = 16)
        {
            CheckUserLogin();
            if (CurrentUser != null)
            {
                var model = ServiceProvider.Instance <IProductService> .Create.GetUserConcernProducts(CurrentUser.Id, pageNo, pageSize);

                DataTable dt = new DataTable();
                dt.Columns.Add("ActiveId");
                dt.Columns.Add("ProductId");
                dt.Columns.Add("Image");
                dt.Columns.Add("ProductName");
                dt.Columns.Add("SalePrice");
                dt.Columns.Add("GroupPrice");
                dt.Columns.Add("Description");

                IFightGroupService   fightGroupService = ServiceProvider.Instance <IFightGroupService> .Create;
                IProductService      productService    = ServiceProvider.Instance <IProductService> .Create;
                DataRow              dr;
                FightGroupActiveInfo fightGroupInfo = null;
                ProductInfo          productInfo    = null;
                foreach (var fightGroupModel in model.Models)
                {
                    dr             = dt.NewRow();
                    fightGroupInfo = fightGroupService.GetActiveByProId(fightGroupModel.ProductId);
                    if (fightGroupInfo == null)
                    {
                        continue;
                    }
                    productInfo = productService.GetProduct(fightGroupModel.ProductId);
                    if (productInfo == null)
                    {
                        continue;
                    }
                    dr["ActiveId"]    = fightGroupInfo.Id;
                    dr["ProductId"]   = fightGroupModel.ProductId;
                    dr["Image"]       = Core.HimallIO.GetRomoteProductSizeImage(productInfo.RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_220);
                    dr["ProductName"] = productInfo.ProductName;
                    dr["SalePrice"]   = productInfo.MinSalePrice.ToString("F2");
                    dr["GroupPrice"]  = fightGroupInfo.MiniGroupPrice;
                    dr["Description"] = productInfo.ShortDescription;
                    dt.Rows.Add(dr);
                }

                //var result = model.Models.ToArray().Select(item => new
                //{
                //    ActiveId = ServiceProvider.Instance<IFightGroupService>.Create.GetActiveByProId(item.ProductId).Id,
                //    ProductId = item.ProductId,
                //    Image = Core.HimallIO.GetRomoteProductSizeImage(item.ProductInfo.RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_220),
                //    ProductName = item.ProductInfo.ProductName,
                //    SalePrice = item.ProductInfo.MinSalePrice.ToString("F2"),
                //    GroupPrice = ServiceProvider.Instance<IFightGroupService>.Create.GetActiveByProId(item.ProductId).MiniGroupPrice,
                //    Description = item.ProductInfo.ShortDescription
                //});
                return(Json(new { Success = true, Data = dt, Total = dt.Rows.Count }));
            }
            else
            {
                return(Json(new { Success = false, Message = "未登录" }));
            }
        }