京东价格监控软件开发技术探讨六:京东商品价格详议

在“京东价格监控软件开发技术探讨一:C#实现获取京东商品信息(价格、库存)”中,对如何获取商品价格进行了简单的阐述。

根据博主近期的研究,对京东价格体系有了更多的理解,在这里进行一个比较系统的描述。


	//通过接口获取所有平台价格
	//电脑
	string pcPrice = string.Format("https://p.3.cn/prices/mgets?type=1&skuIds=J_{0}", pid); 
	string pcPrice1 = HttpHelper.GetResponse(pcPrice, "get", string.Empty).Replace("[","").Replace("]\n",""); 
	JdWarePrice pcPrices = JsonConvert.DeserializeObject<JdWarePrice>(pcPrice1); 
	//手机端
	string appPrice = string.Format("https://pm.3.cn/prices/mgets?origin=2&skuids={0}", pid); 
	string appPrice1 = HttpHelper.GetResponse(appPrice, "get", string.Empty).Replace("[", "").Replace("]\n", ""); 
	JdWarePrice appPrices = JsonConvert.DeserializeObject<JdWarePrice>(appPrice1); 
	//QQ
	string qqPrice = string.Format("https://pe.3.cn/prices/mgets?origin=4&skuids={0}", pid); 
	string qqPrice1 = HttpHelper.GetResponse(qqPrice, "get", string.Empty).Replace("[", "").Replace("]\n", ""); 
	JdWarePrice qqPrices = JsonConvert.DeserializeObject<JdWarePrice>(qqPrice1); 
	//微信
	string wxPrice = string.Format("https://pe.3.cn/prices/mgets?origin=5&skuids={0}", pid); 
	string wxPrice1 = HttpHelper.GetResponse(wxPrice, "get", string.Empty).Replace("[", "").Replace("]\n", ""); 
	JdWarePrice wxPrices = JsonConvert.DeserializeObject<JdWarePrice>(wxPrice1);

商品价格的格式定义如下:

    /// <summary>
    /// 商品价格
    /// </summary>
    public class JdWarePrice
    {
        //cnp([{"id":"J_1010527324","p":"129.00","m":"350.00"}]);
        //jQuery5068505([{"id":"202459","pcp":"69.00","p":"59.00","m":"121.00"}]);

        /// <summary>
        /// 商品编号
        /// </summary>
        public string id { get; set; }
        /// <summary>
        /// 网站销售价格/手机专享价/折扣价
        /// </summary>
        public string p { get; set; }
        /// <summary>
        /// 原始价格
        /// </summary>
        public string m { get; set; }
    }


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值