Files
webman-buildadmin/app/common/model/OperationNotice.php

41 lines
861 B
PHP

<?php
namespace app\common\model;
use support\think\Model;
class OperationNotice extends Model
{
protected $name = 'operation_notice';
protected $autoWriteTimestamp = true;
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'publish_at' => 'integer',
'notice_type' => 'integer',
'status' => 'integer',
];
public function setPublishAtAttr($value)
{
if ($value === null || $value === '') {
return 0;
}
if (is_int($value)) {
return $value;
}
if (is_string($value)) {
if (ctype_digit($value)) {
return (int) $value;
}
$ts = strtotime($value);
if ($ts !== false) {
return $ts;
}
}
return 0;
}
}