wysf
bruce 9 months ago
parent 7507ab918d
commit 86bdc28a69
  1. 10
      app/common/model/Goods.php

@ -194,7 +194,7 @@ class Goods extends BaseModel
$this->getPk() => 'desc', $this->getPk() => 'desc',
]; ];
} }
$field = $this->getAliasFields($this->name, ['content']); $field = $this->getAliasFields($this->name, ['content']);
@ -311,6 +311,7 @@ class Goods extends BaseModel
'goodsName' => null, // 商品名称 'goodsName' => null, // 商品名称
'goodsNo' => null, // 商品编码 'goodsNo' => null, // 商品编码
'status' => 0, // 商品状态(0全部 10上架 20下架) 'status' => 0, // 商品状态(0全部 10上架 20下架)
'keywords' => []
]); ]);
// 实例化新查询对象 // 实例化新查询对象
@ -342,6 +343,9 @@ class Goods extends BaseModel
$a = 1; $a = 1;
} }
if(count($params['keywords']) > 0 ) {
$filter[] = ['goods_name', 'like', "%{$params['keywords']}%"];
}
// 商品名称 // 商品名称
!empty($params['goodsName']) && $filter[] = ['goods_name', 'like', "%{$params['goodsName']}%"]; !empty($params['goodsName']) && $filter[] = ['goods_name', 'like', "%{$params['goodsName']}%"];
// 商品编码 // 商品编码
@ -366,7 +370,7 @@ class Goods extends BaseModel
if (isset($param['is_in_store']) && $param['is_in_store'] !== '') { if (isset($param['is_in_store']) && $param['is_in_store'] !== '') {
$filter[] = ['is_in_store', '=', $params['is_in_store']]; $filter[] = ['is_in_store', '=', $params['is_in_store']];
} }
if (isset($param['store_id']) && $param['store_id'] !== '') { if (isset($param['store_id']) && $param['store_id'] !== '') {
$filter[] = ['goods.store_id', '=', $params['store_id']]; $filter[] = ['goods.store_id', '=', $params['store_id']];
} }
@ -391,7 +395,7 @@ class Goods extends BaseModel
// 遍历商品列表整理数据 // 遍历商品列表整理数据
foreach ($list as &$goods) { foreach ($list as &$goods) {
$goods = $this->setGoodsData($goods, $callback); $goods = $this->setGoodsData($goods, $callback);
} }

Loading…
Cancel
Save