[C#] 纯文本查看 复制代码
/// <summary>
/// 获取指定计划的全部宝贝
/// </summary>
/// <param name="plan">计划</param>
/// <returns></returns>
public List<structrueIitem> GetShopPlanItemList(structrueShopPlan plan)
{
string LogTitle = "获取推广计划宝贝";
Class_tools.Class_System.log("[{0}] ", LogTitle);
List<structrueIitem> result = new List<structrueIitem>();
Class_tools.Class_System.log("[{0}] 正在获取:{1} 计划中的宝贝...", LogTitle,plan.campaignName);
httpItem.URL =string.Format( "http://pub.alimama.com/campaign/merchandiseDetail.json?campaignId={0}&"+
"shopkeeperId={1}&userNumberId={2}&tab=2&omid={3}&toPage=1&perPagesize=40",
plan.campaignId,
plan.shopkeeperId,
plan.userNumberId,
plan.omid
);
string htmlCode = http.GetHtml(httpItem).Html;
JObject job = null;
try
{
job = JObject.Parse(htmlCode);
}
catch (Exception)
{
Class_tools.Class_System.log("[{0}] 异常! JSON解析错误..如果频繁提示此信息,有可能登陆cookie已失效.", LogTitle);
return result;
}
if (job == null)
{
return result;
}
IEnumerable<JObject> jto = job["data"]["pagelist"].Values<JObject>();
foreach (var item in jto)
{
structrueIitem taobaoItem = new structrueIitem();
//开始取值
taobaoItem.itemImgUrl = item["pictUrl"].ToString();
taobaoItem.itemPrice = item["zkPrice"].ToString();
taobaoItem.itemTitle = item["title"].ToString();
taobaoItem.itemUrl = item["auctionUrl"].ToString();
taobaoItem.itemAilimamaUrl = "";// 因为客户要求全部连接到店铺首页,所以直接附值店铺阿里巴马连接即可
result.Add(taobaoItem);
#region 原JSON 结构预览
/*
"{groupId": null,
"userId": "660db0298f8a09e657f69a5cc3531578",
"userType": 1,
"auctionUrl": "http://item.taobao.com:80/item.htm?id=38399171122",
"userNumberId": "760761584",
"zkPrice": 128,
"pictUrl": "http://img04.taobaocdn.com/bao/uploaded/i4/T19AhcFGFaXXXXXXXX_!!0-item_pic.jpg",
"title": "爱丽缇 女装夏装2014新款 上衣纯色蝙蝠短袖蕾丝雪纺衫淑女防晒衫",
"groupRate": 0,
"commissionRatePercent": 7,
"nick": "爱丽缇旗舰店",
"shopUrl": "http://store.taobao.com/shop/view_shop.htm?user_number_id=760761584",
"auctionId": "38399171122",
"totalFee": 220.04,
"totalNum": 203,
"commissionRate": 700,
"auctionType": "b",
"p4pPrice": "",
"creativeRate": "",
"zkRate": 6.2,
"biz30day": 391,
"shopKeeperCardURL": null,
"reservePrice": 206,
"commentCount": "4729",
"tradeCount": 0,
"creativeCommissionRatePercent": 0,
"creativeRealRatePercent": 0,
"creativeCalCommission": 0,
"commission": 0,
"commissionMoney": null,
"totalFeeMoney": {
"currency": "CNY",
"currencyCode": "CNY",
"amount": 220.04,
"cent": 22004,
"centFactor": 100,
"displayUnit": "元"
},
"dbId": null,
"calCommission": 8.96,
"groupCommission": 0,
"calCommissionMoney": {
"currency": "CNY",
"currencyCode": "CNY",
"amount": 14.42,
"cent": 1442,
"centFactor": 100,
"displayUnit": "元"
},
"paysubsidyRate": null,
"paysubsidyCommission": null,
"oldCommissionRate": 0,
"hasCommonCampaign": true,
"groupIds": "0",
"groupRates": "0",
"p4pPriceYuan": 0,
"zkType": "手机特惠"
}
*/
#endregion
}
return result;
}