68 lines
1.5 KiB
PHP
68 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace app\admin\model;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class Revisitorder extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'order';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = false;
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = false;
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'status_text',
|
|
'offline_amount_type_text'
|
|
];
|
|
|
|
|
|
|
|
public function getStatusList()
|
|
{
|
|
return ['0' => __('Status 0'), '10' => __('Status 10'), '20' => __('Status 20'), '30' => __('Status 30'), '40' => __('Status 40'), '50' => __('Status 50'), '60' => __('Status 60'), '-10' => __('Status -10')];
|
|
}
|
|
|
|
public function getOfflineAmountTypeList()
|
|
{
|
|
return ['1' => __('Offline_amount_type 1'), '2' => __('Offline_amount_type 2')];
|
|
}
|
|
|
|
|
|
public function getStatusTextAttr($value, $data)
|
|
{
|
|
$value = $value ?: ($data['status'] ?? '');
|
|
$list = $this->getStatusList();
|
|
return $list[$value] ?? '';
|
|
}
|
|
|
|
|
|
public function getOfflineAmountTypeTextAttr($value, $data)
|
|
{
|
|
$value = $value ?: ($data['offline_amount_type'] ?? '');
|
|
$list = $this->getOfflineAmountTypeList();
|
|
return $list[$value] ?? '';
|
|
}
|
|
|
|
|
|
|
|
|
|
public function review()
|
|
{
|
|
return $this->belongsTo('app\admin\model\order\Review', 'revisit_id', 'order_id', [], 'LEFT')->setEagerlyType(0);
|
|
}
|
|
}
|