京东sdk处理

finance
杨赟 2 years ago
parent 9c45768c4e
commit 6b15e8268d

@ -3,9 +3,11 @@ module git.oa00.com/supply-chain/service
go 1.18
require (
git.oa00.com/go/jdsdk v1.0.0
github.com/rpcxio/rpcx-consul v0.0.0-20220730062257-1ff0472e730f
github.com/shopspring/decimal v1.3.1
github.com/smallnest/rpcx v1.7.8
golang.org/x/net v0.0.0-20220708220712-1185a9018129
)
require (
@ -66,7 +68,6 @@ require (
github.com/xtaci/kcp-go v5.4.20+incompatible // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d // indirect
golang.org/x/tools v0.1.11 // indirect

@ -7,6 +7,8 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
git.oa00.com/go/jdsdk v1.0.0 h1:xsxZlcPrRoJ47PNU49Xtb+m8K/XaHu3pDljSSd9lYAo=
git.oa00.com/go/jdsdk v1.0.0/go.mod h1:ZLdq5OMaXWHO9wtXJflhysp3cSVLRJHbxHLE1DpKYdY=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/akutz/memconn v0.1.0 h1:NawI0TORU4hcOMsMr11g7vwlCdkYeLKXBcxWu2W/P8A=

@ -1,8 +1,11 @@
package jd
import "git.oa00.com/supply-chain/service/jd/jdsdk"
type Jd struct {
Task task
Brand brand
Category category
Sku sku
Jdsdk jdsdk.Jdsdk
}

@ -0,0 +1,20 @@
package jdsdk
import (
"context"
order2 "git.oa00.com/go/jdsdk/order"
"git.oa00.com/supply-chain/service/client"
)
type afterSale struct {
}
// Info @Title 售后详情
func (a *afterSale) Info(ctx context.Context, afsServiceId uint64) (reply order2.AfterSaleInfo, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", afsServiceId, &reply)
return
}

@ -0,0 +1,7 @@
package jdsdk
type Jdsdk struct {
Order order
Sku sku
AfterSale afterSale
}

@ -0,0 +1,20 @@
package jdsdk
import (
"context"
order2 "git.oa00.com/go/jdsdk/order"
"git.oa00.com/supply-chain/service/client"
)
type order struct {
}
// Cancel @Title 订单取消 京东订单id
func (o *order) Cancel(ctx context.Context, orderId string) (reply order2.OrderInfo, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(ctx, "Cancel", orderId, &reply)
return
}

@ -0,0 +1,30 @@
package jdsdk
import (
"context"
sku2 "git.oa00.com/go/jdsdk/sku"
"git.oa00.com/supply-chain/service/client"
)
type sku struct {
}
// GetDetail @Title 获取商品详情 sku最大20
func (s *sku) GetDetail(ctx context.Context, jdSkuIds []uint64) (reply []sku2.Detail, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "GetDetail", jdSkuIds, &reply)
return
}
// GetPriceList @Title 获取商品价格列表 最大100
func (s *sku) GetPriceList(ctx context.Context, jdSkuIds []uint64) (reply []sku2.PriceItem, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "GetPriceList", jdSkuIds, &reply)
return
}
Loading…
Cancel
Save