Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
L
library
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
stbz
library
Commits
5fae905c
提交
5fae905c
authored
4月 01, 2024
作者:
张立波
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
云众
上级
255d9542
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
242 行增加
和
9 行删除
+242
-9
yunzmall.go
upstream/yunzmall/yunzmall.go
+41
-0
yunzmall_logistics.go
upstream/yunzmall/yunzmall_logistics.go
+67
-0
yunzmall_order.go
upstream/yunzmall/yunzmall_order.go
+3
-2
yunzmall_refund.go
upstream/yunzmall/yunzmall_refund.go
+131
-7
没有找到文件。
upstream/yunzmall/yunzmall.go
浏览文件 @
5fae905c
...
...
@@ -61,6 +61,47 @@ func post(ctx context.Context, method string, params g.Map, xToken ...interface{
resp
,
err
:=
Request
.
Timeout
(
time
.
Second
*
5
)
.
Post
(
Url
+
method
,
params
)
defer
func
()
{
_
=
resp
.
Close
()
paramStr
:=
gjson
.
New
(
params
)
.
MustToJsonString
()
ctx
=
context
.
WithValue
(
ctx
,
"Method"
,
"POST"
)
ctx
=
context
.
WithValue
(
ctx
,
"URI"
,
method
)
if
err
!=
nil
{
g
.
Log
()
.
Ctx
(
ctx
)
.
Cat
(
pkgName
)
.
Cat
(
"error"
)
.
Infof
(
"参数【%v】错误【%v】响应时间【%v ms】"
,
paramStr
,
err
.
Error
(),
gtime
.
TimestampMilli
()
-
Start
)
}
else
{
g
.
Log
()
.
Ctx
(
ctx
)
.
Cat
(
pkgName
)
.
Infof
(
"参数【%v】响应【%v】响应时间【%v ms】"
,
paramStr
,
str
,
gtime
.
TimestampMilli
()
-
Start
)
}
}()
if
err
!=
nil
{
return
}
str
=
resp
.
ReadAllString
()
return
}
func
get
(
ctx
context
.
Context
,
method
string
,
params
g
.
Map
,
xToken
...
interface
{})
(
str
string
,
err
error
)
{
Start
:=
gtime
.
TimestampMilli
()
Request
:=
g
.
Client
()
.
ContentJson
()
var
AppNonce
=
grand
.
S
(
16
)
var
AppTimestamp
=
gtime
.
TimestampStr
()
Request
.
SetHeader
(
"App-Nonce-Str"
,
grand
.
S
(
16
))
Request
.
SetHeader
(
"App-Timestamp"
,
gtime
.
TimestampStr
())
if
len
(
xToken
)
==
0
{
var
token
string
token
,
err
=
Token
.
Access
(
ctx
)
if
err
!=
nil
{
return
}
Request
.
SetHeader
(
"x-token"
,
token
)
}
AppSign
,
err
:=
sign
(
AppNonce
,
AppTimestamp
,
params
)
if
err
!=
nil
{
return
}
Request
.
SetHeader
(
"App-Sign"
,
AppSign
)
resp
,
err
:=
Request
.
Timeout
(
time
.
Second
*
5
)
.
Get
(
Url
+
method
,
params
)
//resp.RawDump()
defer
func
()
{
_
=
resp
.
Close
()
...
...
upstream/yunzmall/yunzmall_logistics.go
0 → 100644
浏览文件 @
5fae905c
package
yunzmall
import
(
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
type
logisticsLogic
struct
{
}
var
Logistics
=
logisticsLogic
{}
type
LogisticsCompanyRes
struct
{
CommonRes
Data
struct
{
List
[]
struct
{
Code
string
`json:"code"`
Name
string
`json:"name"`
}
`json:"list"`
}
`json:"data"`
}
// Company 快递公司
func
(
s
logisticsLogic
)
Company
(
ctx
context
.
Context
)
(
res
*
LogisticsCompanyRes
,
err
error
)
{
var
method
=
"/app/order/cloud/company/list"
result
,
err
:=
get
(
ctx
,
method
,
g
.
Map
{})
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
type
LogisticsTraceRes
struct
{
CommonRes
Data
[]
struct
{
Id
int
`json:"id"`
ExpressNo
string
`json:"express_no"`
CompanyCode
string
`json:"company_code"`
CompanyName
string
`json:"company_name"`
CreatedAt
int
`json:"created_at"`
OrderItems
[]
struct
{
Id
int
`json:"id"`
ImageUrl
string
`json:"image_url"`
ProductId
int
`json:"product_id"`
Title
string
`json:"title"`
SkuTitle
string
`json:"sku_title"`
SkuId
int
`json:"sku_id"`
Qty
int
`json:"qty"`
SendNum
int
`json:"send_num"`
}
`json:"order_items"`
}
`json:"data"`
}
//Delivery 获取物流信息
func
(
s
logisticsLogic
)
Delivery
(
ctx
context
.
Context
,
req
string
)
(
res
*
LogisticsTraceRes
,
err
error
)
{
var
method
=
"/app/order/Logistic"
result
,
err
:=
post
(
ctx
,
method
,
g
.
Map
{
"order_sn"
:
req
,
})
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
upstream/yunzmall/yunzmall_order.go
浏览文件 @
5fae905c
...
...
@@ -473,7 +473,7 @@ type OrderDetailRes struct {
CreatedAt
int
`json:"created_at"`
UpdatedAt
int
`json:"updated_at"`
OrderSn
int64
`json:"order_sn"`
Status
int
`json:"status"`
Status
int
`json:"status"`
//0待支付 1待发货 2待收货 3已完成,-1已关闭 5退换货 6已退款
StatusName
string
`json:"status_name"`
Title
string
`json:"title"`
Freight
int
`json:"freight"`
...
...
@@ -574,9 +574,10 @@ type OrderDetailRes struct {
}
`json:"data"`
}
// Detail 订单详情
func
(
s
orderLogic
)
Detail
(
ctx
context
.
Context
,
req
string
)
(
res
*
OrderDetailRes
,
err
error
)
{
var
method
=
"/app/order/orderDetail"
result
,
err
:=
pos
t
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
ge
t
(
ctx
,
method
,
g
.
Map
{
"order_sn"
:
req
,
})
if
err
!=
nil
{
...
...
upstream/yunzmall/yunzmall_refund.go
浏览文件 @
5fae905c
...
...
@@ -19,7 +19,7 @@ type RefundBeforeRes struct {
func
(
s
refundLogic
)
Before
(
ctx
context
.
Context
,
req
string
)
(
res
*
RefundBeforeRes
,
err
error
)
{
var
method
=
"/app/afterSales/getAfterSalesTypeNameMap"
result
,
err
:=
pos
t
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
ge
t
(
ctx
,
method
,
g
.
Map
{
"order_item_id"
:
req
,
})
if
err
!=
nil
{
...
...
@@ -30,6 +30,103 @@ func (s refundLogic) Before(ctx context.Context, req string) (res *RefundBeforeR
}
type
RefundDetailRes
struct
{
CommonRes
Data
struct
{
AfterSales
struct
{
Id
int
`json:"id"`
CreatedAt
int
`json:"created_at"`
UpdatedAt
int
`json:"updated_at"`
AfterSaleSn
string
`json:"after_sale_sn"`
UserId
int
`json:"user_id"`
Amount
int
`json:"amount"`
PracticalAmount
int
`json:"practical_amount"`
ReasonType
int
`json:"reason_type"`
Reason
string
`json:"reason"`
Description
string
`json:"description"`
OrderId
int
`json:"order_id"`
OrderItemId
int
`json:"order_item_id"`
SkuId
int
`json:"sku_id"`
ProductId
int
`json:"product_id"`
ShippingAddressId
int
`json:"shipping_address_id"`
IsReceived
int
`json:"is_received"`
PayMethod
int
`json:"pay_method"`
ReturnOrderExpressId
int
`json:"return_order_express_id"`
Status
int
`json:"status"`
Type
int
`json:"type"`
DetailImages
interface
{}
`json:"detail_images"`
Logs
[]
struct
{
CreatedAt
string
`json:"created_at"`
AdminId
int
`json:"admin_id"`
Content
string
`json:"content"`
Price
int
`json:"price"`
RefundTypeName
string
`json:"refund_type_name"`
ReasonTypeName
string
`json:"reason_type_name"`
Description
string
`json:"description"`
}
`json:"logs"`
User
struct
{
Id
int
`json:"id"`
Avatar
string
`json:"avatar"`
Username
string
`json:"username"`
Nickname
string
`json:"nickname"`
}
`json:"user"`
RefundReasonName
string
`json:"refund_reason_name"`
SuccessAt
interface
{}
`json:"success_at"`
StatusName
string
`json:"status_name"`
Order
struct
{
Id
int
`json:"id"`
OrderSn
int64
`json:"order_sn"`
ApplicationId
int
`json:"application_id"`
}
`json:"order"`
OrderItem
struct
{
Id
int
`json:"id"`
SkuTitle
string
`json:"sku_title"`
Title
string
`json:"title"`
ProductId
int
`json:"product_id"`
OrderId
int
`json:"order_id"`
ImageUrl
string
`json:"image_url"`
SendStatus
int
`json:"send_status"`
Amount
int
`json:"amount"`
}
`json:"order_item"`
AfterSalesAudit
struct
{
Id
int
`json:"id"`
CreatedAt
int
`json:"created_at"`
UpdatedAt
int
`json:"updated_at"`
AfterSalesId
int
`json:"after_sales_id"`
AdminId
int
`json:"admin_id"`
ReasonType
int
`json:"reason_type"`
Reason
string
`json:"reason"`
Status
int
`json:"status"`
Cause
string
`json:"cause"`
StatusName
string
`json:"status_name"`
RefundName
string
`json:"refund_name"`
}
`json:"after_sales_audit"`
ReturnOrderExpress
struct
{
Id
int
`json:"id"`
CreatedAt
interface
{}
`json:"created_at"`
UpdatedAt
interface
{}
`json:"updated_at"`
AfterSalesId
int
`json:"after_sales_id"`
CompanyName
string
`json:"company_name"`
CompanyCode
string
`json:"company_code"`
ExpressNo
string
`json:"express_no"`
}
`json:"return_order_express"`
}
`json:"after_sales"`
}
`json:"data"`
}
// Detail 详情
func
(
s
refundLogic
)
Detail
(
ctx
context
.
Context
,
req
interface
{})
(
res
*
RefundDetailRes
,
err
error
)
{
var
method
=
"/app/afterSales/get"
result
,
err
:=
get
(
ctx
,
method
,
g
.
Map
{
"id"
:
gconv
.
Int
(
req
),
})
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
type
RefundAddressRes
struct
{
CommonRes
Data
struct
{
Id
int
`json:"id"`
...
...
@@ -70,11 +167,11 @@ type RefundDetailRes struct {
}
`json:"data"`
}
//
Detail 详情
func
(
s
refundLogic
)
Detail
(
ctx
context
.
Context
,
req
string
)
(
res
*
RefundDetail
Res
,
err
error
)
{
//
Address 退货地址
func
(
s
refundLogic
)
Address
(
ctx
context
.
Context
,
req
interface
{})
(
res
*
RefundAddress
Res
,
err
error
)
{
var
method
=
"/app/supplier/findShopAddressByOrderId"
result
,
err
:=
pos
t
(
ctx
,
method
,
g
.
Map
{
"after_sales_id"
:
req
,
result
,
err
:=
ge
t
(
ctx
,
method
,
g
.
Map
{
"after_sales_id"
:
gconv
.
Int
(
req
)
,
})
if
err
!=
nil
{
return
...
...
@@ -83,10 +180,18 @@ func (s refundLogic) Detail(ctx context.Context, req string) (res *RefundDetailR
return
}
type
RefundReasonRes
struct
{
Code
int
`json:"code"`
Data
struct
{
Reasons
map
[
string
]
string
`json:"reasons"`
}
`json:"data"`
Msg
string
`json:"msg"`
}
// Reason 售后原因
func
(
s
refundLogic
)
Reason
(
ctx
context
.
Context
,
afterSaleType
,
isReceived
int
)
(
res
*
Refund
Detail
Res
,
err
error
)
{
func
(
s
refundLogic
)
Reason
(
ctx
context
.
Context
,
afterSaleType
,
isReceived
int
)
(
res
*
Refund
Reason
Res
,
err
error
)
{
var
method
=
"/app/afterSales/reason/list"
result
,
err
:=
pos
t
(
ctx
,
method
,
g
.
Map
{
result
,
err
:=
ge
t
(
ctx
,
method
,
g
.
Map
{
"after_sale_type"
:
afterSaleType
,
"is_received"
:
isReceived
,
})
...
...
@@ -128,3 +233,22 @@ func (s refundLogic) Create(ctx context.Context, req RefundCreateReq) (res *Refu
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
type
RefundSendReq
struct
{
AfterSalesID
int
`json:"after_sales_id"`
//售后id
CompanyName
string
`json:"company_name"`
//物流公司名称
CompanyCode
string
`json:"company_code"`
//物流公司code
ExpressNo
string
`json:"express_no"`
//物流单号
ShippingAddressID
int
`json:"shipping_address_id"`
//售后商家收货地址 通过售后id获取默认商家售后退货地址 获得
}
// Send 售后发货
func
(
s
refundLogic
)
Send
(
ctx
context
.
Context
,
req
RefundSendReq
)
(
res
*
CommonRes
,
err
error
)
{
var
method
=
"app/afterSales/send"
result
,
err
:=
post
(
ctx
,
method
,
gconv
.
Map
(
req
))
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论