提交 9cbfe24e authored 作者: gukai's avatar gukai

Merge remote-tracking branch 'origin/master'

## stbz/library
胜天半子内部调用库
## 地址
https://gitlab.jxhh.com/stbz/library
## 限制
golang版本 >= 1.16
## 使用方法
```golang
package main
import (
"github.com/gogf/gf/net/ghttp"
"gitlab.jxhh.com/stbz/library.git/upstream/jingdong"
)
//初始化配置【可在boot使用】
var conf *jingdong.Config
_ = g.Cfg().GetStruct("jd", &conf)
jingdong.New(conf)
//订单详情
InfoRes,err:=jingdong.Order.GetOrderInfo(ctx, "236317795961")
g.Dump(InfoRes)
g.Dump(err)
//地址解析
ParseRes, err := jingdong.Address.Parse(ctx, "四川省成都市武侯区天府四街保利星座5栋")
g.Dump(ParseRes)
g.Dump(err)
```
...@@ -15,9 +15,9 @@ type goodsJD struct { ...@@ -15,9 +15,9 @@ type goodsJD struct {
var Goods = goodsJD{} var Goods = goodsJD{}
type CheckSaleRes struct { type CheckSaleRes struct {
*CommonRes CommonRes
Result []struct { Result []struct {
SkuId int `json:"skuid"` //商品编号 SkuId int64 `json:"skuid"` //商品编号
Name string `json:"name"` //商品名称 Name string `json:"name"` //商品名称
SaleState int `json:"saleState"` //是否可售 1:是,0:否 SaleState int `json:"saleState"` //是否可售 1:是,0:否
IsCanVAT int `json:"isCanVAT"` //是否可开增票,1:支持,0:不支持 IsCanVAT int `json:"isCanVAT"` //是否可开增票,1:支持,0:不支持
...@@ -26,21 +26,21 @@ type CheckSaleRes struct { ...@@ -26,21 +26,21 @@ type CheckSaleRes struct {
} }
type CheckOnSaleRes struct { type CheckOnSaleRes struct {
*CommonRes CommonRes
Result []struct { Result []struct {
Sku int `json:"sku"` //商品编号 Sku int64 `json:"sku"` //商品编号
State int `json:"state"` //1:上架,0:下架 State int `json:"state"` //1:上架,0:下架
} `json:"result"` } `json:"result"`
} }
type GetStockMidRes struct { type GetStockMidRes struct {
*CommonRes CommonRes
Result string `json:"result"` Result string `json:"result"`
} }
type GetStockRes struct { type GetStockRes struct {
*CommonRes CommonRes
Result []struct { Result []struct {
SkuID int `json:"skuId"` //商品编号 SkuID int64 `json:"skuId"` //商品编号
AreaID string `json:"areaId"` //入参时传入的区域码area。因京东目前是3、4级地址均支持,存在areaId在传入的3级地址后填充4级地址“_0“后返回的情况。 AreaID string `json:"areaId"` //入参时传入的区域码area。因京东目前是3、4级地址均支持,存在areaId在传入的3级地址后填充4级地址“_0“后返回的情况。
StockStateID int `json:"stockStateId"` //存状态编号。 参考枚举值: 33,39,40,36,34,99 StockStateID int `json:"stockStateId"` //存状态编号。 参考枚举值: 33,39,40,36,34,99
StockStateDesc string `json:"StockStateDesc"` /*库存状态描述。以下为stockStateId不同时,此字段不同的返回值: StockStateDesc string `json:"StockStateDesc"` /*库存状态描述。以下为stockStateId不同时,此字段不同的返回值:
...@@ -54,22 +54,22 @@ type GetStockRes struct { ...@@ -54,22 +54,22 @@ type GetStockRes struct {
} }
type CheckAreaMidRes struct { type CheckAreaMidRes struct {
*CommonRes CommonRes
Result string `json:"result"` Result string `json:"result"`
} }
type CheckAreaLimitRes struct { type CheckAreaLimitRes struct {
*CommonRes CommonRes
Result []struct { Result []struct {
SkuID int `json:"skuId"` //商品编码 SkuID int64 `json:"skuId"` //商品编码
IsAreaRestrict bool `json:"isAreaRestrict"` //true 代表区域受限 false 区域不受限 IsAreaRestrict bool `json:"isAreaRestrict"` //true 代表区域受限 false 区域不受限
} `json:"result"` } `json:"result"`
} }
type GetProductsPriceRes struct { type GetProductsPriceRes struct {
*CommonRes CommonRes
Result []struct { Result []struct {
SkuID int `json:"skuId"` //商品编码 SkuID int64 `json:"skuId"` //商品编码
Price float64 `json:"price"` //京东销售价 Price float64 `json:"price"` //京东销售价
JdPrice float64 `json:"jdPrice"` //京东价 JdPrice float64 `json:"jdPrice"` //京东价
MarketPrice float64 `json:"marketPrice"` //京东的前台划线价 MarketPrice float64 `json:"marketPrice"` //京东的前台划线价
...@@ -77,7 +77,7 @@ type GetProductsPriceRes struct { ...@@ -77,7 +77,7 @@ type GetProductsPriceRes struct {
} }
type GetDetailRes struct { type GetDetailRes struct {
*CommonRes CommonRes
Result struct { Result struct {
SaleUnit string `json:"saleUnit"` //售卖单位 SaleUnit string `json:"saleUnit"` //售卖单位
Weight string `json:"weight"` //重量 Weight string `json:"weight"` //重量
...@@ -85,7 +85,7 @@ type GetDetailRes struct { ...@@ -85,7 +85,7 @@ type GetDetailRes struct {
WareQD string `json:"wareQD"` //包装清单 WareQD string `json:"wareQD"` //包装清单
ImagePath string `json:"imagePath"` //主图 ImagePath string `json:"imagePath"` //主图
State int `json:"state"` //状态 State int `json:"state"` //状态
Sku int `json:"sku"` //商品编号 Sku int64 `json:"sku"` //商品编号
BrandName string `json:"brandName"` //品牌名称 BrandName string `json:"brandName"` //品牌名称
Category string `json:"category"` //分类 示例"670;729;4837" Category string `json:"category"` //分类 示例"670;729;4837"
Name string `json:"name"` //商品名称 Name string `json:"name"` //商品名称
...@@ -98,7 +98,7 @@ type GetDetailRes struct { ...@@ -98,7 +98,7 @@ type GetDetailRes struct {
} }
type GetCategoryRes struct { type GetCategoryRes struct {
*CommonRes //异常代码(3422:获取分类列表信息失败;3423:分类列表不存在;1003:参数值不正确;5001:服务异常,请稍后重试;) CommonRes //异常代码(3422:获取分类列表信息失败;3423:分类列表不存在;1003:参数值不正确;5001:服务异常,请稍后重试;)
Result struct { Result struct {
TotalRows int `json:"totalRows"` TotalRows int `json:"totalRows"`
PageNo int `json:"pageNo"` PageNo int `json:"pageNo"`
...@@ -114,7 +114,7 @@ type GetCategoryRes struct { ...@@ -114,7 +114,7 @@ type GetCategoryRes struct {
} }
type GetSkuImageRes struct { type GetSkuImageRes struct {
*CommonRes //异常代码(0010:返回数据为空;1001:参数为空;1003:参数值不正确/sku数量过多,目前最大支持100个商品) CommonRes //异常代码(0010:返回数据为空;1001:参数为空;1003:参数值不正确/sku数量过多,目前最大支持100个商品)
Result map[string][]struct { Result map[string][]struct {
Id int `json:"id"` //编号 Id int `json:"id"` //编号
SkuId int `json:"skuId"` //商品编号 SkuId int `json:"skuId"` //商品编号
...@@ -123,14 +123,14 @@ type GetSkuImageRes struct { ...@@ -123,14 +123,14 @@ type GetSkuImageRes struct {
} }
type GetSimilarSkuRes struct { type GetSimilarSkuRes struct {
*CommonRes CommonRes
Result []struct { Result []struct {
Dim int `json:"dim"` //维度 Dim int `json:"dim"` //维度
SaleName string `json:"saleName"` //销售名称 SaleName string `json:"saleName"` //销售名称
SaleAttrList []struct { //商品销售标签 销售属性下可能只有一个标签,此种场景可以选择显示销售名称和标签,也可以不显示 SaleAttrList []struct { //商品销售标签 销售属性下可能只有一个标签,此种场景可以选择显示销售名称和标签,也可以不显示
ImagePath string `json:"imagePath"` //标签图片地址 ImagePath string `json:"imagePath"` //标签图片地址
SaleValue string `json:"saleValue"` //标签名称 SaleValue string `json:"saleValue"` //标签名称
SkuIds []int `json:"skuIds"` //当前标签下的同类商品skuId SkuIds []int64 `json:"skuIds"` //当前标签下的同类商品skuId
} `json:"saleAttrList"` // } `json:"saleAttrList"` //
...@@ -166,7 +166,7 @@ func (*goodsJD) CheckOnSale(ctx context.Context, req *garray.Array) (res *CheckO ...@@ -166,7 +166,7 @@ func (*goodsJD) CheckOnSale(ctx context.Context, req *garray.Array) (res *CheckO
return return
} }
//GetStock 查询商品库存 // GetStock 查询商品库存
func (*goodsJD) GetStock(ctx context.Context, req []*SkuNums, area string) (res *GetStockRes, err error) { func (*goodsJD) GetStock(ctx context.Context, req []*SkuNums, area string) (res *GetStockRes, err error) {
method := "stock/getNewStockById" method := "stock/getNewStockById"
param := g.Map{ param := g.Map{
...@@ -218,7 +218,7 @@ func (*goodsJD) CheckAreaLimit(ctx context.Context, skuIds *garray.Array, provin ...@@ -218,7 +218,7 @@ func (*goodsJD) CheckAreaLimit(ctx context.Context, skuIds *garray.Array, provin
return return
} }
//GetProductsPrice 查询商品价格 // GetProductsPrice 查询商品价格
func (*goodsJD) GetProductsPrice(ctx context.Context, skus *garray.Array) (res *GetProductsPriceRes, err error) { func (*goodsJD) GetProductsPrice(ctx context.Context, skus *garray.Array) (res *GetProductsPriceRes, err error) {
method := "price/getSellPrice" method := "price/getSellPrice"
param := g.Map{ param := g.Map{
...@@ -233,7 +233,7 @@ func (*goodsJD) GetProductsPrice(ctx context.Context, skus *garray.Array) (res * ...@@ -233,7 +233,7 @@ func (*goodsJD) GetProductsPrice(ctx context.Context, skus *garray.Array) (res *
return return
} }
//GetDetail 查询商品详情 // GetDetail 查询商品详情
func (*goodsJD) GetDetail(ctx context.Context, skus interface{}) (res *GetDetailRes, err error) { func (*goodsJD) GetDetail(ctx context.Context, skus interface{}) (res *GetDetailRes, err error) {
method := "product/getDetail" method := "product/getDetail"
param := g.Map{ param := g.Map{
...@@ -248,7 +248,7 @@ func (*goodsJD) GetDetail(ctx context.Context, skus interface{}) (res *GetDetail ...@@ -248,7 +248,7 @@ func (*goodsJD) GetDetail(ctx context.Context, skus interface{}) (res *GetDetail
return return
} }
//GetCategory 查询分类列表 // GetCategory 查询分类列表
func (*goodsJD) GetCategory(ctx context.Context, pageNo, pageSize interface{}) (res *GetCategoryRes, err error) { func (*goodsJD) GetCategory(ctx context.Context, pageNo, pageSize interface{}) (res *GetCategoryRes, err error) {
method := "product/getCategorys" method := "product/getCategorys"
param := g.Map{ param := g.Map{
...@@ -263,7 +263,7 @@ func (*goodsJD) GetCategory(ctx context.Context, pageNo, pageSize interface{}) ( ...@@ -263,7 +263,7 @@ func (*goodsJD) GetCategory(ctx context.Context, pageNo, pageSize interface{}) (
return return
} }
//GetSkuImage 查询商品图片 // GetSkuImage 查询商品图片
func (*goodsJD) GetSkuImage(ctx context.Context, skus *garray.Array) (res *GetSkuImageRes, err error) { func (*goodsJD) GetSkuImage(ctx context.Context, skus *garray.Array) (res *GetSkuImageRes, err error) {
method := "product/skuImage" method := "product/skuImage"
param := g.Map{ param := g.Map{
...@@ -277,7 +277,7 @@ func (*goodsJD) GetSkuImage(ctx context.Context, skus *garray.Array) (res *GetSk ...@@ -277,7 +277,7 @@ func (*goodsJD) GetSkuImage(ctx context.Context, skus *garray.Array) (res *GetSk
return return
} }
//GetSimilarSku 查询同类商品 // GetSimilarSku 查询同类商品
func (*goodsJD) GetSimilarSku(ctx context.Context, skus interface{}) (res *GetSimilarSkuRes, err error) { func (*goodsJD) GetSimilarSku(ctx context.Context, skus interface{}) (res *GetSimilarSkuRes, err error) {
method := "product/getSimilarSku" method := "product/getSimilarSku"
param := g.Map{ param := g.Map{
...@@ -301,7 +301,7 @@ type GetPageNumRes struct { ...@@ -301,7 +301,7 @@ type GetPageNumRes struct {
} `json:"result"` } `json:"result"`
} }
//GetPageNum 查询商品池编号 // GetPageNum 查询商品池编号
func (*goodsJD) GetPageNum(ctx context.Context) (res *GetPageNumRes, err error) { func (*goodsJD) GetPageNum(ctx context.Context) (res *GetPageNumRes, err error) {
method := "product/getPageNum" method := "product/getPageNum"
param := g.Map{} param := g.Map{}
...@@ -324,7 +324,7 @@ type QueryByPageRes struct { ...@@ -324,7 +324,7 @@ type QueryByPageRes struct {
} `json:"result"` } `json:"result"`
} }
//QueryByPage 查询池内商品编号 // QueryByPage 查询池内商品编号
func (*goodsJD) QueryByPage(ctx context.Context, pageNum, pageNo, offset interface{}) (res *QueryByPageRes, err error) { func (*goodsJD) QueryByPage(ctx context.Context, pageNum, pageNo, offset interface{}) (res *QueryByPageRes, err error) {
method := "product/querySkuByPage" method := "product/querySkuByPage"
param := g.Map{ param := g.Map{
...@@ -425,7 +425,7 @@ type GoodsSearchRes struct { ...@@ -425,7 +425,7 @@ type GoodsSearchRes struct {
} `json:"result"` } `json:"result"`
} }
//Search 搜索商品 // Search 搜索商品
func (*goodsJD) Search(ctx context.Context, req GoodsSearchReq) (res *GoodsSearchRes, err error) { func (*goodsJD) Search(ctx context.Context, req GoodsSearchReq) (res *GoodsSearchRes, err error) {
method := "/search/search" method := "/search/search"
result, err := server.requestApi(ctx, method, gconv.Map(req)) result, err := server.requestApi(ctx, method, gconv.Map(req))
...@@ -437,7 +437,7 @@ func (*goodsJD) Search(ctx context.Context, req GoodsSearchReq) (res *GoodsSearc ...@@ -437,7 +437,7 @@ func (*goodsJD) Search(ctx context.Context, req GoodsSearchReq) (res *GoodsSearc
} }
type GoodsBeforeReq struct { type GoodsBeforeReq struct {
SkuId int `json:"skuId"` SkuId int64 `json:"skuId"`
Num int `json:"num"` Num int `json:"num"`
Price float64 `json:"price"` Price float64 `json:"price"`
} }
......
...@@ -4,16 +4,17 @@ import ( ...@@ -4,16 +4,17 @@ import (
"context" "context"
"github.com/gogf/gf/encoding/gjson" "github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g" "github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
) )
type deliveryJD struct { type logisticsLogic struct {
} }
var Delivery = deliveryJD{} var Logistics = logisticsLogic{}
//DeliveryDetailRes 物流轨迹 // LogisticsTraceRes 物流轨迹
type DeliveryDetailRes struct { type LogisticsTraceRes struct {
*CommonRes CommonRes
Result struct { Result struct {
OrderTrack []struct { OrderTrack []struct {
Content string `json:"content"` //操作内容明细 Content string `json:"content"` //操作内容明细
...@@ -21,8 +22,8 @@ type DeliveryDetailRes struct { ...@@ -21,8 +22,8 @@ type DeliveryDetailRes struct {
Operator string `json:"operator"` //操作员名称 Operator string `json:"operator"` //操作员名称
} `json:"orderTrack"` } `json:"orderTrack"`
WaybillCode []struct { WaybillCode []struct {
OrderID string `json:"orderId"` //订单号 OrderID int64 `json:"orderId"` //订单号
ParentID string `json:"parentId"` //父订单号。 此字段为0 未拆单 ParentID int64 `json:"parentId"` //父订单号。 此字段为0 未拆单
Carrier string `json:"carrier"` //承运商 Carrier string `json:"carrier"` //承运商
DeliveryOrderID string `json:"deliveryOrderId"` //运单号 DeliveryOrderID string `json:"deliveryOrderId"` //运单号
} `json:"waybillCode"` } `json:"waybillCode"`
...@@ -30,11 +31,11 @@ type DeliveryDetailRes struct { ...@@ -30,11 +31,11 @@ type DeliveryDetailRes struct {
} `json:"result"` } `json:"result"`
} }
// Detail 物流信息 // Trace 物流轨迹
func (*deliveryJD) Detail(ctx context.Context, OrderID string) (res *DeliveryDetailRes, err error) { func (*logisticsLogic) Trace(ctx context.Context, OrderID string) (res *LogisticsTraceRes, err error) {
method := "order/orderTrack" method := "order/orderTrack"
param := g.Map{ param := g.Map{
"jdOrderId": OrderID, "jdOrderId": gconv.Int64(OrderID),
"waybillCode": "1", "waybillCode": "1",
} }
result, err := server.requestApi(ctx, method, param) result, err := server.requestApi(ctx, method, param)
......
...@@ -4,21 +4,22 @@ import ( ...@@ -4,21 +4,22 @@ import (
"context" "context"
"github.com/gogf/gf/encoding/gjson" "github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g" "github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
) )
type orderJD struct { type orderJD struct {
} }
//Order 订单 // Order 订单
var Order = orderJD{} var Order = orderJD{}
//PriceSnap 商品价格 // PriceSnap 商品价格
type PriceSnap struct { type PriceSnap struct {
SkuID int `json:"skuId"` //商品编号 SkuID int64 `json:"skuId"` //商品编号
Price float64 `json:"price"` //商品价格 格式:21.30 Price float64 `json:"price"` //商品价格 格式:21.30
} }
//OrderCreateReq 下单 // OrderCreateReq 下单
type OrderCreateReq struct { type OrderCreateReq struct {
OrderSn string //订单单号 OrderSn string //订单单号
SkuNums []*SkuNums SkuNums []*SkuNums
...@@ -29,7 +30,7 @@ type OrderCreateReq struct { ...@@ -29,7 +30,7 @@ type OrderCreateReq struct {
InvoiceType InvoiceType InvoiceType InvoiceType
} }
//PlaceOrderAddress 下单地址 // PlaceOrderAddress 下单地址
type PlaceOrderAddress struct { type PlaceOrderAddress struct {
Province string //一级地址编码 Province string //一级地址编码
City string //二级地址编码 City string //二级地址编码
...@@ -38,7 +39,7 @@ type PlaceOrderAddress struct { ...@@ -38,7 +39,7 @@ type PlaceOrderAddress struct {
Desc string //收货人详细地址,最多100个字符 Desc string //收货人详细地址,最多100个字符
} }
//OrderCreateRes 下单 // OrderCreateRes 下单
type OrderCreateRes struct { type OrderCreateRes struct {
*CommonRes *CommonRes
Result struct { Result struct {
...@@ -50,16 +51,16 @@ type OrderCreateRes struct { ...@@ -50,16 +51,16 @@ type OrderCreateRes struct {
} `json:"result"` } `json:"result"`
} }
//OrderSkuItem 订单商品 // OrderSkuItem 订单商品
type OrderSkuItem struct { type OrderSkuItem struct {
SkuID int `json:"skuId"` //商品编号 SkuID int64 `json:"skuId"` //商品编号
Num int `json:"num"` //商品数量 Num int `json:"num"` //商品数量
Price float64 `json:"price"` //商品单价 Price float64 `json:"price"` //商品单价
Name string `json:"name"` //商品名称 Name string `json:"name"` //商品名称
NakedPrice float64 `json:"nakedPrice"` //商品未税价 NakedPrice float64 `json:"nakedPrice"` //商品未税价
} }
//OrderReflectRes 反查订单 // OrderReflectRes 反查订单
type OrderReflectRes struct { type OrderReflectRes struct {
*CommonRes *CommonRes
Result string `json:"result"` //第三方订单号(非京东订单号) Result string `json:"result"` //第三方订单号(非京东订单号)
...@@ -73,7 +74,7 @@ type OrderDetailBase struct { ...@@ -73,7 +74,7 @@ type OrderDetailBase struct {
} }
} }
//OrderDetailRes 订单详情 // OrderDetailRes 订单详情
// jdOrderState 京东状态 // jdOrderState 京东状态
// 1.新单 2.等待支付 3.等待支付确认 4.延迟付款确认 5.订单暂停 6.店长最终审核 7.等待打印 8.等待出库 9.等待打包 10.等待发货 // 1.新单 2.等待支付 3.等待支付确认 4.延迟付款确认 5.订单暂停 6.店长最终审核 7.等待打印 8.等待出库 9.等待打包 10.等待发货
// 11.自提途中 12.上门提货 13.自提退货 14.确认自提 16.等待确认收货 17.配送退货 18.货到付款确认 19.已完成 21.收款确认 22.锁定 // 11.自提途中 12.上门提货 13.自提退货 14.确认自提 16.等待确认收货 17.配送退货 18.货到付款确认 19.已完成 21.收款确认 22.锁定
...@@ -123,7 +124,7 @@ type OrderDetailChild struct { ...@@ -123,7 +124,7 @@ type OrderDetailChild struct {
} `json:"result"` } `json:"result"`
} }
//OrderFreightRes 运费 // OrderFreightRes 运费
type OrderFreightRes struct { type OrderFreightRes struct {
*CommonRes *CommonRes
Result struct { Result struct {
...@@ -133,9 +134,9 @@ type OrderFreightRes struct { ...@@ -133,9 +134,9 @@ type OrderFreightRes struct {
} `json:"result"` } `json:"result"`
} }
//SkuNums 商品数量 // SkuNums 商品数量
type SkuNums struct { type SkuNums struct {
SkuID int `json:"skuId"` //商品编号 SkuID int64 `json:"skuId"` //商品编号
Num int `json:"num"` //商品数量 Num int `json:"num"` //商品数量
} }
...@@ -187,11 +188,11 @@ func (*orderJD) Reflect(ctx context.Context, thirdOrder string) (res *OrderRefle ...@@ -187,11 +188,11 @@ func (*orderJD) Reflect(ctx context.Context, thirdOrder string) (res *OrderRefle
return return
} }
//Detail 订单详情 // Detail 订单详情
func (*orderJD) Detail(ctx context.Context, OrderID string) (res *OrderDetailRes, err error) { func (*orderJD) Detail(ctx context.Context, OrderID string) (res *OrderDetailRes, err error) {
method := "order/selectJdOrder" method := "order/selectJdOrder"
param := g.Map{ param := g.Map{
"jdOrderId": OrderID, "jdOrderId": gconv.Int64(OrderID),
"queryExts": "jdOrderState", "queryExts": "jdOrderState",
} }
...@@ -229,7 +230,7 @@ func (*orderJD) Detail(ctx context.Context, OrderID string) (res *OrderDetailRes ...@@ -229,7 +230,7 @@ func (*orderJD) Detail(ctx context.Context, OrderID string) (res *OrderDetailRes
return return
} }
//Freight 查询运费 // Freight 查询运费
func (*orderJD) Freight(ctx context.Context, sku []*SkuNums, province, city, county, town string) (res *OrderFreightRes, err error) { func (*orderJD) Freight(ctx context.Context, sku []*SkuNums, province, city, county, town string) (res *OrderFreightRes, err error) {
method := "order/getFreight" method := "order/getFreight"
param := g.Map{ param := g.Map{
...@@ -252,7 +253,7 @@ func (*orderJD) Freight(ctx context.Context, sku []*SkuNums, province, city, cou ...@@ -252,7 +253,7 @@ func (*orderJD) Freight(ctx context.Context, sku []*SkuNums, province, city, cou
func (*orderJD) Confirm(ctx context.Context, OrderID string) (res *CommonRes, err error) { func (*orderJD) Confirm(ctx context.Context, OrderID string) (res *CommonRes, err error) {
method := "order/confirmReceived" method := "order/confirmReceived"
param := g.Map{ param := g.Map{
"jdOrderId": OrderID, "jdOrderId": gconv.Int64(OrderID),
} }
result, err := server.requestApi(ctx, method, param) result, err := server.requestApi(ctx, method, param)
if err != nil { if err != nil {
......
...@@ -18,7 +18,7 @@ type RefundCancelRes struct { ...@@ -18,7 +18,7 @@ type RefundCancelRes struct {
} }
type ApplyReq struct { type ApplyReq struct {
JdOrderId uint `json:"jdOrderId"` //京东订单号 JdOrderId int64 `json:"jdOrderId"` //京东订单号
CustomerExpect uint `json:"customerExpect"` //售后类型:退货(10)、换货(20)、维修(30) CustomerExpect uint `json:"customerExpect"` //售后类型:退货(10)、换货(20)、维修(30)
QuestionDesc string `json:"questionDesc"` //产品问题描述,最多1000字符 QuestionDesc string `json:"questionDesc"` //产品问题描述,最多1000字符
IsNeedDetectionReport bool `json:"isNeedDetectionReport"` //是否需要检测报告 IsNeedDetectionReport bool `json:"isNeedDetectionReport"` //是否需要检测报告
...@@ -56,12 +56,12 @@ type AfterSaleReturnwareDto struct { ...@@ -56,12 +56,12 @@ type AfterSaleReturnwareDto struct {
} }
type AfterSaleDetailDto struct { type AfterSaleDetailDto struct {
Id int `json:"skuId"` //商品编号 Id int64 `json:"skuId"` //商品编号
Num uint `json:"skuNum"` //商品申请数量 Num uint `json:"skuNum"` //商品申请数量
} }
type GetServiceListReq struct { type GetServiceListReq struct {
JdOrderID string `json:"jdOrderId"` //京东订单号 JdOrderID int64 `json:"jdOrderId"` //京东订单号
PageIndex int `json:"pageIndex"` //页码,1代表第一页 PageIndex int `json:"pageIndex"` //页码,1代表第一页
PageSize int `json:"pageSize"` //每页记录数, 大小取值范围[1,100] PageSize int `json:"pageSize"` //每页记录数, 大小取值范围[1,100]
} }
...@@ -74,12 +74,12 @@ type RefundListRes struct { ...@@ -74,12 +74,12 @@ type RefundListRes struct {
PageNum int `json:"pageNum"` //总页数 PageNum int `json:"pageNum"` //总页数
PageIndex int `json:"pageIndex"` //当前页数 PageIndex int `json:"pageIndex"` //当前页数
ServiceInfoList []struct { ServiceInfoList []struct {
AfsServiceId int `json:"afsServiceId"` //服务单号 AfsServiceId int64 `json:"afsServiceId"` //服务单号
CustomerExpect int `json:"customerExpect"` CustomerExpect int `json:"customerExpect"`
CustomerExpectName string `json:"customerExpectName"` CustomerExpectName string `json:"customerExpectName"`
AfsApplyTime string `json:"afsApplyTime"` AfsApplyTime string `json:"afsApplyTime"`
OrderId int64 `json:"orderId"` OrderId int64 `json:"orderId"`
WareId int `json:"wareId"` //商品编号 WareId int64 `json:"wareId"` //商品编号
WareName string `json:"wareName"` WareName string `json:"wareName"`
AfsServiceStep int `json:"afsServiceStep"` AfsServiceStep int `json:"afsServiceStep"`
AfsServiceStepName string `json:"afsServiceStepName"` AfsServiceStepName string `json:"afsServiceStepName"`
...@@ -91,10 +91,10 @@ type RefundListRes struct { ...@@ -91,10 +91,10 @@ type RefundListRes struct {
type RefundDetailRes struct { type RefundDetailRes struct {
CommonRes CommonRes
Result struct { Result struct {
AfsServiceId int `json:"afsServiceId"` //京东售后服务单号 AfsServiceId int64 `json:"afsServiceId"` //京东售后服务单号
CustomerExpect int `json:"customerExpect"` //服务类型码:退货(10)、换货(20)、维修(20) CustomerExpect int `json:"customerExpect"` //服务类型码:退货(10)、换货(20)、维修(20)
AfsApplyTime string `json:"afsApplyTime"` //服务单申请时间:格式为yyyy-MM-dd HH:mm:ss AfsApplyTime string `json:"afsApplyTime"` //服务单申请时间:格式为yyyy-MM-dd HH:mm:ss
OrderId int `json:"orderId"` //京东订单号 OrderId int64 `json:"orderId"` //京东订单号
IsHasInvoice int `json:"isHasInvoice"` IsHasInvoice int `json:"isHasInvoice"`
IsNeedDetectionReport int `json:"isNeedDetectionReport"` IsNeedDetectionReport int `json:"isNeedDetectionReport"`
IsHasPackage int `json:"isHasPackage"` IsHasPackage int `json:"isHasPackage"`
...@@ -118,7 +118,7 @@ type RefundDetailRes struct { ...@@ -118,7 +118,7 @@ type RefundDetailRes struct {
RefundPrice float64 `json:"refundPrice"` //退款金额 RefundPrice float64 `json:"refundPrice"` //退款金额
} `json:"serviceFinanceDetailInfoDTOs"` //退款明细 } `json:"serviceFinanceDetailInfoDTOs"` //退款明细
ServiceTrackInfoDTOs []struct { ServiceTrackInfoDTOs []struct {
AfsServiceId int `json:"afsServiceId"` AfsServiceId int64 `json:"afsServiceId"`
Title string `json:"title"` Title string `json:"title"`
Context string `json:"context"` Context string `json:"context"`
CreateDate string `json:"createDate"` CreateDate string `json:"createDate"`
...@@ -140,12 +140,12 @@ type ServiceFinanceDetailInfoDTO struct { ...@@ -140,12 +140,12 @@ type ServiceFinanceDetailInfoDTO struct {
Status int `json:"status"` //状态 Status int `json:"status"` //状态
StatusName string `json:"statusName"` //状态名称 StatusName string `json:"statusName"` //状态名称
WareName string `json:"wareName"` //商品名称 WareName string `json:"wareName"` //商品名称
WareId int `json:"wareId"` //商品编号 WareId int64 `json:"wareId"` //商品编号
} }
type RefundCommonReq struct { type RefundCommonReq struct {
OrderID string `json:"jdOrderId"` //订单编号 OrderID int64 `json:"jdOrderId"` //订单编号
SkuID string `json:"skuId"` //商品编号 SkuID int64 `json:"skuId"` //商品编号
} }
type RefundIsSupportRes struct { type RefundIsSupportRes struct {
...@@ -169,14 +169,14 @@ type RefundReturnTypeRes struct { ...@@ -169,14 +169,14 @@ type RefundReturnTypeRes struct {
} }
type RefundSendReq struct { type RefundSendReq struct {
AfsServiceId string `json:"afsServiceId"` AfsServiceId int64 `json:"afsServiceId"`
DeliverDate string `json:"deliverDate"` DeliverDate string `json:"deliverDate"`
ExpressCode string `json:"expressCode"` ExpressCode string `json:"expressCode"`
ExpressCompany string `json:"expressCompany"` ExpressCompany string `json:"expressCompany"`
FreightMoney int `json:"freightMoney"` FreightMoney int `json:"freightMoney"`
} }
//Send 根据填写单号 // Send 根据填写单号
func (*refundJD) Send(ctx context.Context, req *RefundSendReq) (res *CommonRes, err error) { func (*refundJD) Send(ctx context.Context, req *RefundSendReq) (res *CommonRes, err error) {
method := "afterSale/updateSendSku" method := "afterSale/updateSendSku"
param := g.Map{ param := g.Map{
...@@ -190,7 +190,7 @@ func (*refundJD) Send(ctx context.Context, req *RefundSendReq) (res *CommonRes, ...@@ -190,7 +190,7 @@ func (*refundJD) Send(ctx context.Context, req *RefundSendReq) (res *CommonRes,
return return
} }
//Cancel 取消售后 // Cancel 取消售后
func (*refundJD) Cancel(ctx context.Context, id interface{}) (res *RefundCancelRes, err error) { func (*refundJD) Cancel(ctx context.Context, id interface{}) (res *RefundCancelRes, err error) {
method := "afterSale/auditCancel" method := "afterSale/auditCancel"
req := g.Map{ req := g.Map{
...@@ -222,12 +222,12 @@ func (*refundJD) Apply(ctx context.Context, req *ApplyReq) (res *CommonRes, err ...@@ -222,12 +222,12 @@ func (*refundJD) Apply(ctx context.Context, req *ApplyReq) (res *CommonRes, err
return return
} }
//List 查询服务单根据客户账号和订单号分页查询服务单概要信息 // List 查询服务单根据客户账号和订单号分页查询服务单概要信息
func (*refundJD) List(ctx context.Context, OrderSn string) (res *RefundListRes, err error) { func (*refundJD) List(ctx context.Context, OrderSn string) (res *RefundListRes, err error) {
method := "afterSale/getServiceListPage" method := "afterSale/getServiceListPage"
param := g.Map{ param := g.Map{
"param": gjson.New(&GetServiceListReq{ "param": gjson.New(&GetServiceListReq{
JdOrderID: OrderSn, JdOrderID: gconv.Int64(OrderSn),
PageIndex: 1, PageIndex: 1,
PageSize: 100, PageSize: 100,
}).MustToJsonString(), }).MustToJsonString(),
...@@ -240,11 +240,11 @@ func (*refundJD) List(ctx context.Context, OrderSn string) (res *RefundListRes, ...@@ -240,11 +240,11 @@ func (*refundJD) List(ctx context.Context, OrderSn string) (res *RefundListRes,
return return
} }
//Detail 根据服务单号查询服务单明细信息 // Detail 根据服务单号查询服务单明细信息
func (*refundJD) Detail(ctx context.Context, req string) (res *RefundDetailRes, err error) { func (*refundJD) Detail(ctx context.Context, req string) (res *RefundDetailRes, err error) {
method := "afterSale/getServiceDetailInfo" method := "afterSale/getServiceDetailInfo"
var reqJson = gjson.New("") var reqJson = gjson.New("")
_ = reqJson.Set("afsServiceId", req) _ = reqJson.Set("afsServiceId", gconv.Int64(req))
_ = reqJson.Set("appendInfoSteps", []int{1, 4, 5}) //1、代表增加获取售后地址信息; 2、代表增加获取客户发货信息; 3、代表增加获取退款明细; 4、代表增加获取跟踪信息; 5、代表增加获取允许的操作信息 _ = reqJson.Set("appendInfoSteps", []int{1, 4, 5}) //1、代表增加获取售后地址信息; 2、代表增加获取客户发货信息; 3、代表增加获取退款明细; 4、代表增加获取跟踪信息; 5、代表增加获取允许的操作信息
param := g.Map{ param := g.Map{
......
package tm
import (
"context"
"encoding/json"
"github.com/gogf/gf/util/gconv"
)
// serviceTm 客服
type serviceTm struct {
}
var Service = serviceTm{}
type ServiceUrlRes struct {
Message string `json:"Message"`
UrlData struct {
ReturnUrl string `json:"ReturnUrl"`
} `json:"UrlData"`
Code string `json:"Code"`
}
// Url 客服链接
func (s *serviceTm) Url(ctx context.Context, SellerId, UserId interface{}) (res *ServiceUrlRes, err error) {
method := "getCustomServiceUrl"
request := map[string]string{
"BizUid": server.BizUid,
"SellerId": gconv.String(SellerId),
"AccountType": "ANONY",
"ThirdPartyUserId": gconv.String(UserId),
}
result, err := post(ctx, method, request)
_ = json.Unmarshal([]byte(result), &res)
return
}
...@@ -47,7 +47,9 @@ func (s *category) QueryMallCategoryList(ctx context.Context,item int64) (res *Q ...@@ -47,7 +47,9 @@ func (s *category) QueryMallCategoryList(ctx context.Context,item int64) (res *Q
return return
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
return return
......
...@@ -211,6 +211,9 @@ func (s *goodsTmNew) QueryItemDetailWithDivision(ctx context.Context,addr string ...@@ -211,6 +211,9 @@ func (s *goodsTmNew) QueryItemDetailWithDivision(ctx context.Context,addr string
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
if *result.Body.Success ==false{ if *result.Body.Success ==false{
return return
} }
...@@ -238,12 +241,13 @@ func (s *goodsTmNew) ListDistributionItem(ctx context.Context,item *ListDistribu ...@@ -238,12 +241,13 @@ func (s *goodsTmNew) ListDistributionItem(ctx context.Context,item *ListDistribu
PageNumber: tea.Int32(gconv.Int32(item.Page)), PageNumber: tea.Int32(gconv.Int32(item.Page)),
PageSize: tea.Int32(gconv.Int32(item.Limit)), PageSize: tea.Int32(gconv.Int32(item.Limit)),
}) })
if result==nil{ if result==nil{
return return
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
return return
...@@ -269,8 +273,10 @@ func (s *goodsTmNew) QueryItemGuIDeRetailPrice(ctx context.Context,item []string ...@@ -269,8 +273,10 @@ func (s *goodsTmNew) QueryItemGuIDeRetailPrice(ctx context.Context,item []string
if result==nil{ if result==nil{
return return
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
if *result.Body.Success ==false{ if *result.Body.Success ==false{
return return
} }
......
...@@ -55,7 +55,9 @@ func (s *logisticsTmNew) QueryLogistics4Distribution(ctx context.Context,orderSn ...@@ -55,7 +55,9 @@ func (s *logisticsTmNew) QueryLogistics4Distribution(ctx context.Context,orderSn
return return
} }
log(ctx,gjson.New(orderSn).MustToJsonString(),result.Body,err) log(ctx,gjson.New(orderSn).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_:=json.Marshal(result.Body) a,_:=json.Marshal(result.Body)
err =json.Unmarshal([]byte(a),&res) err =json.Unmarshal([]byte(a),&res)
......
...@@ -300,7 +300,9 @@ func (s *orderTm) Before(ctx context.Context,itemInfo *RenderDistributionOrderRe ...@@ -300,7 +300,9 @@ func (s *orderTm) Before(ctx context.Context,itemInfo *RenderDistributionOrderRe
} }
log(ctx,gjson.New(itemInfo).MustToJsonString(),result.Body,err) log(ctx,gjson.New(itemInfo).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
return return
...@@ -332,7 +334,9 @@ func (s *orderTm) List(ctx context.Context,item *OrderListReq) (res *OrderListRe ...@@ -332,7 +334,9 @@ func (s *orderTm) List(ctx context.Context,item *OrderListReq) (res *OrderListRe
return return
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
panic(err) panic(err)
...@@ -367,7 +371,9 @@ func (s *orderTm) Create(ctx context.Context,item *OrderCreateReq) (res *OrderCr ...@@ -367,7 +371,9 @@ func (s *orderTm) Create(ctx context.Context,item *OrderCreateReq) (res *OrderCr
return return
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
return return
...@@ -394,7 +400,9 @@ func (s *orderTm) Detail(ctx context.Context,item *OrderInfoReq) (res *OrderInfo ...@@ -394,7 +400,9 @@ func (s *orderTm) Detail(ctx context.Context,item *OrderInfoReq) (res *OrderInfo
return return
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
panic(err) panic(err)
...@@ -422,7 +430,9 @@ func (s *orderTm) Status(ctx context.Context,item *OrderStatusReq) (res *OrderSt ...@@ -422,7 +430,9 @@ func (s *orderTm) Status(ctx context.Context,item *OrderStatusReq) (res *OrderSt
return return
} }
log(ctx,gjson.New(item).MustToJsonString(),result.Body,err) log(ctx,gjson.New(item).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
panic(err) panic(err)
...@@ -451,7 +461,9 @@ func (s *orderTm) AddrInfo(ctx context.Context,itemInfo *AddrInfoReq) (res *Addr ...@@ -451,7 +461,9 @@ func (s *orderTm) AddrInfo(ctx context.Context,itemInfo *AddrInfoReq) (res *Addr
return return
} }
log(ctx,gjson.New(itemInfo).MustToJsonString(),result.Body,err) log(ctx,gjson.New(itemInfo).MustToJsonString(),result.Body,err)
if err!=nil{
return
}
a,_ :=json.Marshal(result.Body) a,_ :=json.Marshal(result.Body)
if err = json.Unmarshal([]byte(a), &res); err != nil { if err = json.Unmarshal([]byte(a), &res); err != nil {
panic(err) panic(err)
......
...@@ -109,13 +109,13 @@ func GetUpstreamName(source int) string { ...@@ -109,13 +109,13 @@ func GetUpstreamName(source int) string {
case Tm: case Tm:
return "天猫" return "天猫"
case Cloud: case Cloud:
return "云仓" return "生态云仓"
case Sn: case Sn:
return "苏宁" return "苏宁"
case Gome: case Gome:
return "国美" return "国美"
case Schl: case Schl:
return "华南一仓" return "自营云仓"
case Wpc: case Wpc:
return "特卖一仓" return "特卖一仓"
case Ikc: case Ikc:
...@@ -125,7 +125,7 @@ func GetUpstreamName(source int) string { ...@@ -125,7 +125,7 @@ func GetUpstreamName(source int) string {
case Itao: case Itao:
return "淘宝" return "淘宝"
case Hdh: case Hdh:
return "会订货" return "跨境一仓"
case TmNew: case TmNew:
return "天猫精选" return "天猫精选"
case AliNew: case AliNew:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论