完善配送订单列表可读信息
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 功能描述:为平台配送订单列表与详情补充关联名称、地址和合同气瓶摘要。
|
||||
// 版本:v1.1.0
|
||||
// 版本:v1.2.0
|
||||
package gasorder
|
||||
|
||||
import (
|
||||
@@ -62,18 +62,27 @@ func ListGasorderBasic(ctx *gin.Context) {
|
||||
infra.Response.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
displays, err := buildGasorderListDisplays(orders)
|
||||
response, err := BuildGasorderListResponse(ctx, orders)
|
||||
if err != nil {
|
||||
infra.Response.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
infra.Response.Success(ctx, gin.H{"total": total, "list": response})
|
||||
}
|
||||
|
||||
// BuildGasorderListResponse 为已经完成数据范围筛选的订单构造安全、可读的管理端列表响应。
|
||||
// 调用方必须先限定自身可见订单;本函数只补充派生名称、气瓶摘要并恢复订单地址快照。
|
||||
func BuildGasorderListResponse(ctx *gin.Context, orders []models.GasorderBasic) (any, error) {
|
||||
displays, err := buildGasorderListDisplays(orders)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response, err := common.PublicResourceResponse(displays)
|
||||
if err != nil {
|
||||
infra.Response.Error(ctx, err)
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
protected := common.ProtectPreciseLocation(ctx, &models.GasorderBasic{}, response)
|
||||
infra.Response.Success(ctx, gin.H{"total": total, "list": restoreGasorderListAddresses(protected, orders)})
|
||||
return restoreGasorderListAddresses(protected, orders), nil
|
||||
}
|
||||
|
||||
// buildGasorderListDisplays 批量读取创建方与有效订单气瓶,避免列表逐行查询。
|
||||
|
||||
Reference in New Issue
Block a user