1
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -15,8 +14,6 @@ func (a *API) PreCreateOrder(preOrder *PreCreateOrderReq) (price float64, err er
|
||||
preOrder.PushTime = time.Now().Unix()
|
||||
preOrder.DevId = a.devId
|
||||
resp := a.HttpPostJson("precreateorder", preOrder)
|
||||
globals.SugarLogger.Debugf("sfps PreCreateOrder:preOrder=%s", utils.Format4Output(preOrder, false))
|
||||
globals.SugarLogger.Debugf("sfps PreCreateOrder:resp=%s", utils.Format4Output(resp, false))
|
||||
if resp.HttpStatusCode != HttpStatusSuccessCode {
|
||||
return 0, errors.New("HTTP请求错误,请检查重试")
|
||||
}
|
||||
@@ -41,9 +38,7 @@ func (a *API) CreateOrder(order *CreateOrderReq) (sfOrderID, sfBillID string, to
|
||||
order.PushTime = time.Now().Unix()
|
||||
order.Version = DefaultVersion
|
||||
order.DevId = a.devId
|
||||
globals.SugarLogger.Debugf("sfps CreateOrder req=%s", utils.Format4Output(order, false))
|
||||
resp := a.HttpPostJson("createorder", order)
|
||||
globals.SugarLogger.Debugf("sfps CreateOrder:resp=%s", utils.Format4Output(resp, false))
|
||||
if resp.HttpStatusCode != HttpStatusSuccessCode {
|
||||
return "", "", 0, 0, errors.New("HTTP请求错误,请检查重试")
|
||||
}
|
||||
@@ -53,7 +48,6 @@ func (a *API) CreateOrder(order *CreateOrderReq) (sfOrderID, sfBillID string, to
|
||||
retVal := CreateOrderResp{}
|
||||
s, _ := json.Marshal(resp.BaseRetVal.Result)
|
||||
if err = json.Unmarshal(s, &retVal); err == nil {
|
||||
globals.SugarLogger.Debugf("CreateOrder resp=%s", utils.Format4Output(retVal, false))
|
||||
return retVal.SFOrderID, retVal.SFBillID, retVal.TotalPrice, retVal.RealPayMoney, nil
|
||||
} else {
|
||||
return "", "", 0, 0, err
|
||||
@@ -68,8 +62,6 @@ func (a *API) PreCancelOrder(sfOrderID string) (deductionFee float64, err error)
|
||||
PushTime: time.Now().Unix(),
|
||||
}
|
||||
resp := a.HttpPostJson("precancelorder", param)
|
||||
globals.SugarLogger.Debugf("sfps precancelorder:param=%s", utils.Format4Output(param, false))
|
||||
globals.SugarLogger.Debugf("sfps precancelorder:resp=%s", utils.Format4Output(resp, false))
|
||||
if resp.HttpStatusCode != HttpStatusSuccessCode {
|
||||
return 0, errors.New("HTTP请求错误,请检查重试")
|
||||
}
|
||||
@@ -79,7 +71,6 @@ func (a *API) PreCancelOrder(sfOrderID string) (deductionFee float64, err error)
|
||||
retVal := PreCancelOrderResp{}
|
||||
s, _ := json.Marshal(resp.BaseRetVal.Result)
|
||||
if err = json.Unmarshal(s, &retVal); err == nil {
|
||||
globals.SugarLogger.Debugf("PreCancelOrder resp=%s", utils.Format4Output(retVal, false))
|
||||
return retVal.DeductionFee, nil
|
||||
} else {
|
||||
return 0, err
|
||||
@@ -122,7 +113,6 @@ func (a *API) GetOrderStatus(sfOrderID string) (retVal *GetOrderStatusResp, err
|
||||
s, _ := json.Marshal(resp.BaseRetVal.Result)
|
||||
if err = json.Unmarshal(s, &retVal); err == nil {
|
||||
retVal.TotalPrice += utils.Int2Float64(utils.WayBillDeliveryMarkUp)
|
||||
globals.SugarLogger.Debugf("GetOrderStatus resp=%s", utils.Format4Output(retVal, false))
|
||||
return retVal, nil
|
||||
} else {
|
||||
return nil, err
|
||||
@@ -146,7 +136,6 @@ func (a *API) GetRiderLatestPosition(sfOrderID string) (retVal *RiderLatestPosit
|
||||
}
|
||||
s, _ := json.Marshal(resp.BaseRetVal.Result)
|
||||
if err = json.Unmarshal(s, &retVal); err == nil {
|
||||
globals.SugarLogger.Debugf("GetRiderLatestPosition resp=%s", utils.Format4Output(retVal, false))
|
||||
return retVal, nil
|
||||
} else {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user