fix
This commit is contained in:
@@ -251,6 +251,7 @@ type (
|
||||
// 时间
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
PayTime *string `json:"pay_time"` // 支付时间
|
||||
QueryId *string `json:"query_id"` // 查询记录ID(用于报告结果跳转)
|
||||
}
|
||||
AdminGetAgentOrdersListResp {
|
||||
Total int64 `json:"total"` // 总数
|
||||
|
||||
@@ -73,8 +73,11 @@ func (l *AdminGetAgentOrdersListLogic) AdminGetAgentOrdersList(req *types.AdminG
|
||||
// 6. 批量查询产品信息
|
||||
productsMap := l.queryProductsByProductIds(productIds)
|
||||
|
||||
// 7. 组装数据
|
||||
list := l.assembleOrderList(orders, commissionsMap, agentsMap, usersMap, productsMap)
|
||||
// 7. 批量查询查询记录(用于报告结果跳转)
|
||||
queriesMap := l.queryQueriesByOrderIds(orderIds)
|
||||
|
||||
// 8. 组装数据
|
||||
list := l.assembleOrderList(orders, commissionsMap, agentsMap, usersMap, productsMap, queriesMap)
|
||||
|
||||
// 8. 应用后端筛选条件(代理、用户、产品、佣金状态)
|
||||
filteredList := l.applyFilters(list, req, agentsMap, usersMap, productsMap, commissionsMap)
|
||||
@@ -421,6 +424,35 @@ func (l *AdminGetAgentOrdersListLogic) queryProductsByProductIds(productIds []st
|
||||
return result
|
||||
}
|
||||
|
||||
// queryQueriesByOrderIds 批量查询查询记录信息
|
||||
func (l *AdminGetAgentOrdersListLogic) queryQueriesByOrderIds(orderIds []string) map[string]*model.Query {
|
||||
if len(orderIds) == 0 {
|
||||
return make(map[string]*model.Query)
|
||||
}
|
||||
|
||||
// 构建IN查询
|
||||
inClause := strings.Repeat("?,", len(orderIds))
|
||||
inClause = inClause[:len(inClause)-1]
|
||||
|
||||
queries, err := l.svcCtx.QueryModel.FindAll(l.ctx,
|
||||
l.svcCtx.QueryModel.SelectBuilder().
|
||||
Where(fmt.Sprintf("`order_id` IN (%s) AND `del_state` = ?", inClause), append(stringsToInterfaces(orderIds), globalkey.DelStateNo)...),
|
||||
"")
|
||||
|
||||
if err != nil {
|
||||
logx.Errorf("查询查询记录失败: %v", err)
|
||||
return make(map[string]*model.Query)
|
||||
}
|
||||
|
||||
// 构建map: orderId -> query
|
||||
result := make(map[string]*model.Query)
|
||||
for _, query := range queries {
|
||||
result[query.OrderId] = query
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// assembleOrderList 组装订单列表数据
|
||||
func (l *AdminGetAgentOrdersListLogic) assembleOrderList(
|
||||
orders []*model.Order,
|
||||
@@ -428,6 +460,7 @@ func (l *AdminGetAgentOrdersListLogic) assembleOrderList(
|
||||
agentsMap map[string]*model.Agent,
|
||||
usersMap map[string]*model.User,
|
||||
productsMap map[string]*model.Product,
|
||||
queriesMap map[string]*model.Query,
|
||||
) []types.AgentOrdersListItem {
|
||||
var list []types.AgentOrdersListItem
|
||||
|
||||
@@ -492,6 +525,12 @@ func (l *AdminGetAgentOrdersListLogic) assembleOrderList(
|
||||
payTime = &pt
|
||||
}
|
||||
|
||||
// 获取查询记录ID(用于报告结果跳转)
|
||||
var queryId *string
|
||||
if query, ok := queriesMap[order.Id]; ok {
|
||||
queryId = &query.Id
|
||||
}
|
||||
|
||||
list = append(list, types.AgentOrdersListItem{
|
||||
Id: order.Id,
|
||||
OrderNo: order.OrderNo,
|
||||
@@ -510,6 +549,7 @@ func (l *AdminGetAgentOrdersListLogic) assembleOrderList(
|
||||
CommissionStatus: commissionStatus,
|
||||
CreateTime: order.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
PayTime: payTime,
|
||||
QueryId: queryId,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ type AgentOrdersListItem struct {
|
||||
CommissionStatus int64 `json:"commission_status"` // 佣金状态
|
||||
CreateTime string `json:"create_time"` // 创建时间
|
||||
PayTime *string `json:"pay_time"` // 支付时间
|
||||
QueryId *string `json:"query_id"` // 查询记录ID(用于报告结果跳转)
|
||||
}
|
||||
|
||||
type AgentProductConfigItem struct {
|
||||
|
||||
Reference in New Issue
Block a user