diff --git a/platformapi/jdshopapi/jxshopapi_test.go b/platformapi/jdshopapi/jxshopapi_test.go index 96117255..753397fb 100644 --- a/platformapi/jdshopapi/jxshopapi_test.go +++ b/platformapi/jdshopapi/jxshopapi_test.go @@ -16,6 +16,6 @@ func init() { baseapi.Init(sugarLogger) api = New("de8157b447584885910f429011e49cb93yjq", "E1D746D42474D5F1F1A10CECE75D99F6", "efa7e1d1a22640fa990e6cf164b28608") api.SetCookieWithStr(` - thor=80FAF09E9A09B6E618A68057BDFCFCB8C86E8252DC9F7D3B34572625904FBA0A74B88873C7657CFD518E07B0319B489D0282895A6DF7C0E1C67590D2864D06769657402E80191AB425B126C59F29522AE1C00344E2CF8D60E007F25BB4C1DE11431856BF15070B700ACB33124EA2661AE6D93D1E1A2A4D18A838CB5664BD7DFE61C73899267AC2D01237897F6D808568; + thor=80FAF09E9A09B6E618A68057BDFCFCB83C345398FC0EA96BB93E21F628E09F69ABC4812E3C973FC424A9790F0EFBB575F0B38D3D40ED8C7FE094307204922296A626E5E990526A84EEA9E1F52BE923D06899DA48B400EBFCDB1F7934C84EAE4AA0D9454C7173B79CE6780DC12463FF8101D2D81F1975356E1E062C3B7A5EA9CF6DB6EFEF59F75691F88E2E044ADA79EF; `) } diff --git a/platformapi/jdshopapi/store.go b/platformapi/jdshopapi/store.go index fa8462f8..bbc27198 100644 --- a/platformapi/jdshopapi/store.go +++ b/platformapi/jdshopapi/store.go @@ -181,3 +181,13 @@ func (a *API) QueryEntityStore(storeId int64) (queryEntityStoreResult *QueryEnti } return queryEntityStoreResult, err } + +//获取门店信息2 +//https://open.jd.com/home/home#/doc/api?apiCateId=351&apiId=4972&apiName=jingdong.findStoreInfoByExtStoreId +func (a *API) FindStoreInfoByExtStoreId(storeID int) (queryEntityStoreResult *QueryEntityStoreResult, err error) { + _, err = a.AccessAPI("jingdong.findStoreInfoByExtStoreId", prodURL, map[string]interface{}{ + "extStoreId": storeID, + }) + + return queryEntityStoreResult, err +} diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go index db7959c0..3b770aee 100644 --- a/platformapi/jdshopapi/store_page.go +++ b/platformapi/jdshopapi/store_page.go @@ -193,3 +193,170 @@ func (a *API) NewInfoList(storeID int64) (newInfoListResult *NewInfoListResult, newInfoListResult = newInfoListResult2[0] return newInfoListResult, err } + +type AllOrdersParam struct { + Current int `json:"current"` + PageSize int `json:"pageSize"` + SortName string `json:"sortName"` + OrderID string `json:"orderId"` + SkuName string `json:"skuName"` + OrderCreateDateRange []string `json:"orderCreateDateRange"` + OrderCompleteDateRange []interface{} `json:"orderCompleteDateRange"` + ReceiverName string `json:"receiverName"` + ReceiverTel string `json:"receiverTel"` + UserPin string `json:"userPin"` + SkuID string `json:"skuId"` + LogiNo string `json:"logiNo"` + PaymentType string `json:"paymentType"` + OrderType string `json:"orderType"` + OrderSource string `json:"orderSource"` + DeliveryType string `json:"deliveryType"` + StoreID string `json:"storeId"` + HuoHao string `json:"huoHao"` + OrderStatusArray []interface{} `json:"orderStatusArray"` + SelectedTabName string `json:"selectedTabName"` +} + +type AllOrdersResult struct { + TotalCount int `json:"totalCount"` + Current int `json:"current"` + OrderList []struct { + XiaDanTime interface{} `json:"xiaDanTime"` + ModifiedTime interface{} `json:"modifiedTime"` + CustomsName interface{} `json:"customsName"` + MerchantName interface{} `json:"merchantName"` + CustomsModelName interface{} `json:"customsModelName"` + ProcessStatus interface{} `json:"processStatus"` + StorageAndShipStatus interface{} `json:"storageAndShipStatus"` + ProcessStatusMsg interface{} `json:"processStatusMsg"` + OrderID int64 `json:"orderId"` + SelectedTabName interface{} `json:"selectedTabName"` + VenderID int `json:"venderId"` + OrderCreateTime string `json:"orderCreateTime"` + PaymentConfirmTime string `json:"paymentConfirmTime"` + OrderCompleteTime interface{} `json:"orderCompleteTime"` + OrderItems []struct { + WareID interface{} `json:"wareId"` + SkuID int64 `json:"skuId"` + SkuName string `json:"skuName"` + HuoHao interface{} `json:"huoHao"` + JdPrice float64 `json:"jdPrice"` + SkuNum int `json:"skuNum"` + SkuImg interface{} `json:"skuImg"` + URL string `json:"url"` + ServiceName string `json:"serviceName"` + Imei interface{} `json:"imei"` + SequenceFlag bool `json:"sequenceFlag"` + SequenceInfoList interface{} `json:"sequenceInfoList"` + UpdateCount interface{} `json:"updateCount"` + CertificateFlag bool `json:"certificateFlag"` + CertificateInfoList interface{} `json:"certificateInfoList"` + MedicalInfoFlag bool `json:"medicalInfoFlag"` + MedicalInfoParamVos interface{} `json:"medicalInfoParamVos"` + UniqueCode interface{} `json:"uniqueCode"` + InspectReportID interface{} `json:"inspectReportId"` + } `json:"orderItems"` + PaymentTypeName string `json:"paymentTypeName"` + ShouldPay float64 `json:"shouldPay"` + Freight float64 `json:"freight"` + ServiceFee interface{} `json:"serviceFee"` + Commission float64 `json:"commission"` + CouponFlag bool `json:"couponFlag"` + UserPin string `json:"userPin"` + UserRemark string `json:"userRemark"` + ConsigneeInfo interface{} `json:"consigneeInfo"` + LogiFlag bool `json:"logiFlag"` + LogisticsInfos []interface{} `json:"logisticsInfos"` + StoreName interface{} `json:"storeName"` + CodDT interface{} `json:"codDT"` + ScDT interface{} `json:"scDT"` + OrderStatusStrCN string `json:"orderStatusStrCN"` + OrderStatus int `json:"orderStatus"` + InvalidOrderFlag bool `json:"invalidOrderFlag"` + OrderType int `json:"orderType"` + CustomsModel interface{} `json:"customsModel"` + SalesPin interface{} `json:"salesPin"` + MdbStoreID interface{} `json:"mdbStoreId"` + SuspendType interface{} `json:"suspendType"` + SuspendReason interface{} `json:"suspendReason"` + SuspendReasonDesc interface{} `json:"suspendReasonDesc"` + SuspendDetailReasonFlag interface{} `json:"suspendDetailReasonFlag"` + StoreInfo interface{} `json:"storeInfo"` + IsDivShow bool `json:"isDivShow"` + IsMenDianOrder bool `json:"isMenDianOrder"` + IsMenDianBangOrder bool `json:"isMenDianBangOrder"` + IsMenDianZiTiOrder bool `json:"isMenDianZiTiOrder"` + IsPhoneOrder bool `json:"isPhoneOrder"` + IsReturnOrder bool `json:"isReturnOrder"` + IsPreSaleOrder bool `json:"isPreSaleOrder"` + IsVenderSplitOrder bool `json:"isVenderSplitOrder"` + IsAuctionOrder bool `json:"isAuctionOrder"` + IsLargeAmountOrder bool `json:"isLargeAmountOrder"` + IsMicroShopOrder bool `json:"isMicroShopOrder"` + IsRuralPromotionOrder bool `json:"isRuralPromotionOrder"` + IsHkMacaoOrder bool `json:"isHkMacaoOrder"` + IsTaiWanOrder bool `json:"isTaiWanOrder"` + IsOverseasOrder bool `json:"isOverseasOrder"` + IsDistributionOrder bool `json:"isDistributionOrder"` + IsJdDeliveryOrder bool `json:"isJdDeliveryOrder"` + IsEclpOrder bool `json:"isEclpOrder"` + IsYiPanHuoOrder bool `json:"isYiPanHuoOrder"` + IsJingZunDaOrder bool `json:"isJingZunDaOrder"` + IsBrandMall bool `json:"isBrandMall"` + IsPinGou bool `json:"isPinGou"` + IsYhd bool `json:"isYhd"` + IsXtl bool `json:"isXtl"` + IsSplitOrder bool `json:"isSplitOrder"` + IsCloudWarehouseOrder bool `json:"isCloudWarehouseOrder"` + IsTopLifeOrder bool `json:"isTopLifeOrder"` + IsTuanGou bool `json:"isTuanGou"` + IsDuoBaoDao bool `json:"isDuoBaoDao"` + IsJingPinShi bool `json:"isJingPinShi"` + BizLinkVo struct { + ShowModifyFee bool `json:"showModifyFee"` + ShowSingleOut bool `json:"showSingleOut"` + ShowModifyAddr bool `json:"showModifyAddr"` + ShowDelayDeliveryRemind bool `json:"showDelayDeliveryRemind"` + ShowSplitOrder bool `json:"showSplitOrder"` + ShowMoreLogisticsDelivery bool `json:"showMoreLogisticsDelivery"` + ShowMergeDelivery bool `json:"showMergeDelivery"` + ShowInfoCheck bool `json:"showInfoCheck"` + ShowLivingAuth bool `json:"showLivingAuth"` + ShowModifyWaybill bool `json:"showModifyWaybill"` + } `json:"bizLinkVo"` + IsOut bool `json:"isOut"` + IsMultiLogisticsOutShow bool `json:"isMultiLogisticsOutShow"` + PaimaiOrder int `json:"paimaiOrder"` + CannotModifyProvinceAndCity bool `json:"cannotModifyProvinceAndCity"` + CanWaitInnerShip bool `json:"canWaitInnerShip"` + ShowShangChuanHeTong bool `json:"showShangChuanHeTong"` + ShowManageCertificate bool `json:"showManageCertificate"` + OrderSeqFlag bool `json:"orderSeqFlag"` + CustomInfoFlag bool `json:"customInfoFlag"` + OrderDaYangFlag bool `json:"orderDaYangFlag"` + ShowMedicalInfo bool `json:"showMedicalInfo"` + Card3CFlag bool `json:"card3cFlag"` + ShowOrderPackage bool `json:"showOrderPackage"` + ShowWaybill bool `json:"showWaybill"` + IsGlobalZhiYouOrder bool `json:"isGlobalZhiYouOrder"` + IsGlobalBaoShuiOrder bool `json:"isGlobalBaoShuiOrder"` + ManageImeiFlag bool `json:"manageImeiFlag"` + SpecialViewOrder []interface{} `json:"specialViewOrder"` + } `json:"orderList"` + Cluster interface{} `json:"cluster"` +} + +//尝试扒订单 +//https://porder.shop.jd.com/order/orderlist/allOrders +func (a *API) AllOrders(allOrdersParam *AllOrdersParam) (allOrdersResult *AllOrdersResult, err error) { + result, err := a.AccessStorePage2("https://porder.shop.jd.com/order/orderlist", map[string]interface{}{ + "current": allOrdersParam.Current, + "pageSize": allOrdersParam.PageSize, + "selectedTabName": "allOrders", + "sortName": "desc", + }) + if err == nil { + utils.Map2StructByJson(result, &allOrdersResult, false) + } + return allOrdersResult, err +} diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go index 36feb7ad..b0c1c855 100644 --- a/platformapi/jdshopapi/store_page_test.go +++ b/platformapi/jdshopapi/store_page_test.go @@ -53,3 +53,14 @@ func Test11(t *testing.T) { bodyData, _ := ioutil.ReadAll(response.Body) fmt.Println("test1", string(bodyData)) } + +func TestAllOrders(t *testing.T) { + result, err := api.AllOrders(&AllOrdersParam{ + Current: 1, + PageSize: 10, + }) + if err != nil { + t.Fatal(err) + } + t.Log(utils.Format4Output(result, false)) +} diff --git a/platformapi/jdshopapi/store_test.go b/platformapi/jdshopapi/store_test.go index 06dac8f8..9e8649a4 100644 --- a/platformapi/jdshopapi/store_test.go +++ b/platformapi/jdshopapi/store_test.go @@ -63,7 +63,7 @@ func TestGetCounty(t *testing.T) { } func TestFindSkuSiteStock(t *testing.T) { - result, err := api.FindSkuSiteStock(24337902, 69353673334) + result, err := api.FindSkuSiteStock(24340329, 69353633443) if err != nil { t.Fatal(err) } @@ -71,7 +71,7 @@ func TestFindSkuSiteStock(t *testing.T) { } func TestUpdateSkuSiteStock(t *testing.T) { - err := api.UpdateSkuSiteStock(69353673334, 0, 24337902) + err := api.UpdateSkuSiteStock(69353633443, 0, 24340329) if err != nil { t.Fatal(err) } @@ -85,3 +85,11 @@ func TestQueryEntityStore(t *testing.T) { } t.Log(utils.Format4Output(result, false)) } + +func TestFindStoreInfoByExtStoreId(t *testing.T) { + result, err := api.FindStoreInfoByExtStoreId(666854) + if err != nil { + t.Fatal(err) + } + t.Log(utils.Format4Output(result, false)) +}