完善配送订单联系人明文展示
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// 功能描述:实现配送点范围内的合同、合同气瓶和配送订单接口。
|
||||
// 版本:v1.3.0。
|
||||
// 版本:v1.4.0。
|
||||
package delivery
|
||||
|
||||
import (
|
||||
@@ -387,7 +387,30 @@ func ListOrder(ctx *gin.Context) {
|
||||
infra.Response.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
infra.Response.Success(ctx, gin.H{"total": total, "list": response})
|
||||
infra.Response.Success(ctx, gin.H{"total": total, "list": restoreDeliveryOrderListContacts(response, orders)})
|
||||
}
|
||||
|
||||
// restoreDeliveryOrderListContacts 为当前配送点管理员恢复本点订单联系人快照明文。
|
||||
// 调用前订单必须已经按当前配送点完成范围过滤,避免跨配送点暴露联系人信息。
|
||||
func restoreDeliveryOrderListContacts(response any, orders []models.GasorderBasic) any {
|
||||
list, ok := response.([]any)
|
||||
if !ok {
|
||||
return response
|
||||
}
|
||||
for index, item := range list {
|
||||
if index >= len(orders) {
|
||||
break
|
||||
}
|
||||
record, ok := item.(map[string]any)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
record["contact_name"] = orders[index].ContactName
|
||||
record["contact_phone"] = orders[index].ContactPhone
|
||||
delete(record, "contact_name_masked")
|
||||
delete(record, "contact_phone_masked")
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
func GetOrder(ctx *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user