作者 lyh

gx

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