|
|
@@ -561,20 +561,30 @@ class Order extends Backend |
|
|
|
'unishop_order.status'=>1 |
|
|
|
]) |
|
|
|
->field(' |
|
|
|
p.product_id, |
|
|
|
p.title, |
|
|
|
SUM(p.number) num, |
|
|
|
p.price, |
|
|
|
SUM(p.number)*p.price') |
|
|
|
SUM(p.number)*p.price as total') |
|
|
|
->group("p.product_id") |
|
|
|
->select(); |
|
|
|
$product_list = collection($product_list)->toArray(); |
|
|
|
$product_arr=[]; |
|
|
|
foreach ($product_list as $tmp_product){ |
|
|
|
if (isset($product_arr[$tmp_product['product_id']])){ |
|
|
|
$product_arr[$tmp_product['product_id']]["num"]+=$tmp_product['num']; |
|
|
|
$product_arr[$tmp_product['product_id']]["total"]+=$tmp_product['total']; |
|
|
|
}else{ |
|
|
|
$product_arr[$tmp_product['product_id']]=$tmp_product; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($title1 as $key => $value) { |
|
|
|
// 单元格内容写入 |
|
|
|
$sheet_two->setCellValueByColumnAndRow($key + 1, 1, $value); |
|
|
|
} |
|
|
|
$row=2; |
|
|
|
foreach ($product_list as $item) { |
|
|
|
foreach ($product_arr as $item) { |
|
|
|
$column = 1; |
|
|
|
foreach ($item as $value) { |
|
|
|
// 单元格内容写入 |
|
|
|