This commit is contained in:
邹宗楠
2024-12-13 17:00:58 +08:00
parent 77e30e583b
commit 5fa49d0b98
7 changed files with 38 additions and 17 deletions

View File

@@ -17,6 +17,9 @@ func (a *API) PreCreateOrder(preOrder *PreCreateOrderReq) (price float64, err er
//preOrder.ShopId = SFShopTestOpenStoreID // 测试用
resp := a.HttpPostJson("precreateorder", preOrder)
if resp == nil {
return 0, fmt.Errorf("PreCreateOrder请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return 0, errors.New("HTTP请求错误请检查重试")
}
@@ -39,6 +42,9 @@ func (a *API) CreateOrder(order *CreateOrderReq) (sfOrderID, sfBillID string, to
//order.ShopId = SFShopTestOpenStoreID // 测试用
resp := a.HttpPostJson("createorder", order)
if resp == nil {
return "", "", 0, 0, fmt.Errorf("CreateOrder请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return "", "", 0, 0, errors.New("HTTP请求错误请检查重试")
}
@@ -62,6 +68,9 @@ func (a *API) PreCancelOrder(sfOrderID string) (deductionFee float64, err error)
PushTime: time.Now().Unix(),
}
resp := a.HttpPostJson("precancelorder", param)
if resp == nil {
return 0, fmt.Errorf("PreCancelOrder请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return 0, errors.New("HTTP请求错误请检查重试")
}
@@ -86,6 +95,9 @@ func (a *API) CancelOrder(sfOrderID string) (err error) {
CancelCode: CancelCodeChangePlan,
}
resp := a.HttpPostJson("cancelorder", param)
if resp == nil {
return fmt.Errorf("CancelOrder请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return errors.New("HTTP请求错误请检查重试")
}
@@ -104,6 +116,9 @@ func (a *API) GetOrderStatus(sfOrderID string) (retVal *GetOrderStatusResp, err
//OrderType: orderType,
}
resp := a.HttpPostJson("getorderstatus", param)
if resp == nil {
return nil, fmt.Errorf("GetOrderStatus请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return nil, errors.New("HTTP请求错误请检查重试")
}
@@ -128,6 +143,9 @@ func (a *API) GetRiderLatestPosition(sfOrderID string) (retVal *RiderLatestPosit
OrderType: OrderTypeSF, //暂时默认
}
resp := a.HttpPostJson("riderlatestposition", param)
if resp == nil {
return nil, fmt.Errorf("GetRiderLatestPosition请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return nil, errors.New("HTTP请求错误请检查重试")
}
@@ -155,6 +173,9 @@ func (a *API) AddTipFee(deliveryId string, fee int64) error {
serialNumber: "",
}
resp := a.HttpPostJson("addordergratuityfee", param)
if resp == nil {
return fmt.Errorf("AddTipFee请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return errors.New("HTTP请求错误请检查重试")
}
@@ -177,6 +198,9 @@ func (a *API) QueryTipFee(sfOrderId string) (int64, error) {
"order_id": sfOrderId,
"push_time": time.Now().Unix()},
)
if resp == nil {
return 0, fmt.Errorf("QueryTipFee请求异常")
}
if resp.HttpStatusCode != HttpStatusSuccessCode {
return 0, errors.New("HTTP请求错误请检查重试")
}