|
@@ -321,15 +321,22 @@ class Order extends Base
|
|
$list = OrderService::getOrderList($userId ,$param, $status);
|
|
$list = OrderService::getOrderList($userId ,$param, $status);
|
|
|
|
|
|
// 查询支付信息
|
|
// 查询支付信息
|
|
- $orderIds = array_column(collection($list)->toArray(), 'id');
|
|
|
|
|
|
+ $orderIds = $list->column('id');
|
|
$payInfo = PayOperService::getPayInfoByOrderIds($orderIds, 1);
|
|
$payInfo = PayOperService::getPayInfoByOrderIds($orderIds, 1);
|
|
-
|
|
|
|
|
|
+ // 形成kv
|
|
|
|
+ $payInfoKV = [];
|
|
|
|
+ foreach ($payInfo as $item) {
|
|
|
|
+ $payInfoKV[$item->order_id] = $item;
|
|
|
|
+ }
|
|
|
|
+ $list->each(function($row) use ($payInfoKV) {
|
|
|
|
+ $row->pay_info = $payInfoKV[$row->id] ?? [];
|
|
|
|
+ });
|
|
|
|
+
|
|
foreach ($list as $item) {
|
|
foreach ($list as $item) {
|
|
// $item->append(['order_status_text']);
|
|
// $item->append(['order_status_text']);
|
|
- $field = 'id,order_sn,amount,goods_price,order_amount,express_name,express_no,order_goods,order_status_text,order_status';
|
|
|
|
|
|
+ $field = 'id,order_sn,amount,goods_price,order_amount,express_name,express_no,order_goods,order_status_text,order_status,pay_info';
|
|
$item->visible(explode(',', $field));
|
|
$item->visible(explode(',', $field));
|
|
$item->order_status_text = OrderEnum::STATUS_TEXT_MAP[$item->order_status];
|
|
$item->order_status_text = OrderEnum::STATUS_TEXT_MAP[$item->order_status];
|
|
- $item->pay_info = $payInfo->where('order_id', $item->id)->find();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$this->success('获取成功', $list);
|
|
$this->success('获取成功', $list);
|