',0)->column('id,name'); return $all_type; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type_id']) ? $data['type_id'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getStatusList() { return ['0' => __('进行中'), '1' => __('已办结')]; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getVisittimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['visittime']) ? $data['visittime'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setVisittimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function visittype() { return $this->belongsTo('Visittype', 'type_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function user() { return $this->belongsTo('User', 'user4s_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function admin() { return $this->belongsTo('app\common\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0); } }