Merge branch 'master' of e.coding.net:rosydev/baseapi

This commit is contained in:
邹宗楠
2022-08-08 09:17:35 +08:00
5 changed files with 50 additions and 5 deletions

View File

@@ -560,13 +560,38 @@ func (a *API) OrderDisagreeRefund(orderID, refuseReason string) (err error) {
}
func (a *API) OrderPartRefund(orderID string, removeSkuList []*RefundSku) (err error) {
_, err = a.AccessAPI("order.partrefund", map[string]interface{}{
_, err = a.AccessAPI("order.manyTimesPartrefund", map[string]interface{}{
"order_id": orderID,
"products": removeSkuList,
})
return err
}
//售后 同意用户多次部分取消
func (a *API) OrderAgreePartRefund(orderID string) (err error) {
_, err = a.AccessAPI("order.agreepartrefund", map[string]interface{}{
"order_id": orderID,
})
return err
}
//售后 同意退货退款
func (a *API) OrderAgreeReturnGoods(orderID string) (err error) {
_, err = a.AccessAPI("order.agreereturngoods", map[string]interface{}{
"order_id": orderID,
})
return err
}
//售后 拒绝退货退款
func (a *API) OrderDisagreeReturnGoods(orderID string, reason string) (err error) {
_, err = a.AccessAPI("order.disagreereturngoods", map[string]interface{}{
"order_id": orderID,
"reason": reason,
})
return err
}
func (a *API) OrderCheckout(orderID, pickUpCode string) (err error) {
_, err = a.AccessAPI("order.checkout", map[string]interface{}{
"order_id": orderID,

View File

@@ -39,6 +39,8 @@ func (a *Api) SetExpirationTime(expiration int64) {
// NewQBiDa 初始化token
func NewQBiDa(account, password string, config ...*platformapi.APIConfig) *Api {
//account = "18048531223"
//password = "18080188338"
if account == "" || password == "" {
account = "18048531223"
password = "18080188338"

View File

@@ -3,6 +3,7 @@ package q_bida
import (
"errors"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"net/http"
"strings"
"time"
@@ -41,10 +42,15 @@ func (a *Api) GetToken() error {
// GetExpressPrice 获取快递费用
func (a *Api) GetExpressPrice(param *GetExpressPriceReq) (*GetExpressPriceRes, error) {
globals.SugarLogger.Debug("进入GetExpressPrice")
if err := a.CheckTokenExpiration(); err != nil {
globals.SugarLogger.Debug("打印err1===================", err)
return nil, err
}
result, err := a.AccessInfo(BaseQBiDaUrl, GetWayBailMoneyUrl, http.MethodPost, utils.Struct2FlatMap(param))
globals.SugarLogger.Debug("打印result===================", result)
globals.SugarLogger.Debug("打印err2===================", err)
if err != nil && !strings.Contains(err.Error(), "成功") {
return nil, err
}
@@ -56,6 +62,7 @@ func (a *Api) GetExpressPrice(param *GetExpressPriceReq) (*GetExpressPriceRes, e
if resultData.Code != 0 {
return nil, errors.New(resultData.Msg)
}
globals.SugarLogger.Debug("返回前打印resultData===================", resultData)
return resultData, nil
}
@@ -85,11 +92,15 @@ func (a *Api) CancelOrder(param *CancelOrderReq) error {
}
result, err := a.AccessInfo(BaseQBiDaUrl, CancelWayBailOrderUrl, http.MethodPost, utils.Struct2FlatMap(param))
globals.SugarLogger.Debug("err= =====ded==================", err)
if err != nil && !strings.Contains(err.Error(), "成功") {
return err
err = nil //TODO 测试部分,记得删除
//return err
}
resultData := &PublicParams{}
globals.SugarLogger.Debug("resultData===================", resultData.Code, resultData.Msg)
if err := utils.Map2StructByJson(result, resultData, false); err != nil {
return err
}

View File

@@ -151,8 +151,8 @@ type OrderDetail struct {
InsuranceFee float64 `json:"insuranceFee"` // 保价费元
IsForward bool `json:"isForward"` // 是否转寄单0否1是(转寄单额外收取50%运费)
IsLimit bool `json:"isLimit"` // 是否超限0否1是
OriginalFee int `json:"originalFee"` // 官方原价
OtherFee int `json:"otherFee"` // 其他费用
OriginalFee float64 `json:"originalFee"` // 官方原价
OtherFee float64 `json:"otherFee"` // 其他费用
OverWeightStatus int `json:"overWeightStatus"` // 超重状态
PackageNum int `json:"packageNum"` // 包裹数
ReceiveAddress string `json:"receiveAddress"` // 收件人地址

View File

@@ -3,6 +3,7 @@ package tonglianpayapi
import (
"crypto/md5"
"fmt"
"git.rosy.net.cn/jx-callback/globals"
"net/http"
"sort"
"strings"
@@ -204,13 +205,19 @@ func (a *API) PayRefund(param *PayRefundParam) (result *PayRefundResult, err err
params := make(map[string]interface{})
params["trxamt"] = param.Trxamt
params["reqsn"] = param.Reqsn
// params["oldreqsn"] = param.OldReqsn
//params["oldreqsn"] = param.OldReqsn
params["remark"] = param.Remark
params["oldtrxid"] = param.OldTrxID
retVal, err := a.AccessAPI("unitorder/refund", params)
globals.SugarLogger.Debug("PayRefund打印输出 err", err)
globals.SugarLogger.Debug("PayRefund打印输出 trxamt", params["trxamt"])
globals.SugarLogger.Debug("PayRefund打印输出 oldtrxid", params["oldtrxid"]) //nil
globals.SugarLogger.Debug("PayRefund打印输出 oldreqsn", params["oldreqsn"])
if err == nil {
utils.Map2StructByJson(retVal, &result, false)
}
globals.SugarLogger.Debug("PayRefund打印输出 result", result)
return result, err
}