You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
60 lines
1.2 KiB
<?php
|
|
|
|
namespace app\admin\model\wanlshop\store;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class Order extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'wanlshop_store_order';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'integer';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'createtime';
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'paytime_text',
|
|
'status_text'
|
|
];
|
|
|
|
|
|
|
|
public function getStatusList()
|
|
{
|
|
return ['1' => __('Status 1')];
|
|
}
|
|
|
|
|
|
public function getPaytimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['paytime']) ? $data['paytime'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
|
$list = $this->getStatusList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
protected function setPaytimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
|
|
}
|
|
|