/// <summary> /// 商品重量、简称设置 /// </summary> /// <returns></returns> public ViewResult GoodsSetting(QueryCriteriaForOnSales QueryStr) { int TotalNum = 0; IList <Item> list = new List <Item>(); IList <Skus> listSkus = new List <Skus>(); List <string> ListSPID = new List <string>(); tbClientUser clientuser = GetUser("UserInfo"); list = SearchGoodsOnsales(ref TotalNum, QueryStr); if (list != null) { foreach (Item item in list) { ListSPID.Add(item.NumIid.ToString()); } if (ListSPID != null) { if (ListSPID.Count <= 40) { listSkus = goodsinfo.GetItemSkus(clientuser.UserShops[0].SessionKey, string.Join(",", ListSPID.ToArray())); } BSkus bs = new BSkus(); foreach (Skus item in listSkus) { IList <Skus> listsku = bs.GetSkus(item.SkuId.ToString()); if (listsku.Count > 0) { item.SPJC = listsku[0].SPJC; item.SPZL = listsku[0].SPJC; item.CBJ = listsku[0].CBJ; } } } } ViewData["listSkus"] = listSkus; return(View(list)); }
/// <summary> /// 查询出售中的商品 /// </summary> /// <param name="SessionKey"></param> /// <param name="TotalNum"></param> /// <returns></returns> public IList <Item> ReturnOnsalesByCriteria(string token, ref int TotalNum, QueryCriteriaForOnSales Query) { IList <Item> list = getgoods.SearchOnsalesByCriteria(token, ref TotalNum, Query); return(list); }
/// <summary> /// 查询在售商品 /// </summary> /// <param name="sessionKey"></param> /// <param name="Query"></param> internal IList <Item> SearchOnsalesByCriteria(string sessionKey, ref int TotalNum, QueryCriteriaForOnSales Query) { ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json"); ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest(); req.Fields = "approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id,sku"; if (Query.Q != null) { req.Q = Query.Q; } if (Query.Cid != null) { req.Cid = Query.Cid; } if (Query.SellerCids != null) { req.SellerCids = Query.SellerCids; } if (Query.PageNo != null) { req.PageNo = Query.PageNo; } else { req.PageNo = 1; } if (Query.PageSize != null) { req.PageSize = Query.PageSize; } else { req.PageSize = 10; } if (Query.HasDiscount != null) { req.HasDiscount = Query.HasDiscount; } if (Query.HasShowcase != null) { req.HasShowcase = Query.HasShowcase; } if (Query.OrderBy != null) { req.OrderBy = Query.OrderBy; } if (Query.IsTaobao != null) { req.IsTaobao = Query.IsTaobao; } if (Query.IsEx != null) { req.IsEx = Query.IsEx; } if (Query.StartModified != null) { req.StartModified = Query.StartModified; } if (Query.EndModified != null) { req.EndModified = Query.EndModified; } if (Query.IsCspu != null) { req.IsCspu = Query.IsCspu; } ItemsOnsaleGetResponse response = client.Execute(req, sessionKey); TotalNum = (int)response.TotalResults; return(ChangeTypeForItem(response.Body)); }