refactor: 完善商品导出

master
yin5th 2023-10-09 17:53:18 +08:00
parent 5e47ef98b0
commit 1e4e85e022
2 changed files with 7 additions and 5 deletions

View File

@ -186,6 +186,7 @@ class Goods extends AdminBase
$fieldsArr = [
'ID' => 'string',
'商品名称' => 'string',
'商品编码' => 'string',
'商家名称' => 'string',
'单位' => 'string',
'品牌' => 'string',
@ -232,15 +233,15 @@ class Goods extends AdminBase
// ->leftJoin('goods_item gi', 'gi.goods_id = g.id') // 先注释 不关联查询sku 否则非常慢
->where($where)->count();
if ($total > 10000) {
return JsonServer::error('导出条数不能超过1W条');
if ($total > 100000) {
return JsonServer::error('导出条数不能超过10W条');
}
if ($total == 0) {
return JsonServer::error('没有符合条件的数据');
}
$fieldRaw = "g.id as id, g.name as name,s.name as shop_name,gu.name as unit_name,gb.name as brand_name,
$fieldRaw = "g.id as id, g.name as name,g.code,s.name as shop_name,gu.name as unit_name,gb.name as brand_name,
gc1.name as first_cate_name,gc2.name as second_cate_name,gc3.name as third_cate_name,
g.image,g.content,g.status,g.sales_actual,g.max_price,g.min_price,g.stock,g.audit_status,g.custom_params
";
@ -258,7 +259,7 @@ class Goods extends AdminBase
$cursor = $query
->where($where)
->limit(10000)
->limit(100000)
->fieldRaw($fieldRaw)
->group('g.id')
->cursor();
@ -267,6 +268,7 @@ class Goods extends AdminBase
$row = [];
$row[] = (string)$item['id'];
$row[] = $item['name'];
$row[] = $item['code'];
$row[] = $item['shop_name'];
$row[] = $item['unit_name'];
$row[] = $item['brand_name'];

View File

@ -14,7 +14,7 @@
<div class="layui-colla-content layui-show">
<p>*平台审核商家发布的商品,当商品审核通过并且处于销售中状态时,商家可以销售该商品</p>
<p>*平台可通过“违规重审”,下架违规商品并标记为审核未通过。</p>
<p>*商品导出说明点击导出按钮时1. 若有手动勾选则导出勾选记录 2.没有手动勾选则导出符合筛选条件的所有记录 最大导出条数不超过1w条</p>
<p>*商品导出说明点击导出按钮时1. 若有手动勾选则导出勾选记录 2.没有手动勾选则导出符合筛选条件的所有记录 最大导出条数不超过10w条</p>
</div>
</div>
</div>