mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
add task
This commit is contained in:
@@ -36,6 +36,8 @@ class BonusLogs extends NexusModel
|
||||
const BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD = 17;
|
||||
const BUSINESS_TYPE_GIFT_MEDAL = 18;
|
||||
const BUSINESS_TYPE_BUY_TORRENT = 19;
|
||||
const BUSINESS_TYPE_TASK_NOT_PASS_DEDUCT = 20;
|
||||
const BUSINESS_TYPE_TASK_PASS_REWARD = 21;
|
||||
|
||||
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
|
||||
const BUSINESS_TYPE_TORRENT_BE_DOWNLOADED = 1001;
|
||||
|
||||
@@ -254,4 +254,32 @@ class Exam extends NexusModel
|
||||
throw new \RuntimeException("Invalid recurring: $recurring");
|
||||
}
|
||||
|
||||
public function getMessageSubjectTransKey(string $result): string
|
||||
{
|
||||
return match ($this->type) {
|
||||
self::TYPE_EXAM => "exam.checkout_{$result}_message_subject_for_exam",
|
||||
self::TYPE_TASK => "exam.checkout_{$result}_message_subject_for_task",
|
||||
default => throw new \RuntimeException("Invalid type: " . $this->type)
|
||||
};
|
||||
}
|
||||
|
||||
public function getMessageContentTransKey(string $result): string
|
||||
{
|
||||
return match ($this->type) {
|
||||
self::TYPE_EXAM => "exam.checkout_{$result}_message_content_for_exam",
|
||||
self::TYPE_TASK => "exam.checkout_{$result}_message_content_for_task",
|
||||
default => throw new \RuntimeException("Invalid type: " . $this->type)
|
||||
};
|
||||
}
|
||||
|
||||
public function isTypeExam(): bool
|
||||
{
|
||||
return $this->type == self::TYPE_EXAM;
|
||||
}
|
||||
|
||||
public function isTypeTask(): bool
|
||||
{
|
||||
return $this->type == self::TYPE_TASK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -514,6 +514,11 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
return $this->hasMany(UserPermission::class, 'uid');
|
||||
}
|
||||
|
||||
public function examAndTasks(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Exam::class, "exam_users", "uid", "exam_id");
|
||||
}
|
||||
|
||||
public function getAvatarAttribute($value)
|
||||
{
|
||||
if ($value) {
|
||||
|
||||
Reference in New Issue
Block a user