53 lines
1.0 KiB
PHP
53 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace app\manystore\model\school\classes;
|
||
|
|
||
|
use think\Model;
|
||
|
|
||
|
|
||
|
class VirtualUser extends Model
|
||
|
{
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
// 表名
|
||
|
protected $name = 'school_virtual_user';
|
||
|
|
||
|
// 自动写入时间戳字段
|
||
|
protected $autoWriteTimestamp = false;
|
||
|
|
||
|
// 定义时间戳字段名
|
||
|
protected $createTime = false;
|
||
|
protected $updateTime = false;
|
||
|
protected $deleteTime = false;
|
||
|
|
||
|
// 追加属性
|
||
|
protected $append = [
|
||
|
'time_text'
|
||
|
];
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public function getTimeTextAttr($value, $data)
|
||
|
{
|
||
|
$value = $value ? $value : (isset($data['time']) ? $data['time'] : '');
|
||
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||
|
}
|
||
|
|
||
|
protected function setTimeAttr($value)
|
||
|
{
|
||
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||
|
}
|
||
|
|
||
|
|
||
|
public function schoolclasseslib()
|
||
|
{
|
||
|
return $this->belongsTo('app\manystore\model\SchoolClassesLib', 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||
|
}
|
||
|
}
|