You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.2 KiB
80 lines
2.2 KiB
<?php
|
|
|
|
namespace app\admin\model\video;
|
|
|
|
use think\Model;
|
|
use traits\model\SoftDelete;
|
|
|
|
|
|
class Main extends Model
|
|
{
|
|
|
|
use SoftDelete;
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'video_main';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'integer';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = 'deletetime';
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'status_text',
|
|
'type_text',
|
|
'page_text',
|
|
'detail_text'
|
|
];
|
|
public function getStatusList()
|
|
{
|
|
return ['1' => "显示",'0'=>"隐藏"];
|
|
}
|
|
public function getTypeList()
|
|
{
|
|
return ['1'=>'语文','2'=>'数学','3'=>'地理','4'=>'英语','5'=>'物理','6'=>'语文','7'=>'其他'];
|
|
}
|
|
public function getPageList()
|
|
{
|
|
return ['1'=>'第一章','2'=>'第二章','3'=>'第三章','4'=>'第四章','5'=>'第五章','6'=>'第六章','7'=>'第七章'];
|
|
}
|
|
public function getDetailList()
|
|
{
|
|
return ['1'=>'第一课','2'=>'第二课','3'=>'第三课','4'=>'第四课','5'=>'第五课','6'=>'第六课','7'=>'第七课'];
|
|
}
|
|
public function getStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
|
$list = $this->getStatusList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
public function getTypeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['class_type']) ? $data['class_type'] : '');
|
|
$list = $this->getTypeList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
public function getPageTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['class_type']) ? $data['class_type'] : '');
|
|
$list = $this->getPageList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
public function getDetailTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['class_detail']) ? $data['class_detail'] : '');
|
|
$list = $this->getDetailList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|