|
...
|
...
|
@@ -23,19 +23,17 @@ class BlogController extends BaseController |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function lists(BlogModel $blogModel,BlogCategoryLogic $blogCategoryLogic,BlogLabelLogic $blogLabelLogic){
|
|
|
|
//搜索条件
|
|
|
|
$this->map['project_id'] = $this->user['project_id'];
|
|
|
|
$this->map = $this->searchParam();
|
|
|
|
$lists = $blogModel->lists($this->map,$this->page,$this->row,$this->order = 'sort',
|
|
|
|
['id','category_id','operator_id','status','created_at','label_id','image','updated_at','name','sort','url']);
|
|
|
|
if(!empty($lists['list'])){
|
|
|
|
if(!empty($lists) && !empty($lists['list'])){
|
|
|
|
$user = new User();
|
|
|
|
foreach ($lists['list'] as $k => $v){
|
|
|
|
//获取分类名称
|
|
|
|
$v = $blogCategoryLogic->get_category_name($v);
|
|
|
|
//获取标签名称
|
|
|
|
$v = $blogLabelLogic->get_label_name($v);
|
|
|
|
$v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_BLOG, $v['id'], $this->user['project_id']);
|
|
|
|
$v['url'] = $this->user['domain'] .$v['url'];
|
|
|
|
$v['image_link'] = getImageUrl($v['image']);
|
|
|
|
$v['operator_name'] = (new User())->getName($v['operator_id']);
|
|
|
|
$v['operator_name'] = $user->getName($v['operator_id']);
|
|
|
|
$lists['list'][$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -43,6 +41,21 @@ class BlogController extends BaseController |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理列表返回参数
|
|
|
|
* @name :handleReturnParam
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/14 10:01
|
|
|
|
*/
|
|
|
|
public function searchParam(){
|
|
|
|
$this->map['project_id'] = $this->user['project_id'];
|
|
|
|
if(isset($this->map['category_id']) && !empty($this->map['category_id'])){
|
|
|
|
$this->map['category_id'] = ['like','%,'.$this->map['category_id'].',%'];
|
|
|
|
}
|
|
|
|
return $this->map;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :根据状态数量
|
|
|
|
* @name :getStatusNumber
|
|
|
|
* @author :lyh
|
...
|
...
|
|