From aa1c20d4480c008fb3e99d3e439c92d1a5c1d80b Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Sat, 23 Mar 2024 23:09:40 +0800 Subject: [PATCH] 1 --- app/api/controller/Order.php | 32 +----------------------------- app/api/controller/StoreKeeper.php | 22 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/app/api/controller/Order.php b/app/api/controller/Order.php index be25d24b..8d7054a7 100644 --- a/app/api/controller/Order.php +++ b/app/api/controller/Order.php @@ -41,37 +41,7 @@ class Order extends Controller public function list(string $dataType): Json { $model = new OrderModel; - $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"; - if (!empty($good['goods_no'])) { - $copy_text .= "商品编号:{$good['goods_name']}\n"; - } - $copy_text .= "商品单价:{$good['goods_price']}\n"; - $copy_text .= "商品数量:{$good['total_num']}\n"; - $copy_text .= "商品总价:{$good['total_price']}\n"; - $copy_text .= "\n"; - } - if (!empty($value['address'])) { - $copy_text .= "收件人:{$value['address']['name']}\n"; - $copy_text .= "收件电话:{$value['address']['phone']}\n"; - $address = ''; - if (!empty($value['address']['region'])) { - $address = $value['address']['region']['province'] . $value['address']['region']['city'] . $value['address']['region']['region']; - } - $copy_text .= "收件地址:$address{$value['address']['detail']}\n"; - } - $data[$key]['copy_text'] = $copy_text; - } - } - $list['current_page'] = $result->currentPage(); - $list['last_page'] = $result->lastPage(); - $list['total'] = $result->total(); - $list['data'] = $data; + $list = $model->getList($dataType); return $this->renderSuccess(compact('list')); } diff --git a/app/api/controller/StoreKeeper.php b/app/api/controller/StoreKeeper.php index 589f2cf4..a51e9482 100644 --- a/app/api/controller/StoreKeeper.php +++ b/app/api/controller/StoreKeeper.php @@ -210,6 +210,28 @@ class StoreKeeper extends Controller } $list['data'][$key]['transfer']['transfer_image_ids'] = $transfer_image_ids; } + //复制信息 + $copy_text = "订单号:{$value['order_no']}\n"; + foreach ($value['goods'] as $good) { + $copy_text .= "商品名称:{$good['goods_name']}\n"; + if (!empty($good['goods_no'])) { + $copy_text .= "商品编号:{$good['goods_name']}\n"; + } + $copy_text .= "商品单价:{$good['goods_price']}\n"; + $copy_text .= "商品数量:{$good['total_num']}\n"; + $copy_text .= "商品总价:{$good['total_price']}\n"; + $copy_text .= "\n"; + } + if (!empty($value['address'])) { + $copy_text .= "收件人:{$value['address']['name']}\n"; + $copy_text .= "收件电话:{$value['address']['phone']}\n"; + $address = ''; + if (!empty($value['address']['region'])) { + $address = $value['address']['region']['province'] . $value['address']['region']['city'] . $value['address']['region']['region']; + } + $copy_text .= "收件地址:$address{$value['address']['detail']}\n"; + } + $list['data']['copy_text'] = $copy_text; } } return $this->renderSuccess(compact('dataType', 'list'));