正在显示
1 个修改的文件
包含
9 行增加
和
3 行删除
| @@ -29,10 +29,16 @@ class NewsController extends BaseController | @@ -29,10 +29,16 @@ class NewsController extends BaseController | ||
| 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['list'])){ |
| 31 | foreach ($lists['list'] as $k => $v){ | 31 | foreach ($lists['list'] as $k => $v){ |
| 32 | - $v = $newsCategoryLogic->get_category_name($v); | 32 | + if(!empty($v['category_id'])){ |
| 33 | + $v = $newsCategoryLogic->get_category_name($v); | ||
| 34 | + } | ||
| 33 | $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_NEWS, $v['id'], $this->user['project_id']); | 35 | $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_NEWS, $v['id'], $this->user['project_id']); |
| 34 | - $v['image_link'] = getImageUrl($v['image']); | ||
| 35 | - $v['operator_name'] = (new User())->getName($v['operator_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 | + } | ||
| 36 | $lists['list'][$k] = $v; | 42 | $lists['list'][$k] = $v; |
| 37 | } | 43 | } |
| 38 | } | 44 | } |
-
请 注册 或 登录 后发表评论