f
This commit is contained in:
@@ -62,9 +62,16 @@ func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailB
|
||||
}
|
||||
|
||||
// 检查订单状态
|
||||
if order.Status != "paid" {
|
||||
// - pending:未支付,阻止查看
|
||||
// - refunded:已退款,允许进入,但前端只展示“查询为空,订单已退款”提示(不再展示报告数据)
|
||||
// - 其他异常状态:按未找到处理
|
||||
if order.Status == "pending" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("订单未支付,无法查看报告"), "")
|
||||
}
|
||||
if order.Status != "paid" && order.Status != "refunded" {
|
||||
// 使用逻辑层“未找到”错误码,前端按空结果处理
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.LOGIC_QUERY_NOT_FOUND), "订单状态不支持查看报告, status=%s", order.Status)
|
||||
}
|
||||
|
||||
// 获取报告信息
|
||||
queryModel, err := l.svcCtx.QueryModel.FindOneByOrderId(l.ctx, req.OrderId)
|
||||
@@ -105,6 +112,15 @@ func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailB
|
||||
}
|
||||
query.ProductName = product.ProductName
|
||||
query.Product = product.ProductEn
|
||||
|
||||
// 已退款订单:不再返回具体报告数据,仅告知前端“查询为空,订单已退款”
|
||||
if order.Status == "refunded" {
|
||||
query.QueryState = "failed" // 前端据此走空状态 + 退款提示
|
||||
query.QueryData = []types.QueryItem{} // 不返回任何模块数据
|
||||
if query.QueryParams == nil { // 参数可选保留,这里保险起见给个空 map
|
||||
query.QueryParams = map[string]interface{}{}
|
||||
}
|
||||
}
|
||||
return &types.QueryDetailByOrderIdResp{
|
||||
Query: query,
|
||||
}, nil
|
||||
|
||||
@@ -53,9 +53,16 @@ func (l *QueryDetailByOrderNoLogic) QueryDetailByOrderNo(req *types.QueryDetailB
|
||||
}
|
||||
|
||||
// 检查订单状态
|
||||
if order.Status != "paid" {
|
||||
// - pending:未支付,阻止查看
|
||||
// - refunded:已退款,允许进入,但前端只展示“查询为空,订单已退款”提示(不再展示报告数据)
|
||||
// - 其他异常状态:按未找到处理
|
||||
if order.Status == "pending" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("订单未支付,无法查看报告"), "")
|
||||
}
|
||||
if order.Status != "paid" && order.Status != "refunded" {
|
||||
// 使用逻辑层“未找到”错误码,前端按空结果处理
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.LOGIC_QUERY_NOT_FOUND), "订单状态不支持查看报告, status=%s", order.Status)
|
||||
}
|
||||
|
||||
// 获取报告信息
|
||||
queryModel, err := l.svcCtx.QueryModel.FindOneByOrderId(l.ctx, order.Id)
|
||||
@@ -96,6 +103,15 @@ func (l *QueryDetailByOrderNoLogic) QueryDetailByOrderNo(req *types.QueryDetailB
|
||||
}
|
||||
query.Product = product.ProductEn
|
||||
query.ProductName = product.ProductName
|
||||
|
||||
// 已退款订单:不再返回具体报告数据,仅告知前端“查询为空,订单已退款”
|
||||
if order.Status == "refunded" {
|
||||
query.QueryState = "failed" // 前端据此走空状态 + 退款提示
|
||||
query.QueryData = []types.QueryItem{} // 不返回任何模块数据
|
||||
if query.QueryParams == nil { // 参数可选保留,这里保险起见给个空 map
|
||||
query.QueryParams = map[string]interface{}{}
|
||||
}
|
||||
}
|
||||
return &types.QueryDetailByOrderNoResp{
|
||||
Query: query,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user