Browse Source

feat(article): 添加任务ID筛选功能

- 在创建文章控制器中新增 task_id 参数
- 在文章服务中实现根据 task_id 筛选文章逻辑
- 支持通过任务ID精确查询相关文章
- 保留原有任务名称模糊查询功能
- 确保参数校验和查询条件拼接正确性
master
zhangf@suq.cn 5 days ago
parent
commit
9a0e7982a2
  1. 1
      app/controller/CreationArticleController.php
  2. 3
      app/service/CreationArticleService.php

1
app/controller/CreationArticleController.php

@ -40,6 +40,7 @@ class CreationArticleController
$params = requestOnly([
'article_category_id' => '',
'article_category' => '',
'task_id' => '',
'task' => '',
'title' => '',
'status' => '',

3
app/service/CreationArticleService.php

@ -80,6 +80,9 @@ class CreationArticleService extends BaseService
$cids = $this->articleCategoryDao->getColumn([['name', 'like', '%' . $params['article_category'] . '%']], 'id');
$query[] = ['article_category_id', 'in', $cids];
}
if (isNotBlank($params['task_id'])) {
$query[] = ['task_id', '=', $params['task_id']];
}
if (isNotBlank($params['task'])) {
$tids = $this->taskDao->getColumn([['name', 'like', '%' . $params['task'] . '%']], 'id');
$query[] = ['task_id', 'in', $tids];

Loading…
Cancel
Save