|
|
@ -12,9 +12,8 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
namespace app\api\model; |
|
|
|
namespace app\api\model; |
|
|
|
|
|
|
|
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
|
|
|
use app\common\model\Article as ArticleModel; |
|
|
|
|
|
|
|
use app\api\model\article\Category as CategoryModel; |
|
|
|
use app\api\model\article\Category as CategoryModel; |
|
|
|
|
|
|
|
use app\common\model\Article as ArticleModel; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 商品评价模型 |
|
|
|
* 商品评价模型 |
|
|
@ -81,11 +80,14 @@ class Article extends ArticleModel |
|
|
|
* @return \think\Paginator |
|
|
|
* @return \think\Paginator |
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getList(int $categoryId = 0, int $limit = 15): \think\Paginator |
|
|
|
public function getList(int $categoryId = 0, int $limit = 15, string $title): \think\Paginator |
|
|
|
{ |
|
|
|
{ |
|
|
|
// 检索查询条件 |
|
|
|
// 检索查询条件 |
|
|
|
$filter = []; |
|
|
|
$filter = []; |
|
|
|
$categoryId > 0 && $filter[] = ['category_id', '=', $categoryId]; |
|
|
|
$categoryId > 0 && $filter[] = ['category_id', '=', $categoryId]; |
|
|
|
|
|
|
|
if ($title) { |
|
|
|
|
|
|
|
$filter[] = ['title', 'like', "%$title%"]; |
|
|
|
|
|
|
|
} |
|
|
|
// 获取列表数据 |
|
|
|
// 获取列表数据 |
|
|
|
$list = $this->withoutField(['content']) |
|
|
|
$list = $this->withoutField(['content']) |
|
|
|
->where($filter) |
|
|
|
->where($filter) |
|
|
|