本文整理汇总了C#中IRequest.GetGoodsUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IRequest.GetGoodsUrl方法的具体用法?C# IRequest.GetGoodsUrl怎么用?C# IRequest.GetGoodsUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRequest
的用法示例。
在下文中一共展示了IRequest.GetGoodsUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateGoodsSkuInfo
public void UpdateGoodsSkuInfo(
IRequest reqSource,
IEnumerable<string> lstSearch, //要为款号
double discountRatio = 0.68,
int stock = 3,
string originalTitle = "xx",
string newTitle = "xx",
bool isModifyPrice = true)
{
foreach (var search in lstSearch)
{
if (search.IsEmptyString()) continue;
List<Item> lstItem = GetOnSaleGoods(search);
if (lstItem != null && lstItem.Count > 0)
{
#region 更新SKU信息
foreach (var item in lstItem)
{
Thread.Sleep(100);
//获取产品原价
var oPrice = item.Title.GetNumberInt();
var req = new ItemUpdateRequest();
req.NumIid = item.NumIid;
req.Title = item.Title.Replace(originalTitle, newTitle);
req.LocationState = SysConst.LocationState;
req.LocationCity = SysConst.LocationCity;
if (isModifyPrice)
{
req.Price = (oPrice * discountRatio).ToType<int>().ToString();
}
var skus = GetSkusByNumId(item.NumIid.ToString()).ToArray();
var lastSku = skus[skus.Count() - 1];
for (int i = 0; i < skus.Count() - 1; i++)
{
Thread.Sleep(100);
var skuReq = new ItemSkuUpdateRequest()
{
NumIid = item.NumIid,
Properties = skus[i].Properties,
Quantity = stock,
OuterId = item.OuterId
};
if (isModifyPrice)
{
skuReq.Price = req.Price;
}
UpdateSku(skuReq);
Thread.Sleep(100);
}
UpdateGoodsBase(req, item.NumIid, item.OuterId, req.Title);
var skuLastReq = new ItemSkuUpdateRequest()
{
NumIid = item.NumIid,
Properties = lastSku.Properties,
Quantity = stock,
OuterId = item.OuterId
};
if (isModifyPrice)
{
skuLastReq.Price = req.Price;
}
UpdateSku(skuLastReq);
}
#endregion
}
else
{
PublishGoodsMain(
reqSource,
new RequestModel { GoodsSn = search, Referer = reqSource.GetGoodsUrl(search) });
}
}
}
示例2: UpdateGoodsInternal
//更新商品的内部方法
private void UpdateGoodsInternal(IRequest req, IEnumerable<Item> lstItem, bool isModifyPrice = true)
{
//遍历在售商品列表中的商品,通过outerid去查询banggo上的该产品信息
foreach (Item item in lstItem)
{
Thread.Sleep(1000);
//通过款号查询如果没有得到产品的URL或得不到库存,就将该产品进行下架。
string goodsUrl = req.GetGoodsUrl(item.OuterId);
this.UpdateGoodsInternalSingle(req,item, goodsUrl, isModifyPrice);
}
}