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

@@ -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"` // 收件人地址