|
|
|
using BBWY.Common.Models;
|
|
|
|
using BBWY.JDSDK.Request;
|
|
|
|
using BBWY.Server.Model.Dto;
|
|
|
|
using Jd.Api;
|
|
|
|
using Jd.Api.Request;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using io = System.IO;
|
|
|
|
namespace BBWY.Test
|
|
|
|
{
|
|
|
|
internal class Program
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
{
|
|
|
|
string searchFields = "orderId,venderId,orderType,payType,orderTotalPrice,orderSellerPrice,orderPayment,freightPrice,orderState,orderStateRemark,orderRemark,orderStartTime,orderEndTime,modified,consigneeInfo,itemInfoList,couponDetailList,taxFee,venderRemark,pin,waybill,storeOrder,storeId,sellerDiscount";
|
|
|
|
|
|
|
|
|
|
|
|
IJdClient jdClient = new DefaultJdClient("https://api.jd.com/routerjson", "120EA9EC65AB017567D78CC1139EEEA5", "866a9877f5f24b03b537483b4defe75d");
|
|
|
|
|
|
|
|
var str = "{\"StartDate\":\"2022-05-31 19:11:26\",\"EndDate\":\"2022-05-31 22:11:26\",\"PageIndex\":1,\"PageSize\":100,\"OrderId\":\"\",\"JDColType\":\"0\",\"OrderState\":null,\"Platform\":1,\"AppKey\":\"120EA9EC65AB017567D78CC1139EEEA5\",\"AppSecret\":\"866a9877f5f24b03b537483b4defe75d\",\"AppToken\":\"c638226881394594baed9dfc24d33c28diyn\",\"SaveResponseLog\":true}";
|
|
|
|
|
|
|
|
var searchOrderRequest = JsonConvert.DeserializeObject<SearchPlatformOrderRequest>(str);
|
|
|
|
|
|
|
|
var sopReq = new PopOrderEnSearchRequest();
|
|
|
|
if (searchOrderRequest.StartDate != null)
|
|
|
|
sopReq.startDate = searchOrderRequest.StartDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
if (searchOrderRequest.EndDate != null)
|
|
|
|
sopReq.endDate = searchOrderRequest.EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
if (string.IsNullOrEmpty(searchOrderRequest.OrderState))
|
|
|
|
{
|
|
|
|
//WAIT_SELLER_STOCK_OUT,WAIT_GOODS_RECEIVE_CONFIRM,WAIT_SELLER_DELIVER,PAUSE,FINISHED_L,TRADE_CANCELED,LOCKED
|
|
|
|
sopReq.orderState = "WAIT_SELLER_STOCK_OUT,WAIT_GOODS_RECEIVE_CONFIRM,PAUSE,FINISHED_L,TRADE_CANCELED,LOCKED,NOT_PAY";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sopReq.orderState = searchOrderRequest.OrderState; //待转换
|
|
|
|
}
|
|
|
|
sopReq.optionalFields = searchFields;
|
|
|
|
sopReq.page = searchOrderRequest.PageIndex.ToString();
|
|
|
|
sopReq.pageSize = searchOrderRequest.PageSize.ToString();
|
|
|
|
sopReq.sortType = "1";
|
|
|
|
//sopReq.dateType = "";
|
|
|
|
|
|
|
|
var sopResponse = jdClient.Execute(sopReq, searchOrderRequest.AppToken, DateTime.Now.ToLocalTime());
|
|
|
|
|
|
|
|
if (sopResponse.IsError)
|
|
|
|
throw new BusinessException($"获取SOP订单失败 {(string.IsNullOrEmpty(sopResponse.ErrorMsg) ? sopResponse.ErrMsg : sopResponse.ErrorMsg)}");
|
|
|
|
|
|
|
|
if (sopResponse.Json == null)
|
|
|
|
sopResponse.Json = JObject.Parse(sopResponse.Body);
|
|
|
|
Console.WriteLine(JsonConvert.SerializeObject(sopResponse));
|
|
|
|
//orderCount = sopResponse.Json["jingdong_pop_order_enSearch_responce"]["searchorderinfo_result"].Value<int>("orderTotal");
|
|
|
|
//orderJtokens.AddRange((JArray)sopResponse.Json["jingdong_pop_order_enSearch_responce"]["searchorderinfo_result"]["orderInfoList"]);
|
|
|
|
Console.ReadKey();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|