mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-04 00:24:29 +08:00
增加通用开头功能
This commit is contained in:
@@ -20,6 +20,7 @@ use think\Paginator;
|
||||
*/
|
||||
class Post extends Base
|
||||
{
|
||||
use SoftDelete;
|
||||
//
|
||||
|
||||
public static $autoClearCache = [
|
||||
@@ -37,8 +38,6 @@ class Post extends Base
|
||||
1 => '发布'
|
||||
];
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
public function categorys()
|
||||
@@ -101,8 +100,8 @@ class Post extends Base
|
||||
|
||||
public function getDescAttr($value)
|
||||
{
|
||||
if(empty($value)){
|
||||
|
||||
if(empty($value)) {
|
||||
|
||||
}
|
||||
|
||||
return $value;
|
||||
@@ -208,4 +207,19 @@ class Post extends Base
|
||||
|
||||
return $share_text;
|
||||
}
|
||||
}
|
||||
|
||||
public function getStartContentAttr()
|
||||
{
|
||||
$start_content = '';
|
||||
|
||||
$list_post_category_id = $this->getAttr('categorys')->column('category_id');
|
||||
|
||||
$list_start_post = Post::where('category_id', 'in', $list_post_category_id)->cache(600)->where('status', 1)->select();
|
||||
|
||||
foreach ($list_start_post as $k_start_post => $v_start_post) {
|
||||
$start_content .= $v_start_post->content_html;
|
||||
}
|
||||
|
||||
return $start_content;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user