对接文档去除上游概念,只展示商户对接平台
- 文档移除所有上游/发货平台/BFF 表述:接口字段说明、示例、推荐流程全部中性化 - 代码用户可见文案同步中性化:提交发货 message、错误提示、发货配置相关措辞 - 概述去掉 /api/open/v1 上游链路提示
This commit is contained in:
@@ -231,7 +231,7 @@ func (s *DeliveryService) bindGood(gameAccount, goodID string) (*DeliveryBindRes
|
||||
return nil, err
|
||||
}
|
||||
if out.BindUUID == "" || out.URL == "" {
|
||||
return nil, errors.New("上游未返回绑定二维码")
|
||||
return nil, errors.New("绑定服务未返回绑定二维码")
|
||||
}
|
||||
return &DeliveryBindResult{
|
||||
BindUUID: out.BindUUID,
|
||||
@@ -284,7 +284,7 @@ func (s *DeliveryService) submit(orderNo, gameAccount, bindUUID string, apiClien
|
||||
}
|
||||
// 已在上游创建正式订单的失败订单禁止自动重发,避免重复发货。
|
||||
if orderStatus == model.OrderStatusShipFailed && deliverySubmittedUpstream(order) {
|
||||
return nil, newDeliveryHTTPError(http.StatusConflict, "该订单已提交上游,为避免重复发货不能直接重试,请先在上游确认订单状态或联系平台处理")
|
||||
return nil, newDeliveryHTTPError(http.StatusConflict, "该订单已进入发货流程,为避免重复发货不能直接重试,请稍后查询订单状态或联系平台处理")
|
||||
}
|
||||
if !info.CanShip {
|
||||
reason := info.CannotShipReason
|
||||
@@ -351,10 +351,10 @@ func (s *DeliveryService) submit(orderNo, gameAccount, bindUUID string, apiClien
|
||||
"upstream_order": upstreamOrder,
|
||||
})
|
||||
nextStatus := model.OrderStatusDelivering
|
||||
message := "已提交上游发货,等待发货结果回传"
|
||||
message := "已提交发货,等待发货结果回传"
|
||||
if upstreamDeliverySucceeded(upstreamOrder) {
|
||||
nextStatus = model.OrderStatusDelivered
|
||||
message = "上游已返回发货成功"
|
||||
message = "发货已完成"
|
||||
}
|
||||
updated, err := s.fulfillment.UpdateFulfillment(FulfillmentUpdateInput{
|
||||
MerchantID: order.MerchantID,
|
||||
@@ -533,7 +533,7 @@ func (s *DeliveryService) buildDeliveryState(openOrder *OpenOrderQuery, order *m
|
||||
goodID = deliveryGoodID(s.channel, openOrder.Product.SKU)
|
||||
if goodID == "" {
|
||||
canShip = false
|
||||
reason = "未找到对应的上游商品配置"
|
||||
reason = "未找到对应的商品发货配置"
|
||||
}
|
||||
}
|
||||
if requireCanShip && !canShip {
|
||||
@@ -743,7 +743,7 @@ func (s *DeliveryService) prepareOrder(orderNo string, requireCanShip bool, auth
|
||||
goodID = deliveryGoodID(s.channel, openOrder.Product.SKU)
|
||||
if goodID == "" {
|
||||
canShip = false
|
||||
reason = "未找到对应的上游商品配置"
|
||||
reason = "未找到对应的商品发货配置"
|
||||
}
|
||||
}
|
||||
if requireCanShip && !canShip {
|
||||
@@ -892,11 +892,11 @@ func (s *DeliveryService) createOrderQueue(goodID, orderNo string) (string, erro
|
||||
return "", err
|
||||
}
|
||||
if len(out.Orders) == 0 {
|
||||
return "", errors.New("上游未返回队列订单")
|
||||
return "", errors.New("发货服务未返回队列订单")
|
||||
}
|
||||
orderID := firstNonEmpty(stringFromMap(out.Orders[0], "_id"), stringFromMap(out.Orders[0], "id"))
|
||||
if orderID == "" {
|
||||
return "", errors.New("上游未返回队列订单 ID")
|
||||
return "", errors.New("发货服务未返回队列订单 ID")
|
||||
}
|
||||
return orderID, nil
|
||||
}
|
||||
@@ -945,7 +945,7 @@ func (s *DeliveryService) signProxy(path, method string, data interface{}, out i
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
resp, err := s.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return fmt.Errorf("上游请求失败:%w", err)
|
||||
return fmt.Errorf("发货服务请求失败:%w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
|
||||
@@ -955,19 +955,19 @@ func (s *DeliveryService) signProxy(path, method string, data interface{}, out i
|
||||
Data json.RawMessage `json:"data"`
|
||||
}
|
||||
if err := json.Unmarshal(body, &envelope); err != nil {
|
||||
return fmt.Errorf("上游响应无法解析:%s", truncateDeliveryText(string(body)))
|
||||
return fmt.Errorf("发货服务响应无法解析:%s", truncateDeliveryText(string(body)))
|
||||
}
|
||||
if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices || !isZeroCode(envelope.Code) {
|
||||
if envelope.Message != "" {
|
||||
return errors.New(envelope.Message)
|
||||
}
|
||||
return fmt.Errorf("上游请求失败:HTTP %d", resp.StatusCode)
|
||||
return fmt.Errorf("发货服务请求失败:HTTP %d", resp.StatusCode)
|
||||
}
|
||||
if out == nil || len(envelope.Data) == 0 || string(envelope.Data) == "null" {
|
||||
return nil
|
||||
}
|
||||
if err := json.Unmarshal(envelope.Data, out); err != nil {
|
||||
return fmt.Errorf("上游数据无法解析:%w", err)
|
||||
return fmt.Errorf("发货服务数据无法解析:%w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user