96 lines
2.5 KiB
PHP
96 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace app\manystore\model\school\classes\order;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class OrderLog extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'school_classes_order_log';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'int';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'status_text',
|
|
'before_status_text',
|
|
'server_status_text',
|
|
'result_status_text'
|
|
];
|
|
|
|
|
|
|
|
public function getStatusList()
|
|
{
|
|
return ['-3' => __('Status -3'), '0' => __('Status 0'), '3' => __('Status 3'), '6' => __('Status 6'), '9' => __('Status 9')];
|
|
}
|
|
|
|
public function getBeforeStatusList()
|
|
{
|
|
return ['-3' => __('Before_status -3'), '0' => __('Before_status 0'), '3' => __('Before_status 3'), '6' => __('Before_status 6'), '9' => __('Before_status 9')];
|
|
}
|
|
|
|
public function getServerStatusList()
|
|
{
|
|
return ['0' => __('Server_status 0'), '3' => __('Server_status 3'), '6' => __('Server_status 6')];
|
|
}
|
|
|
|
public function getResultStatusList()
|
|
{
|
|
return ['0' => __('Result_status 0'), '3' => __('Result_status 3'), '6' => __('Result_status 6')];
|
|
}
|
|
|
|
|
|
public function getStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
|
$list = $this->getStatusList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getBeforeStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['before_status']) ? $data['before_status'] : '');
|
|
$list = $this->getBeforeStatusList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getServerStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['server_status']) ? $data['server_status'] : '');
|
|
$list = $this->getServerStatusList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getResultStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['result_status']) ? $data['result_status'] : '');
|
|
$list = $this->getResultStatusList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
|
|
|
|
public function schoolclassesorder()
|
|
{
|
|
return $this->belongsTo('app\manystore\model\SchoolClassesOrder', 'classes_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
|
}
|
|
}
|