mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 02:52:49 +08:00
完成内容管理
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
@@ -10,5 +11,13 @@ use think\Model;
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
//
|
||||
//
|
||||
|
||||
public static function getListLevel()
|
||||
{
|
||||
$model_list = Category::select();
|
||||
|
||||
// return $model_list;
|
||||
return array2level($model_list,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,38 @@ class Post extends Model
|
||||
use SoftDelete;
|
||||
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
public function categorys()
|
||||
{
|
||||
return $this->hasMany(PostCategory::class,'post_id');
|
||||
}
|
||||
|
||||
public function tags()
|
||||
{
|
||||
return $this->hasMany(PostTag::class,'post_id');
|
||||
}
|
||||
|
||||
public function setPubishTimeAttr($value)
|
||||
{
|
||||
return strtotime($value);
|
||||
}
|
||||
|
||||
public function setContentAttr($value)
|
||||
{
|
||||
return json_encode($value);
|
||||
}
|
||||
|
||||
public function getContentAttr($value)
|
||||
{
|
||||
return json_decode($value,true);
|
||||
}
|
||||
|
||||
public function getPosterAttr($value)
|
||||
{
|
||||
if(empty($value)){
|
||||
$value = '/static/images/avatar.jpeg';
|
||||
}
|
||||
|
||||
return get_source_link($value);
|
||||
}
|
||||
}
|
||||
|
||||
14
app/model/PostCategory.php
Normal file
14
app/model/PostCategory.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class PostCategory extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
14
app/model/PostTag.php
Normal file
14
app/model/PostTag.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class PostTag extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
@@ -10,5 +11,6 @@ use think\Model;
|
||||
*/
|
||||
class Tag extends Model
|
||||
{
|
||||
//
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user