wanghousheng 8 months ago
parent 6e6092015a
commit 79d7c603f4
  1. 25
      app/api/controller/Order.php

@ -42,6 +42,31 @@ class Order extends Controller
{ {
$model = new OrderModel; $model = new OrderModel;
$list = $model->getList($dataType); $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')); return $this->renderSuccess(compact('list'));
} }

Loading…
Cancel
Save