/// <summary> /// 发货 /// </summary> /// <param name="param">查询参数</param> /// <param name="auth">授权参数</param> /// <returns></returns> public Result SendDelivery(DeliveryParameters param, AuthorizationParameters auth) { IDictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("format", "json"); dic.Add("pureData", "1"); dic.Add("sellerUin", auth.ShopAccount); dic.Add("dealCode", param.MallOrderId); dic.Add("logisticsName", param.CompanyCode); dic.Add("logisticsCode", param.HytExpressNo); dic.Add("arriveDays", "1"); var client = new OpenApiOauth(config.AppOAuthID, config.SecretOAuthKey, long.Parse(auth.ShopAccount), auth.AuthorizationCode); var response = client.InvokeOpenApi("http://api.paipai.com/deal/sellerConsignDealItem.xhtml", dic, null); var result = Hyt.Util.Serialization.JsonUtil.ToObject <LogisticsResult>(response); if (result.errorCode == "0") { return(new Result() { Status = true, StatusCode = 1 }); } else { return(new Result() { Status = false, StatusCode = -1, Message = result.errorMessage }); } }
public static PaiPaiShopInfo GetShopInfo(string uid, string token) { OpenApiOauth client = new OpenApiOauth(oauthId, oauthKey, long.Parse(uid), token); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("sellerUin", uid); dic.Add("charset", "utf-8"); dic.Add("format", "json"); string result = client.InvokeOpenApi("http://api.paipai.com/shop/getShopInfo.xhtml", dic, null); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); PaiPaiShopInfo info = null; try { info = js.Deserialize <PaiPaiShopInfo>(result); } catch (Exception ex) { LogInfo.Add("店铺信息序列化出错", "返回json转化为店铺信息出错,用户QQ号:" + uid + result + ex.Message); } return(info); }
public static string GetGoodsOrderDetailInfo(string uid, string token, string dealcode) { OpenApiOauth client = new OpenApiOauth(oauthId, oauthKey, long.Parse(uid), token); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("sellerUin", uid); dic.Add("charset", "utf-8"); dic.Add("format", "json"); dic.Add("dealCode", dealcode); string result = client.InvokeOpenApi("http://api.paipai.com/deal/getDealDetail.xhtml", dic, null); return(result); }
//public static IList<PaiPaiGoodsInfo> GetGoodsInfo(string uid, string token) //{ // OpenApiOauth client = new OpenApiOauth(oauthId, oauthKey, long.Parse(uid), token); // List<PaiPaiGoodsInfo> mylist = new List<PaiPaiGoodsInfo>(); // int pageindex = 0; // while (true) // { // pageindex++; // Dictionary<string, string> dic = new Dictionary<string, string>(); // dic.Add("sellerUin", uid); // dic.Add("charset", "utf-8"); // dic.Add("format", "json"); // dic.Add("pageSize", "40"); // dic.Add("pageIndex", pageindex.ToString()); // dic.Add("itemState", "1"); // string result = client.InvokeOpenApi("http://api.paipai.com/item/sellerSearchItemList.xhtml", dic, new Dictionary<string, FileItem>()); // System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); // result = result.Substring(result.IndexOf("\"itemList\":[")); // result = result.Replace("\"itemList\":[", "["); // result = result.Substring(0, result.Length - 2); // Regex regex = new Regex("},\"total_results\":\\d+}}"); // result = regex.Replace(result, ""); // try // { // List<PaiPaiGoodsInfo> newList = js.Deserialize<List<PaiPaiGoodsInfo>>(result); // if (newList.Count == 0) // break; // mylist.AddRange(newList); // } // catch (Exception ex) // { // LogInfo.Add("商品序列化出错", "返回json转化为商品信息集合出错,用户QQ号:" + uid + result + ex.Message); // } // } // return mylist; //} //public static void GetBuyInfo(string uid, string token) //{ // OpenApiOauth client = new OpenApiOauth(oauthId, oauthKey, long.Parse(uid), token); // List<PaiPaiGoodsInfo> mylist = new List<PaiPaiGoodsInfo>(); // Dictionary<string, string> dic = new Dictionary<string, string>(); // dic.Add("userUin", uid); // dic.Add("format", "json"); // dic.Add("appId", "229509"); // string result = client.InvokeOpenApi("http://api.buy.qq.com/appstore/getSubscribeList.xhtml?charset=gbk", dic, new Dictionary<string, FileItem>()); //} /// <summary> /// 拍拍接口暂不能用,何时能用未知 /// </summary> /// <param name="uid"></param> /// <param name="token"></param> /// <param name="company">物流公司名称</param> /// <param name="wuliuCarryId">运单号</param> /// <returns></returns> public static string GetTrackInfo(string uid, string token, string company, string wuliuCarryId) { OpenApiOauth client = new OpenApiOauth(oauthId, oauthKey, long.Parse(uid), token); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("sellerUin", uid); dic.Add("charset", "utf-8"); dic.Add("format", "xml"); dic.Add("company", company); dic.Add("wuliuCarryId", wuliuCarryId); string result = client.InvokeOpenApi("http://api.paipai.com/wuliu/getTrackInfo.xhtml", dic, null); return(result); }
public static IList <GoodsOrderInfo> GetGoodsOrderInfo(string uid, string token) { OpenApiOauth client = new OpenApiOauth(oauthId, oauthKey, long.Parse(uid), token); List <GoodsOrderInfo> list = new List <GoodsOrderInfo>(); int pageindex = 0; while (true) { pageindex++; Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("sellerUin", uid); dic.Add("charset", "utf-8"); dic.Add("format", "json"); dic.Add("pageSize", "20"); dic.Add("pageIndex", pageindex.ToString()); string result = client.InvokeOpenApi("http://api.paipai.com/deal/sellerSearchDealList.xhtml", dic, null); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); result = result.Substring(result.IndexOf("\"dealList\":[")); result = result.Replace("\"dealList\":[", "["); result = result.Substring(0, result.Length - 2); //Regex regex = new Regex("},\"total_results\":\\d+}}"); //result = regex.Replace(result, ""); try { List <GoodsOrderInfo> newList = js.Deserialize <List <GoodsOrderInfo> >(result); if (newList.Count == 0) { break; } list.AddRange(newList); } catch (Exception ex) { LogInfo.Add("订单序列化出错", "返回json转化为订单信息集合出错,用户QQ号:" + uid + result + ex.Message); } } return(list); }
/// <summary> /// 获取拍拍订单详情 /// </summary> /// <param name="param">查询参数</param> /// <param name="auth">授权参数</param> /// <returns>拍拍订单详情</returns> /// <remarks>2013-11-10 陶辉 创建</remarks> public Result <UpGradeOrder> GetOrderDetail(OrderParameters param, AuthorizationParameters auth) { IDictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("format", "json"); dic.Add("pureData", "1"); dic.Add("sellerUin", auth.ShopAccount); dic.Add("dealCode", param.OrderID); dic.Add("listItem", "1"); var client = new OpenApiOauth(config.AppOAuthID, config.SecretOAuthKey, long.Parse(auth.ShopAccount), auth.AuthorizationCode); var response = client.InvokeOpenApi("http://api.paipai.com/deal/getDealDetail.xhtml", dic, null); var result = Hyt.Util.Serialization.JsonUtil.ToObject <DealInfo>(response); if (result.errorCode == "0") { var order = new UpGradeOrder(); Map(result, order); return(new Result <UpGradeOrder>() { Status = true, StatusCode = 1, Data = order }); } else { return(new Result <UpGradeOrder>() { Status = false, StatusCode = -1, Message = result.errorMessage, Data = null }); } }
/// <summary> /// 获取拍拍订单列表 /// </summary> /// <param name="param">查询参数</param> /// <param name="auth">授权参数</param> /// <returns>拍拍订单列表</returns> /// <remarks>2013-11-10 陶辉 创建</remarks> public Result <List <UpGradeOrder> > GetOrderList(OrderParameters param, AuthorizationParameters auth) { #region 查询条件 IDictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("format", "json"); dic.Add("pureData", "1"); dic.Add("sellerUin", auth.ShopAccount); dic.Add("timeType", "PAY"); dic.Add("timeBegin", param.StartDate.ToString()); dic.Add("timeEnd", param.EndDate.ToString()); dic.Add("dealState", "DS_WAIT_SELLER_DELIVERY"); if (param.IsUseFlag) { dic.Add("dealNoteType", config.DealNoteType); } if (!string.IsNullOrEmpty(param.ProductCode)) { dic.Add("itemCode", param.ProductCode); } if (!string.IsNullOrEmpty(param.ProductName)) { dic.Add("itemNameKey", param.ProductName); } if (!string.IsNullOrEmpty(param.OrderID)) { dic.Add("dealCode", param.OrderID); } #endregion var client = new OpenApiOauth(config.AppOAuthID, config.SecretOAuthKey, long.Parse(auth.ShopAccount), auth.AuthorizationCode); var response = client.InvokeOpenApi("http://api.paipai.com/deal/sellerSearchDealList.xhtml", dic, null); var result = Hyt.Util.Serialization.JsonUtil.ToObject <PaipaiResult>(response); if (result.errorCode == "0") { var list = new List <UpGradeOrder>(); //总页数 var pageCount = result.pageTotal; while (pageCount > 0) { if (dic.ContainsKey("pageIndex")) { dic["pageIndex"] = pageCount.ToString(); } else { dic.Add("pageIndex", pageCount.ToString()); } dic.Remove("sign"); response = client.InvokeOpenApi("http://api.paipai.com/deal/sellerSearchDealList.xhtml", dic, null); result = Hyt.Util.Serialization.JsonUtil.ToObject <PaipaiResult>(response); if (result.errorCode == "0") { foreach (DealInfo deal in result.dealList) { var order = new UpGradeOrder(); Map(deal, order); order.MallOrderBuyer.SellerFlag = deal.dealNoteType; list.Add(order); } } pageCount--; } list = FilterMallOrder(list, param); return(new Result <List <UpGradeOrder> >() { Status = true, StatusCode = 1, Data = list }); } else { return(new Result <List <UpGradeOrder> >() { Status = false, StatusCode = -1, Message = result.errorMessage, Data = null }); } }