mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
feat: 完成平台发表情况查询
This commit is contained in:
@@ -44,15 +44,40 @@ class Post extends Common
|
||||
|
||||
public function indexOutput()
|
||||
{
|
||||
$platform_type = $this->request->param('platform_type', '');
|
||||
if (empty($platform_type)) {
|
||||
$this->error('参数platform_type不能为空');
|
||||
}
|
||||
$platform_status = $this->request->param('platform_status', '');
|
||||
$model_list = ModelPost::with(['categorys.category', 'tags.tag'])
|
||||
->where('type', $this->request->param('type', 1))
|
||||
->order('id desc');
|
||||
|
||||
if($platform_status == 1){
|
||||
$model_list = $model_list->where('post_platform_status', 'like', "%,{$platform_type},%");
|
||||
}else if ($platform_status === '0'){
|
||||
$model_list = $model_list->where('post_platform_status', 'not like', "%,{$platform_type},%");
|
||||
}
|
||||
|
||||
$list = $model_list->paginate([
|
||||
'query' => $this->request->get(),
|
||||
]);
|
||||
|
||||
foreach ($list as $model_post) {
|
||||
if (empty($model_post->post_platform_status)) {
|
||||
$model_post->platform_status = 0;
|
||||
} else {
|
||||
if (strpos($model_post->post_platform_status, ",$platform_type,") === false) {
|
||||
$model_post->platform_status = 0;
|
||||
} else {
|
||||
$model_post->platform_status = 1;
|
||||
}
|
||||
}
|
||||
$model_post->platform_status_title = ModelPost::LIST_POST_PLATFORM_STATUS[$model_post->platform_status];
|
||||
}
|
||||
|
||||
View::assign('list', $list);
|
||||
View::assign('platform_type', $platform_type);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user