1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

fix: util.DecodeWithError result (#729)

This commit is contained in:
houseme
2023-10-06 23:55:11 -05:00
committed by GitHub
parent 9bfebc8a27
commit 8f10936479
3 changed files with 59 additions and 59 deletions

View File

@@ -180,7 +180,7 @@ type MediaInfo struct {
CreateTime int64 `json:"create_time"` // 上传时间,时间戳。
ExpireTime int64 `json:"expire_time"` // 过期时间,时间戳。
DramaID int64 `json:"drama_id"` // 所属剧目 id。
FileSize string `json:"file_size"` // 媒资文件大小,单位:字节。
FileSize int64 `json:"file_size"` // 媒资文件大小,单位:字节。
Duration int64 `json:"duration"` // 播放时长,单位:秒。
Name string `json:"name"` // 媒资文件名。
Description string `json:"description"` // 描述。

View File

@@ -27,7 +27,7 @@ import (
)
// SingleFileUpload 单文件上传
func (s *MiniDrama) SingleFileUpload(ctx context.Context, in *SingleFileUploadRequest) (out *SingleFileUploadResponse, err error) {
func (s *MiniDrama) SingleFileUpload(ctx context.Context, in *SingleFileUploadRequest) (out SingleFileUploadResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, singleFileUpload); err != nil {
return
@@ -76,12 +76,12 @@ func (s *MiniDrama) SingleFileUpload(ctx context.Context, in *SingleFileUploadRe
return
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "SingleFileUpload")
err = util.DecodeWithError(response, &out, "SingleFileUpload")
return
}
// PullUpload 拉取上传
func (s *MiniDrama) PullUpload(ctx context.Context, in *PullUploadRequest) (out *PullUploadResponse, err error) {
func (s *MiniDrama) PullUpload(ctx context.Context, in *PullUploadRequest) (out PullUploadResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, pullUpload); err != nil {
return
@@ -92,12 +92,12 @@ func (s *MiniDrama) PullUpload(ctx context.Context, in *PullUploadRequest) (out
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "PullUpload")
err = util.DecodeWithError(response, &out, "PullUpload")
return
}
// GetTask 查询任务状态
func (s *MiniDrama) GetTask(ctx context.Context, in *GetTaskRequest) (out *GetTaskResponse, err error) {
func (s *MiniDrama) GetTask(ctx context.Context, in *GetTaskRequest) (out GetTaskResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, getTask); err != nil {
return
@@ -109,12 +109,12 @@ func (s *MiniDrama) GetTask(ctx context.Context, in *GetTaskRequest) (out *GetTa
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetTask")
err = util.DecodeWithError(response, &out, "GetTask")
return
}
// ApplyUpload 申请分片上传
func (s *MiniDrama) ApplyUpload(ctx context.Context, in *ApplyUploadRequest) (out *ApplyUploadResponse, err error) {
func (s *MiniDrama) ApplyUpload(ctx context.Context, in *ApplyUploadRequest) (out ApplyUploadResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, applyUpload); err != nil {
return
@@ -126,13 +126,13 @@ func (s *MiniDrama) ApplyUpload(ctx context.Context, in *ApplyUploadRequest) (ou
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "ApplyUpload")
err = util.DecodeWithError(response, &out, "ApplyUpload")
return
}
// UploadPart 上传分片
// Content-Type 需要指定为 multipart/form-data; boundary=<delimiter><箭头括号>表示必须替换为有效值的变量。
func (s *MiniDrama) UploadPart(ctx context.Context, in *UploadPartRequest) (out *UploadPartResponse, err error) {
func (s *MiniDrama) UploadPart(ctx context.Context, in *UploadPartRequest) (out UploadPartResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, uploadPart); err != nil {
return
@@ -165,12 +165,12 @@ func (s *MiniDrama) UploadPart(ctx context.Context, in *UploadPartRequest) (out
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "UploadPart")
err = util.DecodeWithError(response, &out, "UploadPart")
return
}
// CommitUpload 确认上传
func (s *MiniDrama) CommitUpload(ctx context.Context, in *CommitUploadRequest) (out *CommitUploadResponse, err error) {
func (s *MiniDrama) CommitUpload(ctx context.Context, in *CommitUploadRequest) (out CommitUploadResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, commitUpload); err != nil {
return
@@ -182,12 +182,12 @@ func (s *MiniDrama) CommitUpload(ctx context.Context, in *CommitUploadRequest) (
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CommitUpload")
err = util.DecodeWithError(response, &out, "CommitUpload")
return
}
// ListMedia 获取媒体列表
func (s *MiniDrama) ListMedia(ctx context.Context, in *ListMediaRequest) (out *ListMediaResponse, err error) {
func (s *MiniDrama) ListMedia(ctx context.Context, in *ListMediaRequest) (out ListMediaResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, listMedia); err != nil {
return
@@ -199,12 +199,12 @@ func (s *MiniDrama) ListMedia(ctx context.Context, in *ListMediaRequest) (out *L
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "ListMedia")
err = util.DecodeWithError(response, &out, "ListMedia")
return
}
// GetMedia 获取媒资详细信息
func (s *MiniDrama) GetMedia(ctx context.Context, in *GetMediaRequest) (out *GetMediaResponse, err error) {
func (s *MiniDrama) GetMedia(ctx context.Context, in *GetMediaRequest) (out GetMediaResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, getMedia); err != nil {
return
@@ -216,12 +216,12 @@ func (s *MiniDrama) GetMedia(ctx context.Context, in *GetMediaRequest) (out *Get
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetMedia")
err = util.DecodeWithError(response, &out, "GetMedia")
return
}
// GetMediaLink 获取媒资播放链接
func (s *MiniDrama) GetMediaLink(ctx context.Context, in *GetMediaLinkRequest) (out *GetMediaLinkResponse, err error) {
func (s *MiniDrama) GetMediaLink(ctx context.Context, in *GetMediaLinkRequest) (out GetMediaLinkResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, getMediaLink); err != nil {
return
@@ -233,12 +233,12 @@ func (s *MiniDrama) GetMediaLink(ctx context.Context, in *GetMediaLinkRequest) (
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetMediaLink")
err = util.DecodeWithError(response, &out, "GetMediaLink")
return
}
// DeleteMedia 删除媒体
func (s *MiniDrama) DeleteMedia(ctx context.Context, in *DeleteMediaRequest) (out *DeleteMediaResponse, err error) {
func (s *MiniDrama) DeleteMedia(ctx context.Context, in *DeleteMediaRequest) (out DeleteMediaResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, deleteMedia); err != nil {
return
@@ -250,12 +250,12 @@ func (s *MiniDrama) DeleteMedia(ctx context.Context, in *DeleteMediaRequest) (ou
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "DeleteMedia")
err = util.DecodeWithError(response, &out, "DeleteMedia")
return
}
// AuditDrama 审核剧本
func (s *MiniDrama) AuditDrama(ctx context.Context, in *AuditDramaRequest) (out *AuditDramaResponse, err error) {
func (s *MiniDrama) AuditDrama(ctx context.Context, in *AuditDramaRequest) (out AuditDramaResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, auditDrama); err != nil {
return
@@ -267,12 +267,12 @@ func (s *MiniDrama) AuditDrama(ctx context.Context, in *AuditDramaRequest) (out
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "AuditDrama")
err = util.DecodeWithError(response, &out, "AuditDrama")
return
}
// ListDramas 获取剧目列表
func (s *MiniDrama) ListDramas(ctx context.Context, in *ListDramasRequest) (out *ListDramasResponse, err error) {
func (s *MiniDrama) ListDramas(ctx context.Context, in *ListDramasRequest) (out ListDramasResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, listDramas); err != nil {
return
@@ -284,12 +284,12 @@ func (s *MiniDrama) ListDramas(ctx context.Context, in *ListDramasRequest) (out
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "ListDramas")
err = util.DecodeWithError(response, &out, "ListDramas")
return
}
// GetDrama 获取剧目信息
func (s *MiniDrama) GetDrama(ctx context.Context, in *GetDramaRequest) (out *GetDramaResponse, err error) {
func (s *MiniDrama) GetDrama(ctx context.Context, in *GetDramaRequest) (out GetDramaResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, getDrama); err != nil {
return
@@ -300,12 +300,12 @@ func (s *MiniDrama) GetDrama(ctx context.Context, in *GetDramaRequest) (out *Get
return
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetDrama")
err = util.DecodeWithError(response, &out, "GetDrama")
return
}
// GetCdnUsageData 查询 CDN 用量数据
func (s *MiniDrama) GetCdnUsageData(ctx context.Context, in *GetCdnUsageDataRequest) (out *GetCdnUsageDataResponse, err error) {
func (s *MiniDrama) GetCdnUsageData(ctx context.Context, in *GetCdnUsageDataRequest) (out GetCdnUsageDataResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, getCdnUsageData); err != nil {
return
@@ -316,12 +316,12 @@ func (s *MiniDrama) GetCdnUsageData(ctx context.Context, in *GetCdnUsageDataRequ
return
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetCdnUsageData")
err = util.DecodeWithError(response, &out, "GetCdnUsageData")
return
}
// GetCdnLogs 查询 CDN 日志
func (s *MiniDrama) GetCdnLogs(ctx context.Context, in *GetCdnLogsRequest) (out *GetCdnLogsResponse, err error) {
func (s *MiniDrama) GetCdnLogs(ctx context.Context, in *GetCdnLogsRequest) (out GetCdnLogsResponse, err error) {
var address string
if address, err = s.requestAddress(ctx, getCdnLogs); err != nil {
return
@@ -332,7 +332,7 @@ func (s *MiniDrama) GetCdnLogs(ctx context.Context, in *GetCdnLogsRequest) (out
return
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "GetCdnLogs")
err = util.DecodeWithError(response, &out, "GetCdnLogs")
return
}

View File

@@ -37,7 +37,7 @@ func (s *VirtualPayment) SetSessionKey(sessionKey string) {
}
// QueryUserBalance 查询虚拟支付余额
func (s *VirtualPayment) QueryUserBalance(ctx context.Context, in *QueryUserBalanceRequest) (out *QueryUserBalanceResponse, err error) {
func (s *VirtualPayment) QueryUserBalance(ctx context.Context, in *QueryUserBalanceRequest) (out QueryUserBalanceResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -60,12 +60,12 @@ func (s *VirtualPayment) QueryUserBalance(ctx context.Context, in *QueryUserBala
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryUserBalance")
err = util.DecodeWithError(response, &out, "QueryUserBalance")
return
}
// CurrencyPay currency pay 扣减代币(一般用于代币支付)
func (s *VirtualPayment) CurrencyPay(ctx context.Context, in *CurrencyPayRequest) (out *CurrencyPayResponse, err error) {
func (s *VirtualPayment) CurrencyPay(ctx context.Context, in *CurrencyPayRequest) (out CurrencyPayResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -88,12 +88,12 @@ func (s *VirtualPayment) CurrencyPay(ctx context.Context, in *CurrencyPayRequest
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CurrencyPay")
err = util.DecodeWithError(response, &out, "CurrencyPay")
return
}
// QueryOrder 查询创建的订单(现金单,非代币单)
func (s *VirtualPayment) QueryOrder(ctx context.Context, in *QueryOrderRequest) (out *QueryOrderResponse, err error) {
func (s *VirtualPayment) QueryOrder(ctx context.Context, in *QueryOrderRequest) (out QueryOrderResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -116,12 +116,12 @@ func (s *VirtualPayment) QueryOrder(ctx context.Context, in *QueryOrderRequest)
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryOrder")
err = util.DecodeWithError(response, &out, "QueryOrder")
return
}
// CancelCurrencyPay 取消订单 代币支付退款 (currency_pay 接口的逆操作)
func (s *VirtualPayment) CancelCurrencyPay(ctx context.Context, in *CancelCurrencyPayRequest) (out *CancelCurrencyPayResponse, err error) {
func (s *VirtualPayment) CancelCurrencyPay(ctx context.Context, in *CancelCurrencyPayRequest) (out CancelCurrencyPayResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -144,13 +144,13 @@ func (s *VirtualPayment) CancelCurrencyPay(ctx context.Context, in *CancelCurren
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CancelCurrencyPay")
err = util.DecodeWithError(response, &out, "CancelCurrencyPay")
return
}
// NotifyProvideGoods 通知发货
// 通知已经发货完成(只能通知现金单),正常通过 xpay_goods_deliver_notify 消息推送返回成功就不需要调用这个 api 接口。这个接口用于异常情况推送不成功时手动将单改成已发货状态
func (s *VirtualPayment) NotifyProvideGoods(ctx context.Context, in *NotifyProvideGoodsRequest) (out *NotifyProvideGoodsResponse, err error) {
func (s *VirtualPayment) NotifyProvideGoods(ctx context.Context, in *NotifyProvideGoodsRequest) (out NotifyProvideGoodsResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -174,12 +174,12 @@ func (s *VirtualPayment) NotifyProvideGoods(ctx context.Context, in *NotifyProvi
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "NotifyProvideGoods")
err = util.DecodeWithError(response, &out, "NotifyProvideGoods")
return
}
// PresentCurrency 代币赠送接口,由于目前不支付按单号查赠送单的功能,所以当需要赠送的时候可以一直重试到返回 0 或者返回 268490004重复操作为止
func (s *VirtualPayment) PresentCurrency(ctx context.Context, in *PresentCurrencyRequest) (out *PresentCurrencyResponse, err error) {
func (s *VirtualPayment) PresentCurrency(ctx context.Context, in *PresentCurrencyRequest) (out PresentCurrencyResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -203,12 +203,12 @@ func (s *VirtualPayment) PresentCurrency(ctx context.Context, in *PresentCurrenc
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "PresentCurrency")
err = util.DecodeWithError(response, &out, "PresentCurrency")
return
}
// DownloadBill 下载订单交易账单
func (s *VirtualPayment) DownloadBill(ctx context.Context, in *DownloadBillRequest) (out *DownloadBillResponse, err error) {
func (s *VirtualPayment) DownloadBill(ctx context.Context, in *DownloadBillRequest) (out DownloadBillResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -232,12 +232,12 @@ func (s *VirtualPayment) DownloadBill(ctx context.Context, in *DownloadBillReque
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "DownloadBill")
err = util.DecodeWithError(response, &out, "DownloadBill")
return
}
// RefundOrder 退款 对使用 jsapi 接口下的单进行退款
func (s *VirtualPayment) RefundOrder(ctx context.Context, in *RefundOrderRequest) (out *RefundOrderResponse, err error) {
func (s *VirtualPayment) RefundOrder(ctx context.Context, in *RefundOrderRequest) (out RefundOrderResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -261,12 +261,12 @@ func (s *VirtualPayment) RefundOrder(ctx context.Context, in *RefundOrderRequest
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "RefundOrder")
err = util.DecodeWithError(response, &out, "RefundOrder")
return
}
// CreateWithdrawOrder 创建提现单
func (s *VirtualPayment) CreateWithdrawOrder(ctx context.Context, in *CreateWithdrawOrderRequest) (out *CreateWithdrawOrderResponse, err error) {
func (s *VirtualPayment) CreateWithdrawOrder(ctx context.Context, in *CreateWithdrawOrderRequest) (out CreateWithdrawOrderResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -290,12 +290,12 @@ func (s *VirtualPayment) CreateWithdrawOrder(ctx context.Context, in *CreateWith
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "CreateWithdrawOrder")
err = util.DecodeWithError(response, &out, "CreateWithdrawOrder")
return
}
// QueryWithdrawOrder 查询提现单
func (s *VirtualPayment) QueryWithdrawOrder(ctx context.Context, in *QueryWithdrawOrderRequest) (out *QueryWithdrawOrderResponse, err error) {
func (s *VirtualPayment) QueryWithdrawOrder(ctx context.Context, in *QueryWithdrawOrderRequest) (out QueryWithdrawOrderResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -319,12 +319,12 @@ func (s *VirtualPayment) QueryWithdrawOrder(ctx context.Context, in *QueryWithdr
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryWithdrawOrder")
err = util.DecodeWithError(response, &out, "QueryWithdrawOrder")
return
}
// StartUploadGoods 开始上传商品
func (s *VirtualPayment) StartUploadGoods(ctx context.Context, in *StartUploadGoodsRequest) (out *StartUploadGoodsResponse, err error) {
func (s *VirtualPayment) StartUploadGoods(ctx context.Context, in *StartUploadGoodsRequest) (out StartUploadGoodsResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -348,12 +348,12 @@ func (s *VirtualPayment) StartUploadGoods(ctx context.Context, in *StartUploadGo
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "StartUploadGoods")
err = util.DecodeWithError(response, &out, "StartUploadGoods")
return
}
// QueryUploadGoods 查询上传商品
func (s *VirtualPayment) QueryUploadGoods(ctx context.Context, in *QueryUploadGoodsRequest) (out *QueryUploadGoodsResponse, err error) {
func (s *VirtualPayment) QueryUploadGoods(ctx context.Context, in *QueryUploadGoodsRequest) (out QueryUploadGoodsResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -377,12 +377,12 @@ func (s *VirtualPayment) QueryUploadGoods(ctx context.Context, in *QueryUploadGo
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryUploadGoods")
err = util.DecodeWithError(response, &out, "QueryUploadGoods")
return
}
// StartPublishGoods 开始发布商品
func (s *VirtualPayment) StartPublishGoods(ctx context.Context, in *StartPublishGoodsRequest) (out *StartPublishGoodsResponse, err error) {
func (s *VirtualPayment) StartPublishGoods(ctx context.Context, in *StartPublishGoodsRequest) (out StartPublishGoodsResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -406,12 +406,12 @@ func (s *VirtualPayment) StartPublishGoods(ctx context.Context, in *StartPublish
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "StartPublishGoods")
err = util.DecodeWithError(response, &out, "StartPublishGoods")
return
}
// QueryPublishGoods 查询发布商品
func (s *VirtualPayment) QueryPublishGoods(ctx context.Context, in *QueryPublishGoodsRequest) (out *QueryPublishGoodsResponse, err error) {
func (s *VirtualPayment) QueryPublishGoods(ctx context.Context, in *QueryPublishGoodsRequest) (out QueryPublishGoodsResponse, err error) {
var jsonByte []byte
if jsonByte, err = json.Marshal(in); err != nil {
return
@@ -435,7 +435,7 @@ func (s *VirtualPayment) QueryPublishGoods(ctx context.Context, in *QueryPublish
}
// 使用通用方法返回错误
err = util.DecodeWithError(response, out, "QueryPublishGoods")
err = util.DecodeWithError(response, &out, "QueryPublishGoods")
return
}