__('Sourcetype tb'), 'jd' => __('Sourcetype jd'), 'pdd' => __('Sourcetype pdd'), 'wph' => __('Sourcetype wph'), 'tm' => __('Sourcetype tm')]; } public function getFactionList() { return ['t' => __('Faction t'), 'j' => __('Faction j'), 'p' => __('Faction p'), 'w' => __('Faction w')]; } public function getSourcetypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['sourceType']) ? $data['sourceType'] : ''); $list = $this->getSourcetypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getFactionTextAttr($value, $data) { $value = $value ? $value : (isset($data['faction']) ? $data['faction'] : ''); $list = $this->getFactionList(); return isset($list[$value]) ? $list[$value] : ''; } public function getBrowseTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['browse_time']) ? $data['browse_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getDeleteTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['delete_time']) ? $data['delete_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setBrowseTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setDeleteTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function user() { return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } }