diff --git a/app/api/controller/Order.php b/app/api/controller/Order.php index 8d7054a7..b510ae15 100644 --- a/app/api/controller/Order.php +++ b/app/api/controller/Order.php @@ -42,6 +42,31 @@ class Order extends Controller { $model = new OrderModel; $list = $model->getList($dataType); + if (!empty($list['data'])) { + foreach ($list['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"; + } + $list['data'][$key]['copy_text'] = $copy_text; + } + } return $this->renderSuccess(compact('list')); }