__('Order_type 0'), '1' => __('Order_type 1')]; } public function getOrderStatusList() { return ['0' => __('Order_status 0'), '10' => __('Order_status 10'), '20' => __('Order_status 20'), '30' => __('Order_status 30'), '40' => __('Order_status 40'), '50' => __('Order_status 50')]; } public function getOrderTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['order_type']) ? $data['order_type'] : ''); $list = $this->getOrderTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getOrderStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['order_status']) ? $data['order_status'] : ''); $list = $this->getOrderStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getAutoCancelTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['auto_cancel_time']) ? $data['auto_cancel_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setAutoCancelTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function orderGoods(): \think\model\relation\HasMany { return $this->hasMany('app\common\model\order\Goods', 'order_no', 'order_no'); } public function orderPayment(): \think\model\relation\HasMany { return $this->hasMany('app\common\model\order\Payment', 'order_no', 'order_no'); } public function Demand() { return $this->belongsTo('Demands', 'parent_order_no', 'parent_order_no'); } public function orderShip(): \think\model\relation\HasOne { return $this->hasOne('app\common\model\order\Ships', 'order_no', 'order_no'); } }