/// <summary> /// 根据用户ID查询收藏店铺数量 /// <para>Service Url: http://devbtp.sv.iuoooo.com/Jinher.AMP.BTP.SV.SetCollectionSV.svc/GetCollectionAppsCount /// </para> /// </summary> /// <param name="search"></param> /// <returns></returns> public int GetCollectionAppsCountExt(Jinher.AMP.BTP.Deploy.CustomDTO.SetCollectionSearchDTO search) { if (search == null || search.UserId == Guid.Empty || search.ChannelId == Guid.Empty) { LogHelper.Debug(string.Format("SetCollectionSV.GetCollectionAppsCountExt,获取收藏店铺数量参数不全,search:{0},", JsonHelper.JsonSerializer(search))); return(0); } try { var appIds = SetCollection.ObjectSet() .Where(c => c.ColType == 2 && c.UserId == search.UserId && c.ChannelId == search.ChannelId).OrderByDescending(c => c.SubTime) .Select(c => c.ColKey) .ToList(); if (appIds.Any()) { var applist = APPSV.GetAppListByIds(appIds); if (applist != null && applist.Any()) { return(applist.Count); } } LogHelper.Debug(string.Format("SetCollectionSV.GetCollectionAppsCountExt,获取收藏店铺数量位未查到appids,search:{0},", JsonHelper.JsonSerializer(search))); return(0); } catch (Exception ex) { LogHelper.Error(string.Format("SetCollectionSV.GetCollectionAppsCountExt,获取收藏店铺数量异常,search:{0},", JsonHelper.JsonSerializer(search)), ex); return(0); } }
/// <summary> /// 根据用户ID查询收藏商品数量 /// <para>Service Url: http://devbtp.sv.iuoooo.com/Jinher.AMP.BTP.SV.SetCollectionSV.svc/GetCollectionComsCount /// </para> /// </summary> /// <param name="search"></param> /// <returns></returns> public int GetCollectionComsCountExt(Jinher.AMP.BTP.Deploy.CustomDTO.SetCollectionSearchDTO search) { try { if (search == null || search.UserId == Guid.Empty || search.ChannelId == Guid.Empty) { LogHelper.Debug("SetCollectionSV.GetCollectionComsCountExt,获取收藏商品数量参数不完整"); return(0); } var commodityCount = (from setCollection in SetCollection.ObjectSet() join commodity in Commodity.ObjectSet() on setCollection.ColKey equals commodity.Id where setCollection.ColType == 1 && setCollection.UserId == search.UserId && commodity.IsDel == false && commodity.State == 0 && commodity.CommodityType == 0 && setCollection.ChannelId == search.ChannelId select new CommodityListCDTO { Id = commodity.Id, Pic = commodity.PicturesPath, Price = commodity.Price, State = commodity.State, Stock = commodity.Stock, Name = commodity.Name, MarketPrice = commodity.MarketPrice, AppId = commodity.AppId, ComAttrType = (commodity.ComAttribute == "[]" || commodity.ComAttribute == null) ? 1 : 3 }).Count(); return(commodityCount); } catch (Exception e) { LogHelper.Error("SetCollectionSV.GetCollectionComsCountExt,获取收藏商品数量异常" + e); return(0); } }