DiverseYouthNightSchool/application/manystore/model/school/classes/hourorder/OrderLog.php

54 lines
1.1 KiB
PHP

<?php
namespace app\manystore\model\school\classes\hourorder;
use think\Model;
class OrderLog extends Model
{
// 表名
protected $name = 'school_classes_hour_order_log';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
'status_text'
];
public function getStatusList()
{
return ['-3' => __('Status -3'),'-1' => __('Status -1'), '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 schoolclasseshourorder()
{
return $this->belongsTo('app\manystore\model\SchoolClassesHourOrder', 'classes_hour_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}