wanghousheng 8 months ago
parent 79d7c603f4
commit 978d43f316
  1. 13
      app/api/controller/Order.php

@ -41,9 +41,10 @@ class Order extends Controller
public function list(string $dataType): Json public function list(string $dataType): Json
{ {
$model = new OrderModel; $model = new OrderModel;
$list = $model->getList($dataType); $result = $model->getList($dataType);
if (!empty($list['data'])) { $data = $result->items();
foreach ($list['data'] as $key => $value) { if (!empty($data)) {
foreach ($data as $key => $value) {
$copy_text = "订单号:{$value['order_no']}\n"; $copy_text = "订单号:{$value['order_no']}\n";
foreach ($value['goods'] as $good) { foreach ($value['goods'] as $good) {
$copy_text .= "商品名称:{$good['goods_name']}\n"; $copy_text .= "商品名称:{$good['goods_name']}\n";
@ -64,9 +65,13 @@ class Order extends Controller
} }
$copy_text .= "收件地址:$address{$value['address']['detail']}\n"; $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')); return $this->renderSuccess(compact('list'));
} }

Loading…
Cancel
Save