__('Ordertype 1'), '2' => __('Ordertype 2'), '3' => __('Ordertype 3')]; } public function getStatusList() { return ['1' => __('Status 1'),'2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4')]; } public function getPaytypeList() { return ['1' => __('Paytype 1'), '2' => __('Paytype 2'), '3' => __('Paytype 3')]; } public function getOrdertypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['ordertype']) ? $data['ordertype'] : ''); $list = $this->getOrdertypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getServerTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['server_time']) ? $data['server_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getPackageEndtimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['package_endtime']) ? $data['package_endtime'] : ''); 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] : ''; } public function getPayTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['pay_time']) ? $data['pay_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getPaytypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['paytype']) ? $data['paytype'] : ''); $list = $this->getPaytypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getHexiaoTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['hexiao_time']) ? $data['hexiao_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getCancelTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['cancel_time']) ? $data['cancel_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getFinishTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['finish_time']) ? $data['finish_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setServerTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setPackageEndtimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setPayTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setHexiaoTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setCancelTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setFinishTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function company() { return $this->belongsTo('Company', 'company_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function staff() { return $this->belongsTo('app\admin\model\CompanyStaff', 'staff_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function user() { return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function preorder() { return $this->belongsTo('app\admin\model\Preorder', 'pre_order_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function servicetype() { return $this->belongsTo('Servicetype', 'servicetype_id', 'id', [], 'LEFT')->setEagerlyType(0); } }