Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
L
library
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
stbz
library
Commits
6a4135a2
提交
6a4135a2
authored
12月 09, 2022
作者:
zhanglibo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
淘特
上级
2fa89b3f
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
349 行增加
和
108 行删除
+349
-108
itao.go
upstream/itao/itao.go
+43
-25
itao_auth.go
upstream/itao/itao_auth.go
+2
-2
itao_goods.go
upstream/itao/itao_goods.go
+2
-2
itao_logistics.go
upstream/itao/itao_logistics.go
+16
-3
itao_order.go
upstream/itao/itao_order.go
+73
-76
itao_refund.go
upstream/itao/itao_refund.go
+213
-0
没有找到文件。
upstream/itao/itao.go
浏览文件 @
6a4135a2
...
@@ -8,9 +8,10 @@ import (
...
@@ -8,9 +8,10 @@ import (
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/errors/gerror"
"github.com/gogf/gf/errors/gerror"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gctx"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/os/gtimer"
"github.com/gogf/gf/util/gconv"
"github.com/gogf/gf/util/gconv"
"github.com/gogf/gf/util/gutil"
"net/url"
"net/url"
"sort"
"sort"
"strings"
"strings"
...
@@ -31,13 +32,17 @@ const Host = "https://open.huoju6.com/openapi/param2/1/com.huoju6.open/"
...
@@ -31,13 +32,17 @@ const Host = "https://open.huoju6.com/openapi/param2/1/com.huoju6.open/"
func
New
(
req
*
Config
)
{
func
New
(
req
*
Config
)
{
server
=
req
server
=
req
gtimer
.
Add
(
time
.
Hour
,
func
()
{
var
ctx
=
gctx
.
New
()
_
=
server
.
accessToken
(
ctx
)
})
return
return
}
}
type
CommonRes
struct
{
type
CommonRes
struct
{
Success
bool
`json:"success"`
Success
bool
`json:"success"`
Err
orCode
string
`json:"erro
rCode"`
Err
Code
string
`json:"er
rCode"`
Err
orMessage
string
`json:"errorMessage
"`
Err
Msg
string
`json:"errMsg
"`
}
}
func
generate
(
req
string
)
(
res
string
)
{
func
generate
(
req
string
)
(
res
string
)
{
...
@@ -73,7 +78,7 @@ func sign(method string, req g.Map) (err error) {
...
@@ -73,7 +78,7 @@ func sign(method string, req g.Map) (err error) {
}
}
func
(
s
*
Config
)
Post
(
ctx
context
.
Context
,
method
string
,
params
g
.
Map
)
(
str
string
,
err
error
)
{
func
(
s
*
Config
)
Post
(
ctx
context
.
Context
,
method
string
,
params
g
.
Map
)
(
str
string
,
err
error
)
{
params
[
"access_token"
],
err
=
s
.
AccessToken
(
ctx
)
params
[
"access_token"
],
err
=
s
.
Get
AccessToken
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
...
@@ -111,7 +116,7 @@ func Post(ctx context.Context, method string, params g.Map) (str string, err err
...
@@ -111,7 +116,7 @@ func Post(ctx context.Context, method string, params g.Map) (str string, err err
}
}
func
(
s
*
Config
)
Get
(
ctx
context
.
Context
,
method
string
,
params
g
.
Map
)
(
str
string
,
err
error
)
{
func
(
s
*
Config
)
Get
(
ctx
context
.
Context
,
method
string
,
params
g
.
Map
)
(
str
string
,
err
error
)
{
params
[
"access_token"
],
err
=
s
.
AccessToken
(
ctx
)
params
[
"access_token"
],
err
=
s
.
Get
AccessToken
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
...
@@ -152,7 +157,7 @@ func Get(ctx context.Context, method string, params g.Map) (str string, err erro
...
@@ -152,7 +157,7 @@ func Get(ctx context.Context, method string, params g.Map) (str string, err erro
}
}
func
(
s
*
Config
)
AccessToken
(
ctx
context
.
Context
)
(
res
string
,
err
error
)
{
func
(
s
*
Config
)
Get
AccessToken
(
ctx
context
.
Context
)
(
res
string
,
err
error
)
{
var
conn
=
g
.
Redis
()
.
Conn
()
var
conn
=
g
.
Redis
()
.
Conn
()
defer
func
()
{
defer
func
()
{
_
=
conn
.
Close
()
_
=
conn
.
Close
()
...
@@ -163,28 +168,41 @@ func (s *Config) AccessToken(ctx context.Context) (res string, err error) {
...
@@ -163,28 +168,41 @@ func (s *Config) AccessToken(ctx context.Context) (res string, err error) {
err
=
gerror
.
New
(
"获取token 失败"
)
err
=
gerror
.
New
(
"获取token 失败"
)
return
return
}
}
var
token
*
AuthTokenRes
var
result
*
AuthTokenRes
_
=
gjson
.
New
(
cache
)
.
Scan
(
&
token
)
_
=
gjson
.
New
(
cache
)
.
Scan
(
&
result
)
if
token
==
nil
{
if
result
==
nil
||
result
.
AccessToken
==
""
||
result
.
AccessTokenExpireTime
<
gtime
.
TimestampMilli
()
{
err
=
gerror
.
New
(
"获取token 失败"
)
err
=
gerror
.
New
(
"获取token 失败"
)
return
return
}
}
if
token
.
AccessTokenExpireTime
<
gtime
.
Now
()
.
TimestampMilli
()
{
res
=
result
.
AccessToken
if
token
.
RefreshTokenExpireTime
<
gtime
.
Now
()
.
TimestampMilli
()
{
return
err
=
gerror
.
New
(
"获取token 失败"
)
}
return
}
token
,
err
=
Auth
.
Token
(
ctx
,
token
.
RefreshToken
,
2
)
if
err
!=
nil
{
return
}
if
token
.
Code
!=
"success"
{
err
=
gerror
.
New
(
"获取token 失败"
)
return
}
_
,
_
=
conn
.
Do
(
"HMSET"
,
append
(
g
.
Slice
{
CacheKey
},
gutil
.
StructToSlice
(
token
)
...
)
...
)
//accessToken 刷新
func
(
s
*
Config
)
accessToken
(
ctx
context
.
Context
)
(
err
error
)
{
var
conn
=
g
.
Redis
()
.
Conn
()
defer
func
()
{
_
=
conn
.
Close
()
}()
_
,
_
=
conn
.
DoVar
(
"SELECT"
,
10
)
cache
,
_
:=
conn
.
DoVar
(
"HGETALL"
,
CacheKey
)
if
cache
.
IsEmpty
()
{
err
=
gerror
.
New
(
"获取token 失败"
)
return
}
var
result
*
AuthTokenRes
_
=
gjson
.
New
(
cache
)
.
Scan
(
&
result
)
if
result
.
AccessTokenExpireTime
>
gtime
.
Now
()
.
Add
(
time
.
Hour
)
.
TimestampMilli
()
{
return
}
result
,
err
=
Auth
.
Token
(
ctx
,
result
.
RefreshToken
,
2
)
if
err
!=
nil
{
return
}
if
result
.
Code
!=
"success"
{
err
=
gerror
.
New
(
"获取token 失败"
)
return
}
}
res
=
token
.
AccessToken
_
,
_
=
conn
.
Do
(
"HMSET"
,
CacheKey
,
"accessToken"
,
result
.
AccessToken
,
"accessTokenExpireTime"
,
result
.
AccessTokenExpireTime
)
return
return
}
}
upstream/itao/itao_auth.go
浏览文件 @
6a4135a2
...
@@ -40,7 +40,7 @@ type AuthQrCodeRes struct {
...
@@ -40,7 +40,7 @@ type AuthQrCodeRes struct {
func
(
s
auth
)
QrCode
(
ctx
context
.
Context
)
(
res
*
AuthQrCodeRes
,
err
error
)
{
func
(
s
auth
)
QrCode
(
ctx
context
.
Context
)
(
res
*
AuthQrCodeRes
,
err
error
)
{
method
:=
"tt.authority.generateQrCode"
method
:=
"tt.authority.generateQrCode"
result
,
err
:=
server
.
Get
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
Get
(
ctx
,
method
,
g
.
Map
{
"bId"
:
server
.
AppKey
,
"bId"
:
server
.
AppKey
,
})
})
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
...
@@ -75,7 +75,7 @@ func (s auth) Token(ctx context.Context, code string, Type int) (res *AuthTokenR
...
@@ -75,7 +75,7 @@ func (s auth) Token(ctx context.Context, code string, Type int) (res *AuthTokenR
request
[
"grantType"
]
=
"refreshToken"
request
[
"grantType"
]
=
"refreshToken"
}
}
result
,
err
:=
server
.
Get
(
ctx
,
method
,
request
)
result
,
err
:=
Get
(
ctx
,
method
,
request
)
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
return
}
}
...
...
upstream/itao/itao_goods.go
浏览文件 @
6a4135a2
...
@@ -17,8 +17,8 @@ type GoodsListReq struct {
...
@@ -17,8 +17,8 @@ type GoodsListReq struct {
Sort
string
`json:"sort,omitempty"`
//排序参数 价格降序:sort=price:des 价格升序:sort=price:asc 综合排序:sort=popular:des 销量降序:sort=sales:des
Sort
string
`json:"sort,omitempty"`
//排序参数 价格降序:sort=price:des 价格升序:sort=price:asc 综合排序:sort=popular:des 销量降序:sort=sales:des
Price
string
`json:"price,omitempty"`
Price
string
`json:"price,omitempty"`
Cate
string
`json:"cate,omitempty"`
Cate
string
`json:"cate,omitempty"`
S
int
`json:"s
,omitempty
"`
S
int
`json:"s"`
N
int
`json:"n
,omitempty
"`
N
int
`json:"n"`
Feature
string
`json:"feature,omitempty"`
Feature
string
`json:"feature,omitempty"`
}
}
...
...
upstream/itao/itao_logistics.go
浏览文件 @
6a4135a2
...
@@ -6,10 +6,10 @@ import (
...
@@ -6,10 +6,10 @@ import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/frame/g"
)
)
type
logistics
Itao
struct
{
type
logistics
struct
{
}
}
var
Logistics
=
logistics
Itao
{}
var
Logistics
=
logistics
{}
type
LogisticsTraceRes
struct
{
type
LogisticsTraceRes
struct
{
Result
struct
{
Result
struct
{
...
@@ -45,7 +45,7 @@ type LogisticsTraceRes struct {
...
@@ -45,7 +45,7 @@ type LogisticsTraceRes struct {
}
}
//Trace 物流轨迹
//Trace 物流轨迹
func
(
logistics
Itao
)
Trace
(
ctx
context
.
Context
,
req
string
)
(
res
*
LogisticsTraceRes
,
err
error
)
{
func
(
logistics
)
Trace
(
ctx
context
.
Context
,
req
string
)
(
res
*
LogisticsTraceRes
,
err
error
)
{
method
:=
"tt.logistics.detail"
method
:=
"tt.logistics.detail"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
...
@@ -56,3 +56,16 @@ func (logisticsItao) Trace(ctx context.Context, req string) (res *LogisticsTrace
...
@@ -56,3 +56,16 @@ func (logisticsItao) Trace(ctx context.Context, req string) (res *LogisticsTrace
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
return
}
}
//Company 物流公司
func
(
logistics
)
Company
(
ctx
context
.
Context
,
req
string
)
(
res
*
LogisticsTraceRes
,
err
error
)
{
method
:=
"tt.refund.queryLogisticList"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"bizOrderId"
:
req
,
},
})
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
upstream/itao/itao_order.go
浏览文件 @
6a4135a2
...
@@ -42,72 +42,79 @@ type OrderItem struct {
...
@@ -42,72 +42,79 @@ type OrderItem struct {
}
}
type
OrderBeforeRes
struct
{
type
OrderBeforeRes
struct
{
Result
struct
{
ErrMsg
string
`json:"errMsg"`
Result
struct
{
ErrCode
string
`json:"errCode"`
ExtensionResp
struct
{
Success
bool
`json:"success"`
TradeId
string
`json:"tradeId"`
GwTraceId
string
`json:"gw_trace_id"`
}
`json:"extensionResp"`
Result
struct
{
InvalidOrderGroups
[]
struct
{
//不可售商品
ExtensionResp
struct
{
Image
string
`json:"image"`
TradeId
string
`json:"tradeId"`
OrderLineRenders
[]
struct
{
}
`json:"extensionResp"`
ErrorMessage
struct
{
InvalidOrderGroups
[]
struct
{
//不可售商品
ErrorCode
string
`json:"errorCode"`
Image
string
`json:"image"`
ErrorMsg
string
`json:"errorMsg"`
OrderLineRenders
[]
struct
{
}
`json:"errorMessage"`
ErrorMessage
struct
{
ItemInfo
struct
{
ErrorCode
string
`json:"errorCode"`
ItemId
string
`json:"itemId"`
ErrorMsg
string
`json:"errorMsg"`
SkuId
string
`json:"skuId"`
}
`json:"errorMessage"`
}
`json:"itemInfo"`
ItemInfo
struct
{
ItemPayPrice
uint
`json:"itemPayPrice"`
ItemId
string
`json:"itemId"`
OrderLineId
int64
`json:"orderLineId"`
SkuId
string
`json:"skuId"`
Quantity
uint
`json:"quantity"`
}
`json:"itemInfo"`
}
`json:"orderLineRenders"`
ItemPayPrice
uint
`json:"itemPayPrice"`
OrderPayPrice
int
`json:"orderPayPrice"`
OrderLineId
int64
`json:"orderLineId"`
Quantity
uint
`json:"quantity"`
Quantity
uint
`json:"quantity"`
SellerToken
string
`json:"sellerToken"`
}
`json:"orderLineRenders"`
Title
string
`json:"title"`
OrderPayPrice
int
`json:"orderPayPrice"`
}
`json:"invalidOrderGroups"`
Quantity
uint
`json:"quantity"`
OriginPriceFee
uint
`json:"originPriceFee"`
SellerToken
string
`json:"sellerToken"`
PriceFee
uint
`json:"priceFee"`
//单位分
Title
string
`json:"title"`
PromotionResp
OrderPromotion
`json:"promotionResp"`
}
`json:"invalidOrderGroups"`
Quantity
uint
`json:"quantity"`
OriginPriceFee
uint
`json:"originPriceFee"`
RealPayPrice
uint
`json:"realPayPrice"`
PriceFee
uint
`json:"priceFee"`
//单位分
ReceiveMethodInfo
struct
{
PromotionResp
OrderPromotion
`json:"promotionResp"`
DeliveryAddressId
int
`json:"deliveryAddressId"`
Quantity
uint
`json:"quantity"`
Options
[]
interface
{}
`json:"options"`
RealPayPrice
uint
`json:"realPayPrice"`
}
`json:"receiveMethodInfo"`
ReceiveMethodInfo
struct
{
ValidOrderGroups
[]
struct
{
//可售商品
DeliveryAddressId
int
`json:"deliveryAddressId"`
DeliveryMethodInfo
struct
{
Options
[]
interface
{}
`json:"options"`
DeliveryMethodOptionList
[]
struct
{
}
`json:"receiveMethodInfo"`
FareCent
uint
`json:"fareCent"`
//运费 单位分
ValidOrderGroups
[]
struct
{
//可售商品
Id
string
`json:"id"`
DeliveryMethodInfo
struct
{
ServiceType
int
`json:"serviceType"`
DeliveryMethodOptionList
[]
struct
{
}
`json:"deliveryMethodOptionList"`
FareCent
uint
`json:"fareCent"`
//运费 单位分
SelectedId
string
`json:"selectedId"`
Id
string
`json:"id"`
}
`json:"deliveryMethodInfo"`
ServiceType
int
`json:"serviceType"`
Image
string
`json:"image"`
}
`json:"deliveryMethodOptionList"`
OrderLineRenders
[]
struct
{
SelectedId
string
`json:"selectedId"`
ErrorMessage
struct
{
}
`json:"deliveryMethodInfo"`
ErrorCode
string
`json:"errorCode"`
Image
string
`json:"image"`
ErrorMsg
string
`json:"errorMsg"`
OrderLineRenders
[]
struct
{
}
ErrorMessage
struct
{
ItemInfo
struct
{
ErrorCode
string
`json:"errorCode"`
ItemId
string
`json:"itemId"`
ErrorMsg
string
`json:"errorMsg"`
SkuId
string
`json:"skuId"`
}
}
`json:"itemInfo"`
ItemInfo
struct
{
ItemPayPrice
uint
`json:"itemPayPrice"`
ItemId
int64
`json:"itemId"`
OrderLineId
int64
`json:"orderLineId"`
Pic
string
`json:"pic"`
Quantity
uint
`json:"quantity"`
Price
string
`json:"price"`
}
`json:"orderLineRenders"`
SkuId
int64
`json:"skuId"`
OrderPayPrice
uint
`json:"orderPayPrice"`
SkuInfoList
[]
struct
{
Quantity
uint
`json:"quantity"`
Name
string
`json:"name"`
SellerToken
string
`json:"sellerToken"`
Value
string
`json:"value"`
Title
string
`json:"title"`
}
`json:"skuInfoList"`
}
`json:"validOrderGroups"`
Title
string
`json:"title"`
}
`json:"result"`
}
`json:"itemInfo"`
Success
bool
`json:"success"`
ItemPayPrice
uint
`json:"itemPayPrice"`
ErrMsg
string
`json:"errMsg"`
OrderLineId
int
`json:"orderLineId"`
ErrCode
string
`json:"errCode"`
Quantity
uint
`json:"quantity"`
}
`json:"orderLineRenders"`
OrderPayPrice
int
`json:"orderPayPrice"`
PostFee
int
`json:"postFee"`
Quantity
int
`json:"quantity"`
SellerToken
string
`json:"sellerToken"`
Title
string
`json:"title"`
}
`json:"validOrderGroups"`
}
`json:"result"`
}
`json:"result"`
}
}
...
@@ -433,15 +440,5 @@ type OrderPayRes struct {
...
@@ -433,15 +440,5 @@ type OrderPayRes struct {
}
}
func
(
s
orderItao
)
Pay
(
ctx
context
.
Context
,
req
string
)
(
res
*
OrderPayRes
,
err
error
)
{
func
(
s
orderItao
)
Pay
(
ctx
context
.
Context
,
req
string
)
(
res
*
OrderPayRes
,
err
error
)
{
method
:=
"com.alibaba.c2m/ltao.pay.agreementPay"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"bizOrderId"
:
req
,
},
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
return
}
}
upstream/itao/itao_refund.go
浏览文件 @
6a4135a2
package
itao
package
itao
import
(
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
type
refund
struct
{
type
refund
struct
{
}
}
var
Refund
=
refund
{}
var
Refund
=
refund
{}
type
RefundPic
struct
{
MessagePic
string
`json:"messagePic"`
}
type
RefundBeforeRes
struct
{
Success
bool
`json:"success"`
ErrMsg
string
`json:"errMsg"`
Result
struct
{
BizClaimTypeVOList
[]
struct
{
BizClaimType
string
`json:"bizClaimType"`
//refund 仅退款 return_and_refund 退货退款
RefundTypeTitle
string
`json:"refundTypeTitle"`
}
`json:"bizClaimTypeVOList"`
}
`json:"result"`
}
//Before 退款类型
func
(
s
refund
)
Before
(
ctx
context
.
Context
,
req
string
)
(
res
*
RefundBeforeRes
,
err
error
)
{
method
:=
"tt.refund.refundApplyType"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"bizOrderId"
:
req
,
},
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
}
type
RefundReasonReq
struct
{
BizOrderId
string
`json:"bizOrderId"`
BizClaimType
string
`json:"bizClaimType"`
GoodsStatus
string
`json:"goodsStatus"`
}
type
RefundReasonRes
struct
{
Success
bool
`json:"success"`
ErrMsg
string
`json:"errMsg"`
Result
struct
{
MaxRefundFee
int
`json:"maxRefundFee"`
MinRefundFee
int
`json:"minRefundFee"`
MustProof
bool
`json:"mustProof"`
RefundTextWrapperVOList
[]
struct
{
Name
string
`json:"name"`
ReasonGroup
int
`json:"reasonGroup"`
TextId
int
`json:"textId"`
}
`json:"refundTextWrapperVOList"`
}
`json:"result"`
}
//Reason 原因
func
(
s
refund
)
Reason
(
ctx
context
.
Context
,
req
RefundReasonReq
)
(
res
*
RefundReasonRes
,
err
error
)
{
method
:=
"tt.refund.refundApplyInit"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
req
,
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
}
type
RefundCreateReq
struct
{
BizOrderId
string
`json:"bizOrderId"`
//子订单号
BizClaimType
string
`json:"bizClaimType"`
//refund 仅退款 return_and_refund 退货退款
GoodsStatus
string
`json:"goodsStatus,omitempty"`
//"1":未收到货 "2":未已收到货 未发货情况下,千万不要传
RefundFee
string
`json:"refundFee"`
//退款金额,单位是分
ApplyRefundTextId
string
`json:"applyRefundTextId"`
//原因ID
LeaveMessagePics
[]
RefundPic
`json:"leaveMessagePics,omitempty"`
}
//Create 申请
func
(
s
refund
)
Create
(
ctx
context
.
Context
,
req
RefundCreateReq
,
image
...
string
)
(
res
*
RefundBeforeRes
,
err
error
)
{
method
:=
"tt.refund.refundSubmit"
if
len
(
image
)
>
0
{
for
_
,
item
:=
range
image
{
req
.
LeaveMessagePics
=
append
(
req
.
LeaveMessagePics
,
RefundPic
{
MessagePic
:
item
})
}
}
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"bizOrderId"
:
req
,
},
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
}
//Cancle 取消售后
//`bizOrderId` 子订单号
//`disputeId` 售后单号
func
(
s
refund
)
Cancle
(
ctx
context
.
Context
,
bizOrderId
,
disputeId
string
)
(
res
*
CommonRes
,
err
error
)
{
method
:=
"tt.refund.refundSubmit"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"bizOrderId"
:
bizOrderId
,
"disputeId"
:
disputeId
,
},
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
}
type
RefundSubmitReq
struct
{
DisputeId
string
`json:"disputeId"`
BizOrderId
string
`json:"bizOrderId"`
CompanyCode
string
`json:"logisticsCompanyCode"`
CompanyId
string
`json:"logisticsCompanyId"`
CompanyName
string
`json:"logisticsCompanyName"`
LogisticsNo
string
`json:"logisticsNo"`
MobileNum
string
`json:"mobileNum"`
LeaveMessagePics
[]
RefundPic
`json:"leaveMessagePics"`
}
type
RefundSubmitRes
struct
{
Success
bool
`json:"success"`
Result
struct
{
DisputeStatus
string
`json:"disputeStatus"`
//REFUND_WAIT_SELLER_AGREE:"买家已经申请退款,等待卖家同意";
//REFUND_WAIT_BUYER_RETURN_GOODS:"卖家已经同意退款,等待买家退货";
//REFUND_WAIT_SELLER_CONFIRM_GOODS:"买家已经退货,等待卖家确认收货";
//REFUND_CLOSED:"退款关闭";
//REFUND_SUCCESS:"退款成功";
//REFUND_SELLER_REFUSE_BUYER:"卖家拒绝退款";
//REFUND_WAIT_BUYER_CONFIRM_REDO_SEND_GOODS:"等待买家确认重新邮寄的货物";
//REFUND_WAIT_SELLER_CONFIRM_RETURN_ADDRESS:"等待卖家确认退货地址"
}
`json:"result"`
}
//Submit 提交物流信息
func
(
s
refund
)
Submit
(
ctx
context
.
Context
,
req
RefundSubmitReq
,
image
...
string
)
(
res
*
CommonRes
,
err
error
)
{
method
:=
"tt.refund.refundSubmit"
if
len
(
image
)
>
0
{
for
_
,
item
:=
range
image
{
req
.
LeaveMessagePics
=
append
(
req
.
LeaveMessagePics
,
RefundPic
{
MessagePic
:
item
})
}
}
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
req
,
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
}
type
RefundDetailRes
struct
{
Success
bool
`json:"success"`
ErrMsg
string
`json:"errMsg"`
Result
struct
{
DisputeId
int64
`json:"disputeId"`
//退款编号
DisputeStatus
string
`json:"disputeStatus"`
//退款状态
//REFUND_WAIT_SELLER_AGREE:"买家已经申请退款,等待卖家同意";
//REFUND_WAIT_BUYER_RETURN_GOODS:"卖家已经同意退款,等待买家退货";
//REFUND_WAIT_SELLER_CONFIRM_GOODS:"买家已经退货,等待卖家确认收货";
//REFUND_CLOSED:"退款关闭";
//REFUND_SUCCESS:"退款成功";
//REFUND_SELLER_REFUSE_BUYER:"卖家拒绝退款";
//REFUND_WAIT_BUYER_CONFIRM_REDO_SEND_GOODS:"等待买家确认重新邮寄的货物";
//REFUND_WAIT_SELLER_CONFIRM_RETURN_ADDRESS:"等待卖家确认退货地址"
DisputeTimeOut
struct
{
Duration
int
`json:"duration"`
GmtCreate
int64
`json:"gmtCreate"`
Running
bool
`json:"running"`
TimeoutActionType
string
`json:"timeoutActionType"`
}
`json:"disputeTimeOut"`
ReasonName
string
`json:"reasonName"`
//退款原因名称
RefundFee
int
`json:"refundFee"`
//退款金额,单位分
ShippingAddressWrapperDTO
struct
{
AddressDetail
string
`json:"addressDetail"`
AreaName
string
`json:"areaName"`
CityName
string
`json:"cityName"`
ConsigneeFullName
string
`json:"consigneeFullName"`
DivisionCode
string
`json:"divisionCode"`
Mobile
string
`json:"mobile"`
PostCode
string
`json:"postCode"`
ProvinceName
string
`json:"provinceName"`
TownName
string
`json:"townName"`
}
`json:"shippingAddressWrapperDTO"`
}
`json:"result"`
}
//Detail 详情
func
(
s
refund
)
Detail
(
ctx
context
.
Context
,
bizOrderId
,
disputeId
string
)
(
res
*
RefundDetailRes
,
err
error
)
{
method
:=
"tt.refund.queryRefundDetail"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"bizOrderId"
:
bizOrderId
,
"disputeId"
:
disputeId
,
},
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论