作者 lyh

gx

@@ -23,13 +23,12 @@ class BlogLabelLogic extends BaseLogic @@ -23,13 +23,12 @@ class BlogLabelLogic extends BaseLogic
23 * @author :liyuhang 23 * @author :liyuhang
24 * @method 24 * @method
25 */ 25 */
26 - public function getLabelName($label){  
27 - $label_info = $this->model->list(['id'=>['in',explode(',',trim($label,','))]],'id',['name']);  
28 - $str = '';  
29 - foreach ($label_info as $v1){  
30 - $str .= $v1['name'].','; 26 + public function getLabelName($label_id){
  27 + $label_name = '';
  28 + if(!empty($label_id)){
  29 + $label_arr = $this->model->formatQuery(['id'=>['in',explode(',',trim($label_id,','))]])->pluck('name')->toArray();
  30 + $label_name = explode(',',$label_arr);
31 } 31 }
32 - $label_name = trim($str,',');  
33 return $this->success($label_name); 32 return $this->success($label_name);
34 } 33 }
35 /** 34 /**
@@ -152,7 +152,7 @@ class BlogLogic extends BaseLogic @@ -152,7 +152,7 @@ class BlogLogic extends BaseLogic
152 $info['category_id'] = $assCateModel->where(['type_id'=>$info['id']])->pluck('category_id')->toArray(); 152 $info['category_id'] = $assCateModel->where(['type_id'=>$info['id']])->pluck('category_id')->toArray();
153 //获取标签名称 153 //获取标签名称
154 $blogLabelLogic = new BlogLabelLogic(); 154 $blogLabelLogic = new BlogLabelLogic();
155 - $info['label_name'] = $blogLabelLogic->getLabelName($info); 155 + $info['label_name'] = $blogLabelLogic->getLabelName($info['label_id']);
156 $info['image_link'] = getImageUrl($info['image']); 156 $info['image_link'] = getImageUrl($info['image']);
157 return $this->success($info); 157 return $this->success($info);
158 } 158 }