'integer', 'activity_id' => 'integer', 'reward_status' => 'integer', 'completion_status' => 'integer', 'participate_time' => 'datetime', 'completion_time' => 'datetime', ]; /** * 获取关联的活动 * * @return BelongsTo */ public function activity(): BelongsTo { return $this->belongsTo(ActivityConfig::class, 'activity_id', 'id'); } /** * 获取奖励状态名称 * * @return string */ public function getRewardStatusName(): string { return REWARD_STATUS::getName($this->reward_status); } /** * 获取完成状态名称 * * @return string */ public function getCompletionStatusName(): string { return PARTICIPATION_STATUS::getName($this->completion_status); } /** * 检查是否已完成 * * @return bool */ public function isCompleted(): bool { return $this->completion_status === PARTICIPATION_STATUS::COMPLETED->value; } /** * 检查是否进行中 * * @return bool */ public function isInProgress(): bool { return $this->completion_status === PARTICIPATION_STATUS::IN_PROGRESS->value; } /** * 检查是否已失败 * * @return bool */ public function isFailed(): bool { return $this->completion_status === PARTICIPATION_STATUS::FAILED->value; } /** * 检查奖励是否已领取 * * @return bool */ public function isRewardClaimed(): bool { return $this->reward_status === REWARD_STATUS::CLAIMED->value; } /** * 检查奖励是否未领取 * * @return bool */ public function isRewardNotClaimed(): bool { return $this->reward_status === REWARD_STATUS::NOT_CLAIMED->value; } /** * 检查奖励是否已过期 * * @return bool */ public function isRewardExpired(): bool { return $this->reward_status === REWARD_STATUS::EXPIRED->value; } }