处理搜索的分类问题

This commit is contained in:
liu 2024-06-25 14:26:55 +08:00
parent f52b285dc9
commit da38902072

View File

@ -35,6 +35,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
if ($name) {
if (preg_match('/[\x{4e00}-\x{9fff}]+/u', $name) == 1) {
$where['%like%'] = ['store_name' => 'store_name'];
$where['='] = ['store_id', 'bar_code', 'cate_id'];
} else {
$where['='] = ['bar_code', 'cate_id'];
}
@ -77,20 +78,6 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
*/
public function lists(): array
{
$found = false;
if ($this->searchWhere) {
foreach ($this->searchWhere as $subArray) {
if (in_array('store_id', $subArray)) {
$found = true;
break; // 找到后退出循环
}
}
}
if (!$found) {
$store_id = DictType::where('type', 'store')->value('remark') ?? 5;
$this->searchWhere[] = ['store_id', '=', $store_id];
}
$class_all = $this->request->get('class_all');
if ($class_all) {
//查3级别的
@ -124,19 +111,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
*/
public function count(): int
{
$found = false;
if ($this->searchWhere) {
foreach ($this->searchWhere as $subArray) {
if (in_array('store_id', $subArray)) {
$found = true;
break; // 找到后退出循环
}
}
}
if (!$found) {
$store_id = DictType::where('type', 'store')->value('remark') ?? 5;
$this->searchWhere[] = ['store_id', '=', $store_id];
}
$class_all = $this->request->get('class_all');
if ($class_all) {
//查3级别的