feat(CartList): 修改购物车列表查询限制和单位处理逻辑

This commit is contained in:
mkm 2024-08-29 11:01:25 +08:00
parent 4a2378f15b
commit 4d1d2e0745

View File

@ -49,7 +49,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
'is_pay' => 0
];
$list = Cart::where($this->searchWhere)->where($where)
->limit($this->limitOffset, $this->limitLength)
->limit(100)
->order(['id' => 'desc'])
->select()->each(function ($item) {
@ -91,7 +91,14 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
$item['image'] = $find['image'];
$item['cost'] = $find['cost'];
$item['store_name'] = $find['store_name'];
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name');
$unit = StoreProductUnit::where('id', $find['unit'])->find();
if($unit){
$item['unit_name']=$unit['name'];
$item['is_bulk']=$unit['is_bulk'];
}else{
$item['unit_name']='';
$item['is_bulk']=0;
}
}
}
return $list;