This commit is contained in:
你的名字
2025-10-15 14:53:54 +08:00
commit ac0f12b21a
864 changed files with 200931 additions and 0 deletions

View File

@ -0,0 +1,42 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 有关时间的模型
* Class TimeModel
* @package app\common\model
*/
class TimeModel extends Model
{
public array $statusText = [
1 => '启用',
-1 => '禁用',
0 => '未启用',
];
/**
* 软删除
*/
use SoftDelete;
protected function getOptions(): array
{
return [
'autoWriteTimestamp' => true,
'createTime' => 'create_time',
'updateTime' => 'update_time',
'deleteTime' => false,
];
}
public function getStatusTextAttr($value): string
{
return $this->statusText[$value] ?? '未知状态';
}
}