54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace app\admin\model\school\classes\hourorder;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class OrderLog extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'school_classes_hour_order_log';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'integer';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'status_text'
|
|
];
|
|
|
|
|
|
|
|
public function getStatusList()
|
|
{
|
|
return ['-3' => __('Status -3'), '0' => __('Status 0'), '3' => __('Status 3')];
|
|
}
|
|
|
|
|
|
public function getStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
|
$list = $this->getStatusList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
|
|
|
|
public function order()
|
|
{
|
|
return $this->belongsTo('app\admin\model\school\classes\hour\Order', 'classes_hour_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
|
}
|
|
}
|