query1 order
This commit is contained in:
parent
2238f24820
commit
4d6211a30f
|
|
@ -67,7 +67,7 @@ func (this *VoucherBiz) Query(ctx context.Context, order *bo.OrderBo) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (this *VoucherBiz) QueryOrder(ctx context.Context, orderNo string) (string, error) {
|
||||
func (this *VoucherBiz) QueryOrder(ctx context.Context, orderNo, isNotice string) (string, error) {
|
||||
|
||||
order, err3 := this.OrderRepo.GetByOrderNo(ctx, orderNo)
|
||||
if err3 != nil {
|
||||
|
|
@ -79,10 +79,19 @@ func (this *VoucherBiz) QueryOrder(ctx context.Context, orderNo string) (string,
|
|||
return "", err
|
||||
}
|
||||
|
||||
return this.ToTextDescription(order, status), nil
|
||||
notifyStr := ""
|
||||
if isNotice == "YES" {
|
||||
notify, err := this.Cmb.Notify(ctx, order)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("查询通知招行失败:%s,orderNo:%s", err, order.OrderNo)
|
||||
}
|
||||
notifyStr = fmt.Sprintf("通知招行成功:notify_id:%d", notify.ID)
|
||||
}
|
||||
|
||||
func (this *VoucherBiz) ToTextDescription(bo *bo.OrderBo, orderStatus vo.OrderStatus) string {
|
||||
return this.ToTextDescription(order, status, notifyStr), nil
|
||||
}
|
||||
|
||||
func (this *VoucherBiz) ToTextDescription(bo *bo.OrderBo, orderStatus vo.OrderStatus, notifyStr string) string {
|
||||
|
||||
var parts []string
|
||||
|
||||
|
|
@ -132,6 +141,10 @@ func (this *VoucherBiz) ToTextDescription(bo *bo.OrderBo, orderStatus vo.OrderSt
|
|||
parts = append(parts, "更新时间:未更新")
|
||||
}
|
||||
|
||||
if notifyStr != "" {
|
||||
parts = append(parts, fmt.Sprintf("通知结果:%s", notifyStr))
|
||||
}
|
||||
|
||||
// 用换行符拼接所有片段,形成最终描述
|
||||
return strings.Join(parts, "\n")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,14 +36,22 @@ func NewHTTPServer(
|
|||
return ctx.String(http2.StatusOK, "pong")
|
||||
})
|
||||
|
||||
// 订单通知重试 -- 不健全
|
||||
srv.Route("/voucher/").POST("orderNotifyRetry", cmb.OrderNotifyRetry)
|
||||
// 重试通知
|
||||
srv.Route("/voucher/").POST("notifyRetry/{id}", cmb.NotifyRetry)
|
||||
srv.Route("/voucher/").POST("queryOrder/{order_no}/{phone}", cmb.QueryOrder)
|
||||
// 查询订单状态及微信状态
|
||||
srv.Route("/voucher/").POST("queryOrder/{order_no}/{phone}/{is_notice}", cmb.QueryOrder)
|
||||
// 查询商品
|
||||
srv.Route("/voucher/").POST("queryStock/{product_no}", cmb.QueryStock)
|
||||
// 注册商品tag到刚哥那边
|
||||
srv.Route("/voucher/").POST("registerTag/{id}", cmb.RegisterTag)
|
||||
// 成功订单查询最终状态处理
|
||||
srv.Route("/voucher/").POST("pushWechatQuery", cmb.PushWechatQuery)
|
||||
// 订单查询最终状态处理
|
||||
srv.Route("/voucher/").POST("timeSliceQueryPush", cmb.TimeSliceQueryPush)
|
||||
srv.Route("/voucher/").POST("pushWechatRetry/{batch_no}", cmb.PushWechatRetry)
|
||||
// 商品预警通知
|
||||
srv.Route("/voucher/").POST("warningBudget/{id}", cmb.WarningBudget)
|
||||
// 指定重复通知对应单子数据
|
||||
srv.Route("/voucher/").POST("specifyNotification", cmb.SpecifyNotification)
|
||||
|
|
|
|||
|
|
@ -71,7 +71,9 @@ func (this *CmbService) QueryOrder(ctx http.Context) error {
|
|||
return fmt.Errorf("orderNo is empty")
|
||||
}
|
||||
|
||||
str, err := this.VoucherBiz.QueryOrder(ctx, orderNo)
|
||||
isNotice := ctx.Vars().Get("is_notice")
|
||||
|
||||
str, err := this.VoucherBiz.QueryOrder(ctx, orderNo, isNotice)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue