作者 王智

222

... ... @@ -25,7 +25,7 @@ class Order extends Backend
$this->model = new \app\admin\model\Order;
$this->view->assign("orderStatusList", $this->model->getOrderStatusList());
$this->view->assign("invoiceStatusList", $this->model->getInvoiceStatusList());
$this->view->assign("ispay", $this->model->getIspay());
$this->view->assign("ispayList", $this->model->getIspay());
}
/**
... ...
... ... @@ -23,7 +23,7 @@ return [
'Invoice_status 1' => '待开票',
'Invoice_status 2' => '开票中',
'Invoice_status 3' => '已开票',
'ispay 0' => '未支付',
'ispay 1' => '已支付',
'Ispay 0' => '未支付',
'Ispay 1' => '已支付',
'User.username' => '下单用户'
];
... ...
... ... @@ -8,13 +8,10 @@ use think\Model;
class Order extends Model
{
// 表名
protected $name = 'order';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
... ... @@ -28,9 +25,8 @@ class Order extends Model
'order_status_text',
'invoice_status_text'
];
public function getOrderStatusList()
{
return ['0' => __('Order_status 0'), '1' => __('Order_status 1'), '2' => __('Order_status 2'), '3' => __('Order_status 3')];
... ... @@ -46,6 +42,14 @@ class Order extends Model
return ['0' => __('Ispay 0'), '1' => __('Ispay 1')];
}
public function getIspayTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['ispay']) ? $data['ispay'] : '');
$list = $this->getIspay();
return isset($list[$value]) ? $list[$value] : '';
}
public function getOrderStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['order_status']) ? $data['order_status'] : '');
... ... @@ -62,8 +66,6 @@ class Order extends Model
}
public function user()
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
... ...