Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
L
library
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
stbz
library
Commits
081c051c
提交
081c051c
authored
6月 09, 2022
作者:
zhanglibo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
京东订单
上级
5628fbca
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
159 行增加
和
119 行删除
+159
-119
jingdong_deliver.go
upstream/jingdong/jingdong_deliver.go
+46
-0
jingdong_order.go
upstream/jingdong/jingdong_order.go
+87
-79
jingdong_refund.go
upstream/jingdong/jingdong_refund.go
+26
-40
没有找到文件。
upstream/jingdong/jingdong_deliver.go
0 → 100644
浏览文件 @
081c051c
package
jingdong
import
(
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
type
deliveryJD
struct
{
}
var
Delivery
=
deliveryJD
{}
//DeliveryDetailRes 物流轨迹
type
DeliveryDetailRes
struct
{
*
CommonRes
Result
struct
{
OrderTrack
[]
struct
{
Content
string
`json:"content"`
//操作内容明细
MsgTime
string
`json:"msgTime"`
//操作时间。日期格式为“yyyy-MM-dd hh:mm:ss”
Operator
string
`json:"operator"`
//操作员名称
}
`json:"orderTrack"`
WaybillCode
[]
struct
{
OrderID
string
`json:"orderId"`
//订单号
ParentID
string
`json:"parentId"`
//父订单号。 此字段为0 未拆单
Carrier
string
`json:"carrier"`
//承运商
DeliveryOrderID
string
`json:"deliveryOrderId"`
//运单号
}
`json:"waybillCode"`
JdOrderID
int
`json:"jdOrderId"`
}
`json:"result"`
}
// Detail 物流信息
func
(
*
deliveryJD
)
Detail
(
ctx
context
.
Context
,
OrderID
string
)
(
res
*
DeliveryDetailRes
,
err
error
)
{
method
:=
"order/orderTrack"
param
:=
g
.
Map
{
"jdOrderId"
:
OrderID
,
"waybillCode"
:
"1"
,
}
result
,
err
:=
server
.
requestApi
(
ctx
,
method
,
param
)
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
upstream/jingdong/jingdong_order.go
浏览文件 @
081c051c
...
...
@@ -12,33 +12,14 @@ type orderJD struct {
//Order 订单
var
Order
=
orderJD
{}
//GetDeliveryRes 物流轨迹
type
GetDeliveryRes
struct
{
*
CommonRes
Result
struct
{
OrderTrack
[]
struct
{
Content
string
`json:"content"`
//操作内容明细
MsgTime
string
`json:"msgTime"`
//操作时间。日期格式为“yyyy-MM-dd hh:mm:ss”
Operator
string
`json:"operator"`
//操作员名称
}
`json:"orderTrack"`
WaybillCode
[]
struct
{
OrderID
string
`json:"orderId"`
//订单号
ParentID
string
`json:"parentId"`
//父订单号。 此字段为0 未拆单
Carrier
string
`json:"carrier"`
//承运商
DeliveryOrderID
string
`json:"deliveryOrderId"`
//运单号
}
`json:"waybillCode"`
JdOrderID
int
`json:"jdOrderId"`
}
`json:"result"`
}
//PriceSnap 商品价格
type
PriceSnap
struct
{
SkuID
int
`json:"skuId"`
//商品编号
Price
float64
`json:"price"`
//商品价格 格式:21.30
}
//
PlaceOrder
Req 下单
type
PlaceOrder
Req
struct
{
//
OrderCreate
Req 下单
type
OrderCreate
Req
struct
{
OrderSn
string
//订单单号
SkuNums
[]
*
SkuNums
Consignee
string
//收货人姓名,最多20个字符
...
...
@@ -57,8 +38,8 @@ type PlaceOrderAddress struct {
Desc
string
//收货人详细地址,最多100个字符
}
//
PlaceOrder
Res 下单
type
PlaceOrder
Res
struct
{
//
OrderCreate
Res 下单
type
OrderCreate
Res
struct
{
*
CommonRes
Result
struct
{
JdOrderID
int64
`json:"jdOrderId"`
//京东订单号
...
...
@@ -78,45 +59,62 @@ type OrderSkuItem struct {
NakedPrice
float64
`json:"nakedPrice"`
//商品未税价
}
//
ReflectOrder
Res 反查订单
type
ReflectOrder
Res
struct
{
//
OrderReflect
Res 反查订单
type
OrderReflect
Res
struct
{
*
CommonRes
Result
string
`json:"result"`
//第三方订单号(非京东订单号)
}
//GetOrderRes 订单详情
type
GetOrderRes
struct
{
type
OrderDetailBase
struct
{
*
CommonRes
Result
struct
{
JdOrderID
int64
`json:"jdOrderId"`
//京东订单编号
Type
int
`json:"type"`
//订单类型。1是父订单 2是子订单
Freight
float64
`json:"freight"`
//运费
OrderPrice
float64
`json:"orderPrice"`
//订单总金额
OrderNakedPrice
float64
`json:"orderNakedPrice"`
//订单未含税金额
OrderTaxPrice
float64
`json:"orderTaxPrice"`
//订单税额
Sku
[]
*
OrderSkuItem
`json:"sku"`
//商品列表
OrderState
int
`json:"orderState"`
//订单状态。0为取消订单 1为有效
State
int
`json:"state"`
//物流状态。0 是新建 1是妥投 2是拒收
POrder
struct
{
JdOrderID
int64
`json:"jdOrderId"`
//京东订单编号
Freight
float64
`json:"freight"`
//运费
OrderPrice
float64
`json:"orderPrice"`
//订单总金额
OrderNakedPrice
float64
`json:"orderNakedPrice"`
//订单未含税金额
Sku
[]
*
OrderSkuItem
`json:"sku"`
//商品列表
}
`json:"pOrder"`
COrder
[]
struct
{
POrder
string
`json:"pOrder"`
//父订单号。为0时,此订单为父单。
JdOrderID
int
`json:"jdOrderId"`
//京东订单编号
Freight
float64
`json:"freight"`
//运费
OrderPrice
float64
`json:"orderPrice"`
//订单总金额
OrderNakedPrice
float64
`json:"orderNakedPrice"`
//订单未含税金额
Sku
[]
OrderSkuItem
`json:"sku"`
//商品列表
}
`json:"cOrder"`
JdOrderID
int64
`json:"jdOrderId"`
//京东订单编号
Type
int
`json:"type"`
//订单类型。1是父订单 2是子订单
}
}
//OrderDetailRes 订单详情
type
OrderDetailRes
struct
{
CommonRes
Result
struct
{
SubmitState
int
`json:"submitState"`
//预占确认状态。0没确认预占。 1已确认预占。
Type
int
`json:"type"`
//订单类型。1是父订单 2是子订单
OrderState
int
`json:"orderState"`
//订单状态。0为取消订单 1为有效
POrder
OrderDetailPOrder
`json:"pOrder"`
COrder
[]
OrderDetailCOrder
`json:"cOrder"`
}
`json:"result"`
}
//GetFreightRes 运费
type
GetFreightRes
struct
{
type
OrderDetailPOrder
struct
{
JdOrderId
int64
`json:"jdOrderId"`
//京东主订单编号
Freight
float64
`json:"freight"`
//运费
OrderPrice
float64
`json:"orderPrice"`
//订单总金额
OrderNakedPrice
float64
`json:"orderNakedPrice"`
//订单未含税金额
Sku
[]
OrderSkuItem
`json:"sku"`
//商品列表
OrderTaxPrice
float64
`json:"orderTaxPrice"`
//订单税额
}
type
OrderDetailCOrder
struct
{
POrder
int64
`json:"pOrder"`
//京东主订单编号
OrderState
int
`json:"orderState"`
JdOrderId
int64
`json:"jdOrderId"`
//京东子订单编号
State
int
`json:"state"`
Freight
float64
`json:"freight"`
SubmitState
int
`json:"submitState"`
OrderPrice
float64
`json:"orderPrice"`
OrderNakedPrice
float64
`json:"orderNakedPrice"`
Type
int
`json:"type"`
//商品类型。 0 普通、1 附件、2 赠品、3延保
Sku
[]
OrderSkuItem
`json:"sku"`
OrderTaxPrice
float64
`json:"orderTaxPrice"`
}
type
OrderDetailChild
struct
{
CommonRes
Result
OrderDetailCOrder
`json:"result"`
}
//OrderFreightRes 运费
type
OrderFreightRes
struct
{
*
CommonRes
Result
struct
{
Freight
float64
`json:"freight"`
//总运费
...
...
@@ -131,23 +129,8 @@ type SkuNums struct {
Num
int
`json:"num"`
//商品数量
}
// GetDelivery 物流信息
func
(
*
orderJD
)
GetDelivery
(
ctx
context
.
Context
,
OrderID
string
)
(
res
*
GetDeliveryRes
,
err
error
)
{
method
:=
"order/orderTrack"
param
:=
g
.
Map
{
"jdOrderId"
:
OrderID
,
"waybillCode"
:
"1"
,
}
result
,
err
:=
server
.
requestApi
(
ctx
,
method
,
param
)
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
// PlaceOrder 下单
func
(
*
orderJD
)
PlaceOrder
(
ctx
context
.
Context
,
req
*
PlaceOrderReq
)
(
res
*
PlaceOrderRes
,
err
error
)
{
// Create 下单
func
(
*
orderJD
)
Create
(
ctx
context
.
Context
,
req
*
OrderCreateReq
)
(
res
*
OrderCreateRes
,
err
error
)
{
method
:=
"order/submitOrder"
var
param
=
g
.
Map
{
"thirdOrder"
:
req
.
OrderSn
,
...
...
@@ -180,8 +163,8 @@ func (*orderJD) PlaceOrder(ctx context.Context, req *PlaceOrderReq) (res *PlaceO
return
}
// Reflect
Order
反查订单
func
(
*
orderJD
)
Reflect
Order
(
ctx
context
.
Context
,
thirdOrder
string
)
(
res
*
ReflectOrder
Res
,
err
error
)
{
// Reflect 反查订单
func
(
*
orderJD
)
Reflect
(
ctx
context
.
Context
,
thirdOrder
string
)
(
res
*
OrderReflect
Res
,
err
error
)
{
method
:=
"order/selectJdOrderIdByThirdOrder"
param
:=
g
.
Map
{
"thirdOrder"
:
thirdOrder
,
...
...
@@ -194,22 +177,47 @@ func (*orderJD) ReflectOrder(ctx context.Context, thirdOrder string) (res *Refle
return
}
//
GetOrderInfo
订单详情
func
(
*
orderJD
)
GetOrderInfo
(
ctx
context
.
Context
,
OrderID
string
)
(
res
*
GetOrder
Res
,
err
error
)
{
//
Detail
订单详情
func
(
*
orderJD
)
Detail
(
ctx
context
.
Context
,
OrderID
string
)
(
res
*
OrderDetail
Res
,
err
error
)
{
method
:=
"order/selectJdOrder"
param
:=
g
.
Map
{
"jdOrderId"
:
OrderID
,
}
result
,
err
:=
server
.
requestApi
(
ctx
,
method
,
param
)
if
err
!=
nil
{
return
}
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
var
base
*
OrderDetailBase
_
=
gjson
.
New
(
result
)
.
Scan
(
&
base
)
if
base
.
Result
.
Type
==
1
{
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
else
{
var
child
*
OrderDetailChild
_
=
gjson
.
New
(
result
)
.
Scan
(
&
child
)
res
=
&
OrderDetailRes
{}
res
.
CommonRes
=
child
.
CommonRes
res
.
Result
.
Type
=
child
.
Result
.
Type
res
.
Result
.
SubmitState
=
child
.
Result
.
SubmitState
res
.
Result
.
OrderState
=
child
.
Result
.
OrderState
res
.
Result
.
POrder
=
OrderDetailPOrder
{
JdOrderId
:
child
.
Result
.
JdOrderId
,
Freight
:
child
.
Result
.
Freight
,
OrderPrice
:
child
.
Result
.
OrderPrice
,
OrderNakedPrice
:
child
.
Result
.
OrderNakedPrice
,
OrderTaxPrice
:
child
.
Result
.
OrderTaxPrice
,
Sku
:
child
.
Result
.
Sku
,
}
res
.
Result
.
COrder
=
append
(
res
.
Result
.
COrder
,
child
.
Result
)
}
return
}
//
GetFreight
查询运费
func
(
*
orderJD
)
GetFreight
(
ctx
context
.
Context
,
sku
[]
*
SkuNums
,
province
,
city
,
county
,
town
string
)
(
res
*
Get
FreightRes
,
err
error
)
{
//
Freight
查询运费
func
(
*
orderJD
)
Freight
(
ctx
context
.
Context
,
sku
[]
*
SkuNums
,
province
,
city
,
county
,
town
string
)
(
res
*
Order
FreightRes
,
err
error
)
{
method
:=
"order/getFreight"
param
:=
g
.
Map
{
"sku"
:
gjson
.
New
(
sku
)
.
MustToJsonString
(),
...
...
@@ -227,8 +235,8 @@ func (*orderJD) GetFreight(ctx context.Context, sku []*SkuNums, province, city,
return
}
// Confirm
Received
确认收货
func
(
*
orderJD
)
Confirm
Received
(
ctx
context
.
Context
,
OrderID
string
)
(
res
*
CommonRes
,
err
error
)
{
// Confirm 确认收货
func
(
*
orderJD
)
Confirm
(
ctx
context
.
Context
,
OrderID
string
)
(
res
*
CommonRes
,
err
error
)
{
method
:=
"order/confirmReceived"
param
:=
g
.
Map
{
"jdOrderId"
:
OrderID
,
...
...
upstream/jingdong/jingdong_refund.go
浏览文件 @
081c051c
...
...
@@ -13,7 +13,7 @@ type refundJD struct {
var
Refund
=
refundJD
{}
type
RefundCancelRes
struct
{
*
CommonRes
CommonRes
Result
bool
`json:"result"`
}
...
...
@@ -66,8 +66,8 @@ type GetServiceListReq struct {
PageSize
int
`json:"pageSize"`
//每页记录数, 大小取值范围[1,100]
}
type
GetService
ListRes
struct
{
*
CommonRes
type
Refund
ListRes
struct
{
CommonRes
Result
struct
{
TotalNum
int
`json:"totalNum"`
//总记录数
PageSize
int
`json:"pageSize"`
//每页记录数
...
...
@@ -81,8 +81,8 @@ type GetServiceListRes struct {
}
`json:"result"`
}
type
GetService
DetailRes
struct
{
*
CommonRes
type
Refund
DetailRes
struct
{
CommonRes
Result
struct
{
AfsServiceId
int
`json:"afsServiceId"`
//京东售后服务单号
CustomerExpect
int
`json:"customerExpect"`
//服务类型码:退货(10)、换货(20)、维修(20)
...
...
@@ -119,13 +119,13 @@ type RefundCommonReq struct {
SkuID
string
`json:"skuId"`
//商品编号
}
type
Check
IsSupportRes
struct
{
*
CommonRes
type
Refund
IsSupportRes
struct
{
CommonRes
Result
int
`json:"result"`
//可申请时返回可申请数量
}
type
Get
SupportTypeRes
struct
{
*
CommonRes
type
Refund
SupportTypeRes
struct
{
CommonRes
Result
[]
*
CodeItem
`json:"result"`
//服务类型码:退货(10)、换货(20)、维修(30) 服务类型名称:退货、换货、维修
}
...
...
@@ -134,12 +134,12 @@ type CodeItem struct {
Name
string
`json:"name"`
//名称
}
type
Get
ReturnTypeRes
struct
{
*
CommonRes
type
Refund
ReturnTypeRes
struct
{
CommonRes
Result
[]
*
CodeItem
`json:"result"`
//服务类型码:上门取件(4)、客户发货(40)、客户送货(7) 服务类型名称:上门取件、客户发货、客户送货
}
type
UpdateSendSku
Req
struct
{
type
RefundSend
Req
struct
{
AfsServiceId
string
`json:"afsServiceId"`
DeliverDate
string
`json:"deliverDate"`
ExpressCode
string
`json:"expressCode"`
...
...
@@ -147,8 +147,8 @@ type UpdateSendSkuReq struct {
FreightMoney
int
`json:"freightMoney"`
}
//
UpdateSendSku
根据填写单号
func
(
*
refundJD
)
UpdateSendSku
(
ctx
context
.
Context
,
req
*
UpdateSendSku
Req
)
(
res
*
CommonRes
,
err
error
)
{
//
Send
根据填写单号
func
(
*
refundJD
)
Send
(
ctx
context
.
Context
,
req
*
RefundSend
Req
)
(
res
*
CommonRes
,
err
error
)
{
method
:=
"afterSale/updateSendSku"
param
:=
g
.
Map
{
"param"
:
gjson
.
New
(
req
)
.
MustToJsonString
(),
...
...
@@ -161,22 +161,8 @@ func (*refundJD) UpdateSendSku(ctx context.Context, req *UpdateSendSkuReq) (res
return
}
//AuditCancel 取消服务单
func
(
*
refundJD
)
AuditCancel
(
ctx
context
.
Context
,
postData
string
)
(
res
*
CommonRes
,
err
error
)
{
method
:=
"afterSale/auditCancel"
param
:=
g
.
Map
{
"param"
:
postData
,
}
result
,
err
:=
server
.
requestApi
(
ctx
,
method
,
param
)
if
err
!=
nil
{
return
}
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
//RefundCancel 取消售后
func
(
*
refundJD
)
RefundCancel
(
ctx
context
.
Context
,
id
interface
{})
(
res
*
RefundCancelRes
,
err
error
)
{
//Cancel 取消售后
func
(
*
refundJD
)
Cancel
(
ctx
context
.
Context
,
id
interface
{})
(
res
*
RefundCancelRes
,
err
error
)
{
method
:=
"afterSale/auditCancel"
req
:=
g
.
Map
{
"serviceIdList"
:
gconv
.
Ints
(
id
),
...
...
@@ -207,8 +193,8 @@ func (*refundJD) Apply(ctx context.Context, req *ApplyReq) (res *CommonRes, err
return
}
//
GetService
List 查询服务单根据客户账号和订单号分页查询服务单概要信息
func
(
*
refundJD
)
GetServiceList
(
ctx
context
.
Context
,
OrderSn
string
)
(
res
*
GetService
ListRes
,
err
error
)
{
//List 查询服务单根据客户账号和订单号分页查询服务单概要信息
func
(
*
refundJD
)
List
(
ctx
context
.
Context
,
OrderSn
string
)
(
res
*
Refund
ListRes
,
err
error
)
{
method
:=
"afterSale/getServiceListPage"
param
:=
g
.
Map
{
"param"
:
gjson
.
New
(
&
GetServiceListReq
{
...
...
@@ -225,8 +211,8 @@ func (*refundJD) GetServiceList(ctx context.Context, OrderSn string) (res *GetSe
return
}
//
GetService
Detail 根据服务单号查询服务单明细信息
func
(
*
refundJD
)
GetServiceDetail
(
ctx
context
.
Context
,
req
string
)
(
res
*
GetService
DetailRes
,
err
error
)
{
//Detail 根据服务单号查询服务单明细信息
func
(
*
refundJD
)
Detail
(
ctx
context
.
Context
,
req
string
)
(
res
*
Refund
DetailRes
,
err
error
)
{
method
:=
"afterSale/getServiceDetailInfo"
var
reqJson
=
gjson
.
New
(
""
)
_
=
reqJson
.
Set
(
"afsServiceId"
,
req
)
...
...
@@ -241,8 +227,8 @@ func (*refundJD) GetServiceDetail(ctx context.Context, req string) (res *GetServ
return
}
//
Check
IsSupport 查询订单商品是否允许售后
func
(
*
refundJD
)
CheckIsSupport
(
ctx
context
.
Context
,
req
*
RefundCommonReq
)
(
res
*
Check
IsSupportRes
,
err
error
)
{
// IsSupport 查询订单商品是否允许售后
func
(
*
refundJD
)
IsSupport
(
ctx
context
.
Context
,
req
*
RefundCommonReq
)
(
res
*
Refund
IsSupportRes
,
err
error
)
{
method
:=
"afterSale/getAvailableNumberComp"
param
:=
g
.
Map
{
"param"
:
gjson
.
New
(
req
)
.
MustToJsonString
(),
...
...
@@ -255,8 +241,8 @@ func (*refundJD) CheckIsSupport(ctx context.Context, req *RefundCommonReq) (res
return
}
//
Get
SupportType 查询订单商品售后类型
func
(
*
refundJD
)
GetSupportType
(
ctx
context
.
Context
,
req
*
RefundCommonReq
)
(
res
*
Get
SupportTypeRes
,
err
error
)
{
// SupportType 查询订单商品售后类型
func
(
*
refundJD
)
SupportType
(
ctx
context
.
Context
,
req
*
RefundCommonReq
)
(
res
*
Refund
SupportTypeRes
,
err
error
)
{
method
:=
"afterSale/getCustomerExpectComp"
param
:=
g
.
Map
{
"param"
:
gjson
.
New
(
req
)
.
MustToJsonString
(),
...
...
@@ -270,8 +256,8 @@ func (*refundJD) GetSupportType(ctx context.Context, req *RefundCommonReq) (res
return
}
//
Get
ReturnType 查询支持的商品返回京东方式
func
(
*
refundJD
)
GetReturnType
(
ctx
context
.
Context
,
req
*
RefundCommonReq
)
(
res
*
Get
ReturnTypeRes
,
err
error
)
{
// ReturnType 查询支持的商品返回京东方式
func
(
*
refundJD
)
ReturnType
(
ctx
context
.
Context
,
req
*
RefundCommonReq
)
(
res
*
Refund
ReturnTypeRes
,
err
error
)
{
method
:=
"afterSale/getWareReturnJdComp"
param
:=
g
.
Map
{
"param"
:
gjson
.
New
(
req
)
.
MustToJsonString
(),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论