|
@@ -24,21 +24,16 @@ class NewsController extends BaseController |
|
@@ -24,21 +24,16 @@ class NewsController extends BaseController |
|
24
|
* @method
|
24
|
* @method
|
|
25
|
*/
|
25
|
*/
|
|
26
|
public function lists(NewsModel $news,NewsCategoryLogic $newsCategoryLogic){
|
26
|
public function lists(NewsModel $news,NewsCategoryLogic $newsCategoryLogic){
|
|
27
|
- $this->map['project_id'] = $this->user['project_id'];
|
27
|
+ $this->map = $this->searchParam();
|
|
28
|
$lists = $news->lists($this->map,$this->page,$this->row,$this->order = 'sort',
|
28
|
$lists = $news->lists($this->map,$this->page,$this->row,$this->order = 'sort',
|
|
29
|
['id','category_id','operator_id','status','created_at','updated_at','image','name','sort','url']);
|
29
|
['id','category_id','operator_id','status','created_at','updated_at','image','name','sort','url']);
|
|
30
|
- if(!empty($lists['list'])){
|
30
|
+ if(!empty($lists) && !empty($lists['list'])){
|
|
|
|
31
|
+ $user = new User();
|
|
31
|
foreach ($lists['list'] as $k => $v){
|
32
|
foreach ($lists['list'] as $k => $v){
|
|
32
|
- if(!empty($v['category_id'])){
|
|
|
|
33
|
- $v = $newsCategoryLogic->get_category_name($v);
|
|
|
|
34
|
- }
|
|
|
|
35
|
- $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_NEWS, $v['id'], $this->user['project_id']);
|
|
|
|
36
|
- if(!empty($v['image'])){
|
|
|
|
37
|
- $v['image_link'] = getImageUrl($v['image']);
|
|
|
|
38
|
- }
|
|
|
|
39
|
- if(!empty($v['operator_id'])){
|
|
|
|
40
|
- $v['operator_name'] = (new User())->getName($v['operator_id']);
|
|
|
|
41
|
- }
|
33
|
+ $v = $newsCategoryLogic->get_category_name($v);
|
|
|
|
34
|
+ $v['url'] = $this->user['domain'] . $v['url'];
|
|
|
|
35
|
+ $v['image_link'] = getImageUrl($v['image']);
|
|
|
|
36
|
+ $v['operator_name'] = $user->getName($v['operator_id']);
|
|
42
|
$lists['list'][$k] = $v;
|
37
|
$lists['list'][$k] = $v;
|
|
43
|
}
|
38
|
}
|
|
44
|
}
|
39
|
}
|
|
@@ -46,6 +41,21 @@ class NewsController extends BaseController |
|
@@ -46,6 +41,21 @@ class NewsController extends BaseController |
|
46
|
}
|
41
|
}
|
|
47
|
|
42
|
|
|
48
|
/**
|
43
|
/**
|
|
|
|
44
|
+ * @remark :处理列表返回参数
|
|
|
|
45
|
+ * @name :handleReturnParam
|
|
|
|
46
|
+ * @author :lyh
|
|
|
|
47
|
+ * @method :post
|
|
|
|
48
|
+ * @time :2023/9/14 10:01
|
|
|
|
49
|
+ */
|
|
|
|
50
|
+ public function searchParam(){
|
|
|
|
51
|
+ $this->map['project_id'] = $this->user['project_id'];
|
|
|
|
52
|
+ if(isset($this->map['category_id']) && !empty($this->map['category_id'])){
|
|
|
|
53
|
+ $this->map['category_id'] = ['like','%'.$this->map['category_id'].'%'];
|
|
|
|
54
|
+ }
|
|
|
|
55
|
+ return $this->map;
|
|
|
|
56
|
+ }
|
|
|
|
57
|
+
|
|
|
|
58
|
+ /**
|
|
49
|
* @remark :根据状态数量
|
59
|
* @remark :根据状态数量
|
|
50
|
* @name :getStatusNumber
|
60
|
* @name :getStatusNumber
|
|
51
|
* @author :lyh
|
61
|
* @author :lyh
|