Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
L
library
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
stbz
library
Commits
ff6bd2db
提交
ff6bd2db
authored
1月 05, 2023
作者:
zhanglibo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
淘特
上级
6a4135a2
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
194 行增加
和
65 行删除
+194
-65
itao.go
upstream/itao/itao.go
+15
-10
itao_goods.go
upstream/itao/itao_goods.go
+6
-6
itao_logistics.go
upstream/itao/itao_logistics.go
+29
-2
itao_order.go
upstream/itao/itao_order.go
+52
-33
itao_refund.go
upstream/itao/itao_refund.go
+18
-14
itao_upload.go
upstream/itao/itao_upload.go
+74
-0
没有找到文件。
upstream/itao/itao.go
浏览文件 @
ff6bd2db
...
@@ -34,7 +34,7 @@ func New(req *Config) {
...
@@ -34,7 +34,7 @@ func New(req *Config) {
server
=
req
server
=
req
gtimer
.
Add
(
time
.
Hour
,
func
()
{
gtimer
.
Add
(
time
.
Hour
,
func
()
{
var
ctx
=
gctx
.
New
()
var
ctx
=
gctx
.
New
()
_
=
server
.
accessToken
(
ctx
)
_
,
_
=
server
.
accessToken
(
ctx
)
})
})
return
return
}
}
...
@@ -101,7 +101,7 @@ func Post(ctx context.Context, method string, params g.Map) (str string, err err
...
@@ -101,7 +101,7 @@ func Post(ctx context.Context, method string, params g.Map) (str string, err err
defer
func
()
{
defer
func
()
{
_
=
resp
.
Close
()
_
=
resp
.
Close
()
paramStr
:=
gjson
.
New
(
params
)
.
MustToJsonString
()
paramStr
:=
gjson
.
New
(
params
)
.
MustToJsonString
()
ctx
=
context
.
WithValue
(
ctx
,
"Method"
,
"
GE
T"
)
ctx
=
context
.
WithValue
(
ctx
,
"Method"
,
"
POS
T"
)
ctx
=
context
.
WithValue
(
ctx
,
"URI"
,
Url
)
ctx
=
context
.
WithValue
(
ctx
,
"URI"
,
Url
)
if
err
!=
nil
{
if
err
!=
nil
{
g
.
Log
()
.
Cat
(
PkgName
)
.
Ctx
(
ctx
)
.
Infof
(
"参数【%v】错误【%v】响应时间【%vms】"
,
paramStr
,
err
.
Error
(),
gtime
.
TimestampMilli
()
-
Start
)
g
.
Log
()
.
Cat
(
PkgName
)
.
Ctx
(
ctx
)
.
Infof
(
"参数【%v】错误【%v】响应时间【%vms】"
,
paramStr
,
err
.
Error
(),
gtime
.
TimestampMilli
()
-
Start
)
...
@@ -170,16 +170,22 @@ func (s *Config) GetAccessToken(ctx context.Context) (res string, err error) {
...
@@ -170,16 +170,22 @@ func (s *Config) GetAccessToken(ctx context.Context) (res string, err error) {
}
}
var
result
*
AuthTokenRes
var
result
*
AuthTokenRes
_
=
gjson
.
New
(
cache
)
.
Scan
(
&
result
)
_
=
gjson
.
New
(
cache
)
.
Scan
(
&
result
)
if
result
==
nil
||
result
.
AccessToken
==
""
||
result
.
AccessTokenExpireTime
<
gtime
.
TimestampMilli
()
{
if
result
==
nil
||
result
.
AccessToken
==
""
{
err
=
gerror
.
New
(
"获取token 失败"
)
err
=
gerror
.
New
(
"获取token 失败"
)
return
return
}
}
if
result
.
AccessTokenExpireTime
<
gtime
.
TimestampMilli
()
{
result
,
err
=
s
.
accessToken
(
ctx
)
if
err
!=
nil
{
return
}
}
res
=
result
.
AccessToken
res
=
result
.
AccessToken
return
return
}
}
//accessToken 刷新
//accessToken 刷新
func
(
s
*
Config
)
accessToken
(
ctx
context
.
Context
)
(
err
error
)
{
func
(
s
*
Config
)
accessToken
(
ctx
context
.
Context
)
(
res
*
AuthTokenRes
,
err
error
)
{
var
conn
=
g
.
Redis
()
.
Conn
()
var
conn
=
g
.
Redis
()
.
Conn
()
defer
func
()
{
defer
func
()
{
_
=
conn
.
Close
()
_
=
conn
.
Close
()
...
@@ -190,19 +196,18 @@ func (s *Config) accessToken(ctx context.Context) (err error) {
...
@@ -190,19 +196,18 @@ func (s *Config) accessToken(ctx context.Context) (err error) {
err
=
gerror
.
New
(
"获取token 失败"
)
err
=
gerror
.
New
(
"获取token 失败"
)
return
return
}
}
var
result
*
AuthTokenRes
_
=
gjson
.
New
(
cache
)
.
Scan
(
&
res
)
_
=
gjson
.
New
(
cache
)
.
Scan
(
&
result
)
if
res
.
AccessTokenExpireTime
>
gtime
.
Now
()
.
Add
(
time
.
Hour
)
.
TimestampMilli
()
{
if
result
.
AccessTokenExpireTime
>
gtime
.
Now
()
.
Add
(
time
.
Hour
)
.
TimestampMilli
()
{
return
return
}
}
res
ult
,
err
=
Auth
.
Token
(
ctx
,
result
.
RefreshToken
,
2
)
res
,
err
=
Auth
.
Token
(
ctx
,
res
.
RefreshToken
,
2
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
if
res
ult
.
Code
!=
"success"
{
if
res
.
Code
!=
"success"
{
err
=
gerror
.
New
(
"获取token 失败"
)
err
=
gerror
.
New
(
"获取token 失败"
)
return
return
}
}
_
,
_
=
conn
.
Do
(
"HMSET"
,
CacheKey
,
"accessToken"
,
res
ult
.
AccessToken
,
"accessTokenExpireTime"
,
result
.
AccessTokenExpireTime
)
_
,
_
=
conn
.
Do
(
"HMSET"
,
CacheKey
,
"accessToken"
,
res
.
AccessToken
,
"accessTokenExpireTime"
,
res
.
AccessTokenExpireTime
)
return
return
}
}
upstream/itao/itao_goods.go
浏览文件 @
ff6bd2db
...
@@ -7,10 +7,10 @@ import (
...
@@ -7,10 +7,10 @@ import (
"github.com/gogf/gf/util/gconv"
"github.com/gogf/gf/util/gconv"
)
)
type
goods
Itao
struct
{
type
goods
struct
{
}
}
var
Goods
=
goods
Itao
{}
var
Goods
=
goods
{}
type
GoodsListReq
struct
{
type
GoodsListReq
struct
{
Q
string
`json:"q,omitempty"`
//关键词
Q
string
`json:"q,omitempty"`
//关键词
...
@@ -40,7 +40,7 @@ type GoodsListRes struct {
...
@@ -40,7 +40,7 @@ type GoodsListRes struct {
}
`json:"auctions"`
}
`json:"auctions"`
}
}
func
(
goods
Itao
)
List
(
ctx
context
.
Context
,
req
GoodsListReq
)
(
res
*
GoodsListRes
,
err
error
)
{
func
(
goods
)
List
(
ctx
context
.
Context
,
req
GoodsListReq
)
(
res
*
GoodsListRes
,
err
error
)
{
method
:=
"tt.item.list"
method
:=
"tt.item.list"
result
,
err
:=
server
.
Get
(
ctx
,
method
,
gconv
.
Map
(
req
))
result
,
err
:=
server
.
Get
(
ctx
,
method
,
gconv
.
Map
(
req
))
...
@@ -121,7 +121,7 @@ type GoodsItem struct {
...
@@ -121,7 +121,7 @@ type GoodsItem struct {
}
}
//Detail 详情
//Detail 详情
func
(
goods
Itao
)
Detail
(
ctx
context
.
Context
,
GoodsID
string
)
(
res
*
GoodsDetailRes
,
err
error
)
{
func
(
goods
)
Detail
(
ctx
context
.
Context
,
GoodsID
string
)
(
res
*
GoodsDetailRes
,
err
error
)
{
method
:=
"tt.item.detail.v2"
method
:=
"tt.item.detail.v2"
var
request
=
GoodsDetailReq
{
var
request
=
GoodsDetailReq
{
AppKey
:
gconv
.
Int
(
server
.
AppKey
),
AppKey
:
gconv
.
Int
(
server
.
AppKey
),
...
@@ -317,7 +317,7 @@ type GoodsDescItem struct {
...
@@ -317,7 +317,7 @@ type GoodsDescItem struct {
}
}
//Desc 详情描述
//Desc 详情描述
func
(
goods
Itao
)
Desc
(
ctx
context
.
Context
,
GoodsID
string
)
(
res
*
GoodsDescRes
,
err
error
)
{
func
(
goods
)
Desc
(
ctx
context
.
Context
,
GoodsID
string
)
(
res
*
GoodsDescRes
,
err
error
)
{
method
:=
"tt.item.desc"
method
:=
"tt.item.desc"
result
,
err
:=
server
.
Get
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Get
(
ctx
,
method
,
g
.
Map
{
...
@@ -348,7 +348,7 @@ type GoodsCategoryRes struct {
...
@@ -348,7 +348,7 @@ type GoodsCategoryRes struct {
}
}
//Category 商品类目
//Category 商品类目
func
(
goods
Itao
)
Category
(
ctx
context
.
Context
,
GoodsID
string
)
(
res
*
GoodsCategoryRes
,
err
error
)
{
func
(
goods
)
Category
(
ctx
context
.
Context
,
GoodsID
string
)
(
res
*
GoodsCategoryRes
,
err
error
)
{
method
:=
"tt.item.cateInfo"
method
:=
"tt.item.cateInfo"
result
,
err
:=
server
.
Get
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Get
(
ctx
,
method
,
g
.
Map
{
...
...
upstream/itao/itao_logistics.go
浏览文件 @
ff6bd2db
...
@@ -57,8 +57,25 @@ func (logistics) Trace(ctx context.Context, req string) (res *LogisticsTraceRes,
...
@@ -57,8 +57,25 @@ func (logistics) Trace(ctx context.Context, req string) (res *LogisticsTraceRes,
return
return
}
}
type
LogisticsCompanyRes
struct
{
Result
[]
LogisticsCompanyItem
`json:"result"`
Success
bool
`json:"success"`
}
type
LogisticsCompanyItem
struct
{
Code
string
`json:"code"`
Name
string
`json:"name"`
Id
int64
`json:"id"`
Type
int
`json:"type"`
}
type
LogisticsCompany
struct
{
Result
map
[
string
][]
interface
{}
`json:"result"`
Success
bool
`json:"success"`
}
//Company 物流公司
//Company 物流公司
func
(
logistics
)
Company
(
ctx
context
.
Context
,
req
string
)
(
res
*
Logistics
Trace
Res
,
err
error
)
{
func
(
logistics
)
Company
(
ctx
context
.
Context
,
req
string
)
(
res
*
Logistics
Company
Res
,
err
error
)
{
method
:=
"tt.refund.queryLogisticList"
method
:=
"tt.refund.queryLogisticList"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
...
@@ -66,6 +83,16 @@ func (logistics) Company(ctx context.Context, req string) (res *LogisticsTraceRe
...
@@ -66,6 +83,16 @@ func (logistics) Company(ctx context.Context, req string) (res *LogisticsTraceRe
"bizOrderId"
:
req
,
"bizOrderId"
:
req
,
},
},
})
})
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
var
data
*
LogisticsCompany
_
=
gjson
.
New
(
result
)
.
Scan
(
&
data
)
res
=
new
(
LogisticsCompanyRes
)
res
.
Success
=
data
.
Success
for
_
,
item
:=
range
data
.
Result
{
for
_
,
val
:=
range
item
{
var
value
[]
LogisticsCompanyItem
_
=
gjson
.
New
(
val
)
.
Scan
(
&
value
)
res
.
Result
=
append
(
res
.
Result
,
value
...
)
}
}
return
return
}
}
upstream/itao/itao_order.go
浏览文件 @
ff6bd2db
...
@@ -9,10 +9,10 @@ import (
...
@@ -9,10 +9,10 @@ import (
"github.com/gogf/gf/util/gconv"
"github.com/gogf/gf/util/gconv"
)
)
type
order
Itao
struct
{
type
order
struct
{
}
}
var
Order
=
order
Itao
{}
var
Order
=
order
{}
type
OrderBeforeReq
struct
{
type
OrderBeforeReq
struct
{
Address
OrderAddress
`json:"deliveryAddressInfo"`
Address
OrderAddress
`json:"deliveryAddressInfo"`
...
@@ -98,16 +98,16 @@ type OrderBeforeRes struct {
...
@@ -98,16 +98,16 @@ type OrderBeforeRes struct {
ItemId
int64
`json:"itemId"`
ItemId
int64
`json:"itemId"`
Pic
string
`json:"pic"`
Pic
string
`json:"pic"`
Price
string
`json:"price"`
Price
string
`json:"price"`
SkuId
int64
`json:"skuId"`
SkuId
string
`json:"skuId"`
SkuInfoList
[]
struct
{
SkuInfoList
[]
struct
{
Name
string
`json:"name"`
Name
string
`json:"name"`
Value
string
`json:"value"`
Value
string
`json:"value"`
}
`json:"skuInfoList"`
}
`json:"skuInfoList"`
Title
string
`json:"title"`
Title
string
`json:"title"`
}
`json:"itemInfo"`
}
`json:"itemInfo"`
ItemPayPrice
uint
`json:"itemPayPrice"`
ItemPayPrice
uint
`json:"itemPayPrice"`
OrderLineId
int
`json:"orderLineId"`
OrderLineId
int
64
`json:"orderLineId"`
Quantity
uint
`json:"quantity"`
Quantity
uint
`json:"quantity"`
}
`json:"orderLineRenders"`
}
`json:"orderLineRenders"`
OrderPayPrice
int
`json:"orderPayPrice"`
OrderPayPrice
int
`json:"orderPayPrice"`
PostFee
int
`json:"postFee"`
PostFee
int
`json:"postFee"`
...
@@ -147,7 +147,7 @@ type OrderPromotion struct {
...
@@ -147,7 +147,7 @@ type OrderPromotion struct {
}
}
//Before 前置校验
//Before 前置校验
func
(
s
order
Itao
)
Before
(
ctx
context
.
Context
,
req
OrderBeforeReq
)
(
res
*
OrderBeforeRes
,
err
error
)
{
func
(
s
order
)
Before
(
ctx
context
.
Context
,
req
OrderBeforeReq
)
(
res
*
OrderBeforeRes
,
err
error
)
{
method
:=
"tt.order.render"
method
:=
"tt.order.render"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
...
@@ -201,7 +201,7 @@ type OrderCreateRes struct {
...
@@ -201,7 +201,7 @@ type OrderCreateRes struct {
}
}
//Create 下单
//Create 下单
func
(
s
order
Itao
)
Create
(
ctx
context
.
Context
,
req
OrderCreateReq
)
(
res
*
OrderCreateRes
,
err
error
)
{
func
(
s
order
)
Create
(
ctx
context
.
Context
,
req
OrderCreateReq
)
(
res
*
OrderCreateRes
,
err
error
)
{
method
:=
"tt.order.create"
method
:=
"tt.order.create"
for
k
,
item
:=
range
req
.
List
{
for
k
,
item
:=
range
req
.
List
{
...
@@ -216,7 +216,7 @@ func (s orderItao) Create(ctx context.Context, req OrderCreateReq) (res *OrderCr
...
@@ -216,7 +216,7 @@ func (s orderItao) Create(ctx context.Context, req OrderCreateReq) (res *OrderCr
return
return
}
}
func
(
s
order
Itao
)
outId
(
req
string
)
(
res
string
)
{
func
(
s
order
)
outId
(
req
string
)
(
res
string
)
{
res
=
gstr
.
SubStr
(
req
,
2
,
-
1
)
res
=
gstr
.
SubStr
(
req
,
2
,
-
1
)
res
=
gstr
.
Replace
(
res
,
"_15_"
,
"_"
)
res
=
gstr
.
Replace
(
res
,
"_15_"
,
"_"
)
return
fmt
.
Sprintf
(
"%s_%s"
,
server
.
AppKey
,
res
)
return
fmt
.
Sprintf
(
"%s_%s"
,
server
.
AppKey
,
res
)
...
@@ -226,12 +226,12 @@ type OrderDetailRes struct {
...
@@ -226,12 +226,12 @@ type OrderDetailRes struct {
Success
bool
`json:"success"`
Success
bool
`json:"success"`
ErrMsg
string
`json:"errMsg"`
ErrMsg
string
`json:"errMsg"`
Result
struct
{
Result
struct
{
BizOrderId
int64
`json:"bizOrderId"`
BizOrderId
string
`json:"bizOrderId"`
BuyAmount
int
`json:"buyAmount"`
BuyAmount
int
`json:"buyAmount"`
BuyerToken
string
`json:"buyerToken"`
BuyerToken
string
`json:"buyerToken"`
Detail
int
`json:"detail"`
Detail
int
`json:"detail"`
DetailOrderList
[]
struct
{
DetailOrderList
[]
struct
{
BizOrderId
int64
`json:"bizOrderId"`
BizOrderId
string
`json:"bizOrderId"`
BuyAmount
int
`json:"buyAmount"`
BuyAmount
int
`json:"buyAmount"`
BuyerToken
string
`json:"buyerToken"`
BuyerToken
string
`json:"buyerToken"`
Detail
int
`json:"detail"`
Detail
int
`json:"detail"`
...
@@ -316,7 +316,7 @@ type OrderDetailRes struct {
...
@@ -316,7 +316,7 @@ type OrderDetailRes struct {
}
}
//Detail 详情
//Detail 详情
func
(
s
order
Itao
)
Detail
(
ctx
context
.
Context
,
req
interface
{})
(
res
*
OrderDetailRes
,
err
error
)
{
func
(
s
order
)
Detail
(
ctx
context
.
Context
,
req
interface
{})
(
res
*
OrderDetailRes
,
err
error
)
{
method
:=
"tt.order.detail"
method
:=
"tt.order.detail"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
...
@@ -331,7 +331,10 @@ func (s orderItao) Detail(ctx context.Context, req interface{}) (res *OrderDetai
...
@@ -331,7 +331,10 @@ func (s orderItao) Detail(ctx context.Context, req interface{}) (res *OrderDetai
}
}
type
OrderReflectRes
struct
{
type
OrderReflectRes
struct
{
Result
struct
{
Success
bool
`json:"success"`
ErrMsg
string
`json:"errMsg"`
ErrCode
string
`json:"errCode"`
Result
struct
{
BizOrderId
string
`json:"bizOrderId"`
BizOrderId
string
`json:"bizOrderId"`
BuyAmount
uint
`json:"buyAmount"`
BuyAmount
uint
`json:"buyAmount"`
BuyerToken
string
`json:"buyerToken"`
BuyerToken
string
`json:"buyerToken"`
...
@@ -343,12 +346,15 @@ type OrderReflectRes struct {
...
@@ -343,12 +346,15 @@ type OrderReflectRes struct {
Detail
int
`json:"detail"`
Detail
int
`json:"detail"`
GmtCreate
string
`json:"gmtCreate"`
GmtCreate
string
`json:"gmtCreate"`
ItemInfo
struct
{
ItemInfo
struct
{
ItemId
string
`json:"itemId"`
ItemId
string
`json:"itemId"`
Pic
string
`json:"pic"`
Pic
string
`json:"pic"`
Price
uint
`json:"price"`
Price
uint
`json:"price"`
SkuId
string
`json:"skuId"`
SkuId
string
`json:"skuId"`
SkuInfoList
[]
interface
{}
`json:"skuInfoList"`
SkuInfoList
[]
struct
{
Title
string
`json:"title"`
Name
string
`json:"name"`
Value
string
`json:"value"`
}
`json:"skuInfoList"`
Title
string
`json:"title"`
}
`json:"itemInfo"`
}
`json:"itemInfo"`
LogisticsOrderId
int64
`json:"logisticsOrderId"`
LogisticsOrderId
int64
`json:"logisticsOrderId"`
LogisticsStatus
int
`json:"logisticsStatus"`
LogisticsStatus
int
`json:"logisticsStatus"`
...
@@ -378,12 +384,15 @@ type OrderReflectRes struct {
...
@@ -378,12 +384,15 @@ type OrderReflectRes struct {
}
`json:"detailOrderList"`
}
`json:"detailOrderList"`
GmtCreate
string
`json:"gmtCreate"`
GmtCreate
string
`json:"gmtCreate"`
ItemInfo
struct
{
ItemInfo
struct
{
ItemId
string
`json:"itemId"`
ItemId
string
`json:"itemId"`
Pic
string
`json:"pic"`
Pic
string
`json:"pic"`
Price
uint
`json:"price"`
Price
uint
`json:"price"`
SkuId
string
`json:"skuId"`
SkuId
string
`json:"skuId"`
SkuInfoList
[]
interface
{}
`json:"skuInfoList"`
SkuInfoList
[]
struct
{
Title
string
`json:"title"`
Name
string
`json:"name"`
Value
string
`json:"value"`
}
`json:"skuInfoList"`
Title
string
`json:"title"`
}
`json:"itemInfo"`
}
`json:"itemInfo"`
LogisticsOrderId
int64
`json:"logisticsOrderId"`
LogisticsOrderId
int64
`json:"logisticsOrderId"`
LogisticsStatus
int
`json:"logisticsStatus"`
LogisticsStatus
int
`json:"logisticsStatus"`
...
@@ -411,13 +420,10 @@ type OrderReflectRes struct {
...
@@ -411,13 +420,10 @@ type OrderReflectRes struct {
SellerToken
string
`json:"sellerToken"`
SellerToken
string
`json:"sellerToken"`
Status
int
`json:"status"`
Status
int
`json:"status"`
}
`json:"result"`
}
`json:"result"`
Success
bool
`json:"success"`
ErrMsg
string
`json:"errMsg"`
ErrCode
string
`json:"errCode"`
}
}
//Reflect 详情[反查]
//Reflect 详情[反查]
func
(
s
order
Itao
)
Reflect
(
ctx
context
.
Context
,
req
string
)
(
res
*
OrderReflectRes
,
err
error
)
{
func
(
s
order
)
Reflect
(
ctx
context
.
Context
,
req
string
)
(
res
*
OrderReflectRes
,
err
error
)
{
method
:=
"tt.order.detail.outid"
method
:=
"tt.order.detail.outid"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
...
@@ -433,12 +439,25 @@ func (s orderItao) Reflect(ctx context.Context, req string) (res *OrderReflectRe
...
@@ -433,12 +439,25 @@ func (s orderItao) Reflect(ctx context.Context, req string) (res *OrderReflectRe
type
OrderPayRes
struct
{
type
OrderPayRes
struct
{
Result
struct
{
Result
struct
{
ErrCode
string
`json:"errCode"`
Result
struct
{
ErrMsg
string
`json:"errMsg"`
Result
string
`json:"result"`
Success
bool
`json:"success"`
Success
bool
`json:"success"`
ErrCode
string
`json:"errCode"`
ErrMsg
string
`json:"errMsg"`
}
`json:"result"`
}
`json:"result"`
}
`json:"result"`
}
}
func
(
s
orderItao
)
Pay
(
ctx
context
.
Context
,
req
string
)
(
res
*
OrderPayRes
,
err
error
)
{
func
(
s
order
)
Pay
(
ctx
context
.
Context
,
req
string
)
(
res
*
OrderPayRes
,
err
error
)
{
method
:=
"tt.agreementpay.dopay"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"bizOrderId"
:
gconv
.
Int64
(
req
),
},
})
_
=
gjson
.
NewWithOptions
(
result
,
gjson
.
Options
{
StrNumber
:
true
,
})
.
Scan
(
&
res
)
return
return
}
}
upstream/itao/itao_refund.go
浏览文件 @
ff6bd2db
...
@@ -16,9 +16,8 @@ type RefundPic struct {
...
@@ -16,9 +16,8 @@ type RefundPic struct {
}
}
type
RefundBeforeRes
struct
{
type
RefundBeforeRes
struct
{
Success
bool
`json:"success"`
CommonRes
ErrMsg
string
`json:"errMsg"`
Result
struct
{
Result
struct
{
BizClaimTypeVOList
[]
struct
{
BizClaimTypeVOList
[]
struct
{
BizClaimType
string
`json:"bizClaimType"`
//refund 仅退款 return_and_refund 退货退款
BizClaimType
string
`json:"bizClaimType"`
//refund 仅退款 return_and_refund 退货退款
RefundTypeTitle
string
`json:"refundTypeTitle"`
RefundTypeTitle
string
`json:"refundTypeTitle"`
...
@@ -44,13 +43,12 @@ func (s refund) Before(ctx context.Context, req string) (res *RefundBeforeRes, e
...
@@ -44,13 +43,12 @@ func (s refund) Before(ctx context.Context, req string) (res *RefundBeforeRes, e
type
RefundReasonReq
struct
{
type
RefundReasonReq
struct
{
BizOrderId
string
`json:"bizOrderId"`
BizOrderId
string
`json:"bizOrderId"`
BizClaimType
string
`json:"bizClaimType"`
BizClaimType
string
`json:"bizClaimType"`
GoodsStatus
string
`json:"goodsStatus"`
GoodsStatus
string
`json:"goodsStatus
,omitempty
"`
}
}
type
RefundReasonRes
struct
{
type
RefundReasonRes
struct
{
Success
bool
`json:"success"`
CommonRes
ErrMsg
string
`json:"errMsg"`
Result
struct
{
Result
struct
{
MaxRefundFee
int
`json:"maxRefundFee"`
MaxRefundFee
int
`json:"maxRefundFee"`
MinRefundFee
int
`json:"minRefundFee"`
MinRefundFee
int
`json:"minRefundFee"`
MustProof
bool
`json:"mustProof"`
MustProof
bool
`json:"mustProof"`
...
@@ -84,8 +82,15 @@ type RefundCreateReq struct {
...
@@ -84,8 +82,15 @@ type RefundCreateReq struct {
LeaveMessagePics
[]
RefundPic
`json:"leaveMessagePics,omitempty"`
LeaveMessagePics
[]
RefundPic
`json:"leaveMessagePics,omitempty"`
}
}
type
RefundCreateRess
struct
{
CommonRes
Result
struct
{
DisputeId
string
`json:"disputeId"`
}
`json:"result"`
}
//Create 申请
//Create 申请
func
(
s
refund
)
Create
(
ctx
context
.
Context
,
req
RefundCreateReq
,
image
...
string
)
(
res
*
Refund
BeforeRe
s
,
err
error
)
{
func
(
s
refund
)
Create
(
ctx
context
.
Context
,
req
RefundCreateReq
,
image
...
string
)
(
res
*
Refund
CreateRes
s
,
err
error
)
{
method
:=
"tt.refund.refundSubmit"
method
:=
"tt.refund.refundSubmit"
if
len
(
image
)
>
0
{
if
len
(
image
)
>
0
{
for
_
,
item
:=
range
image
{
for
_
,
item
:=
range
image
{
...
@@ -108,7 +113,7 @@ func (s refund) Create(ctx context.Context, req RefundCreateReq, image ...string
...
@@ -108,7 +113,7 @@ func (s refund) Create(ctx context.Context, req RefundCreateReq, image ...string
//`bizOrderId` 子订单号
//`bizOrderId` 子订单号
//`disputeId` 售后单号
//`disputeId` 售后单号
func
(
s
refund
)
Cancle
(
ctx
context
.
Context
,
bizOrderId
,
disputeId
string
)
(
res
*
CommonRes
,
err
error
)
{
func
(
s
refund
)
Cancle
(
ctx
context
.
Context
,
bizOrderId
,
disputeId
string
)
(
res
*
CommonRes
,
err
error
)
{
method
:=
"tt.refund.refund
Submit
"
method
:=
"tt.refund.refund
Revoke
"
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
server
.
Post
(
ctx
,
method
,
g
.
Map
{
"request"
:
g
.
Map
{
"request"
:
g
.
Map
{
...
@@ -134,8 +139,8 @@ type RefundSubmitReq struct {
...
@@ -134,8 +139,8 @@ type RefundSubmitReq struct {
}
}
type
RefundSubmitRes
struct
{
type
RefundSubmitRes
struct
{
Success
bool
`json:"success"`
CommonRes
Result
struct
{
Result
struct
{
DisputeStatus
string
`json:"disputeStatus"`
DisputeStatus
string
`json:"disputeStatus"`
//REFUND_WAIT_SELLER_AGREE:"买家已经申请退款,等待卖家同意";
//REFUND_WAIT_SELLER_AGREE:"买家已经申请退款,等待卖家同意";
//REFUND_WAIT_BUYER_RETURN_GOODS:"卖家已经同意退款,等待买家退货";
//REFUND_WAIT_BUYER_RETURN_GOODS:"卖家已经同意退款,等待买家退货";
...
@@ -166,9 +171,8 @@ func (s refund) Submit(ctx context.Context, req RefundSubmitReq, image ...string
...
@@ -166,9 +171,8 @@ func (s refund) Submit(ctx context.Context, req RefundSubmitReq, image ...string
}
}
type
RefundDetailRes
struct
{
type
RefundDetailRes
struct
{
Success
bool
`json:"success"`
CommonRes
ErrMsg
string
`json:"errMsg"`
Result
struct
{
Result
struct
{
DisputeId
int64
`json:"disputeId"`
//退款编号
DisputeId
int64
`json:"disputeId"`
//退款编号
DisputeStatus
string
`json:"disputeStatus"`
DisputeStatus
string
`json:"disputeStatus"`
//退款状态
//退款状态
...
...
upstream/itao/itao_upload.go
0 → 100644
浏览文件 @
ff6bd2db
package
itao
import
(
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/util/gconv"
"net/url"
"time"
)
type
upload
struct
{
}
var
Upload
=
upload
{}
type
UploadImageReq
struct
{
FileName
string
`json:"fileName"`
FileContent
string
`json:"fileContent"`
ImageData
string
`json:"imageData"`
}
type
UploadImageRes
struct
{
Code
string
`json:"code"`
Message
string
`json:"message"`
FileUrl
string
`json:"fileUrl"`
}
func
(
s
upload
)
Image
(
ctx
context
.
Context
,
req
UploadImageReq
)
(
res
*
UploadImageRes
,
err
error
)
{
method
:=
"tt.upload.image"
req
.
FileContent
=
"base64"
var
request
=
g
.
Map
{}
request
[
"access_token"
],
err
=
server
.
GetAccessToken
(
ctx
)
if
err
!=
nil
{
return
}
result
,
err
:=
s
.
post
(
ctx
,
method
,
request
,
req
)
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
func
(
upload
)
post
(
ctx
context
.
Context
,
method
string
,
params
g
.
Map
,
req
UploadImageReq
)
(
str
string
,
err
error
)
{
Start
:=
gtime
.
TimestampMilli
()
err
=
sign
(
method
,
params
)
if
err
!=
nil
{
return
}
Url
:=
Host
+
method
+
"/"
+
server
.
AppKey
Request
:=
g
.
Client
()
Values
:=
url
.
Values
{}
for
k
,
v
:=
range
params
{
Values
.
Add
(
k
,
gconv
.
String
(
v
))
}
Request
.
SetHeader
(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
resp
,
err
:=
Request
.
Timeout
(
time
.
Second
*
5
)
.
Post
(
Url
+
"?"
+
Values
.
Encode
(),
req
)
defer
func
()
{
_
=
resp
.
Close
()
paramStr
:=
gjson
.
New
(
params
)
.
MustToJsonString
()
ctx
=
context
.
WithValue
(
ctx
,
"Method"
,
"POST"
)
ctx
=
context
.
WithValue
(
ctx
,
"URI"
,
Url
)
if
err
!=
nil
{
g
.
Log
()
.
Cat
(
PkgName
)
.
Ctx
(
ctx
)
.
Infof
(
"参数【%v】错误【%v】响应时间【%vms】"
,
paramStr
,
err
.
Error
(),
gtime
.
TimestampMilli
()
-
Start
)
}
else
{
g
.
Log
()
.
Cat
(
PkgName
)
.
Ctx
(
ctx
)
.
Infof
(
"参数【%v】响应【%v】响应时间【%vms】"
,
paramStr
,
str
,
gtime
.
TimestampMilli
()
-
Start
)
}
}()
str
=
resp
.
ReadAllString
()
return
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论