__('Bus'), 'taxi' => __('Taxi')]; } public function getPaymentTypeList() { return ['ali' => __('Ali'), 'wechat' => __('Wechat'), 'balance' => __('Balance')]; } public function getStatusList() { return [ 'default' => __('Default'), 'purchase' => __('Purchase'), 'proceed' => __('Proceed'), 'finish' => __('Finish'), 'wait_feedback' => __('Wait_feedback'), 'cancel' => __('Cancel'), 'reject' => __('Reject'), 'admin_cancel' => __('Admin_cancel'), 'auto_cancel' => __('Auto_cancel'), ]; } public function getTripTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['trip_type']) ? $data['trip_type'] : ''); $list = $this->getTripTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getPaymentTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['payment_type']) ? $data['payment_type'] : ''); $list = $this->getPaymentTypeList(); return isset($list[$value]) ? $list[$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 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; } protected function setPayTimeAttr($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); } public function user() { return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function store() { return $this->belongsTo('app\admin\model\Store', 'store_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function massager() { return $this->belongsTo('app\admin\model\Massager', 'massager_id', 'id', [], 'LEFT')->setEagerlyType(0); } }