|
|
|
@ -26,6 +26,7 @@ use think\model\relation\HasMany; |
|
|
|
|
use think\model\relation\HasOne; |
|
|
|
|
use think\Paginator; |
|
|
|
|
use app\common\model\Channel; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 商品模型 |
|
|
|
|
* Class Goods |
|
|
|
@ -167,6 +168,7 @@ class Goods extends BaseModel |
|
|
|
|
{ |
|
|
|
|
return $this->hasMany('Comment'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取商品列表 |
|
|
|
|
* @param array $param 查询条件 |
|
|
|
@ -196,7 +198,6 @@ class Goods extends BaseModel |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$field = $this->getAliasFields($this->name, ['content']); |
|
|
|
|
$field[] = 'selling_point'; |
|
|
|
|
// 执行查询 |
|
|
|
@ -210,6 +211,7 @@ class Goods extends BaseModel |
|
|
|
|
// 整理列表数据并返回 |
|
|
|
|
return $this->setGoodsListData($list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取商品列表 |
|
|
|
|
* @param array $param 查询条件 |
|
|
|
@ -344,9 +346,12 @@ class Goods extends BaseModel |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// 商品名称 |
|
|
|
|
foreach ($params['keywords'] ?? [] as $val){ |
|
|
|
|
if (is_array($params['keywords'])) { |
|
|
|
|
foreach ($params['keywords'] as $val) { |
|
|
|
|
$filter[] = ['goods_name', 'like', "%{$val}%"]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 商品名称 |
|
|
|
|
!empty($params['goodsName']) && $filter[] = ['goods_name', 'like', "%{$params['goodsName']}%"]; |
|
|
|
|
// 商品编码 |
|
|
|
|