| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\admin\model\ps;
- use app\common\library\ps\HomePage;
- use think\Model;
- class Home_block extends Model
- {
- protected $name = 'ps_home_block';
- protected $autoWriteTimestamp = 'integer';
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $append = ['status_text', 'type_text'];
- public function getTypeList()
- {
- return HomePage::typeList();
- }
- public function getStatusList()
- {
- return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
- }
- public function getStatusTextAttr($value, $data)
- {
- $value = $value ?: ($data['status'] ?? '');
- $list = $this->getStatusList();
- return $list[$value] ?? '';
- }
- public function getTypeTextAttr($value, $data)
- {
- $value = $value ?: ($data['type'] ?? '');
- $list = $this->getTypeList();
- return $list[$value] ?? $value;
- }
- }
|