xo_kf/application/admin/model/JunkaReject.php

62 lines
1.2 KiB
PHP

<?php
namespace app\admin\model;
use think\Model;
class JunkaReject extends Model
{
// 表名
protected $name = 'junka_reject';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'status_text'
];
public function getStatusList()
{
return [0 => __('未审核'),1 => __('通过'), 2 => __('拒绝')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getCreatetimeAttr($value, $data)
{
return $value ? date('Y-m-d H:i:s', $value):$value;
}
public function purchcardlog()
{
return $this->hasOne('JunkaPurchcardLog', 'id', 'purchcard_log_id')->setEagerlyType(1);
}
public function store()
{
return $this->hasOne('JunkaStore', 'id', 'store_id')->setEagerlyType(1);
}
}