From 978d43f316edd163bb7f85df7fc182727444347a Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Sat, 23 Mar 2024 23:05:24 +0800 Subject: [PATCH] 1 --- app/api/controller/Order.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/api/controller/Order.php b/app/api/controller/Order.php index b510ae15..be25d24b 100644 --- a/app/api/controller/Order.php +++ b/app/api/controller/Order.php @@ -41,9 +41,10 @@ class Order extends Controller public function list(string $dataType): Json { $model = new OrderModel; - $list = $model->getList($dataType); - if (!empty($list['data'])) { - foreach ($list['data'] as $key => $value) { + $result = $model->getList($dataType); + $data = $result->items(); + if (!empty($data)) { + foreach ($data as $key => $value) { $copy_text = "订单号:{$value['order_no']}\n"; foreach ($value['goods'] as $good) { $copy_text .= "商品名称:{$good['goods_name']}\n"; @@ -64,9 +65,13 @@ class Order extends Controller } $copy_text .= "收件地址:$address{$value['address']['detail']}\n"; } - $list['data'][$key]['copy_text'] = $copy_text; + $data[$key]['copy_text'] = $copy_text; } } + $list['current_page'] = $result->currentPage(); + $list['last_page'] = $result->lastPage(); + $list['total'] = $result->total(); + $list['data'] = $data; return $this->renderSuccess(compact('list')); }