diff --git a/app/Caches/ModerationStat.php b/app/Caches/ModerationStat.php deleted file mode 100644 index 55fa8112..00000000 --- a/app/Caches/ModerationStat.php +++ /dev/null @@ -1,44 +0,0 @@ -lifetime; - } - - public function getKey($id = null) - { - return 'moderation_stat'; - } - - public function getContent($id = null) - { - $statRepo = new StatRepo(); - - $articleCount = $statRepo->countPendingArticles(); - $questionCount = $statRepo->countPendingQuestions(); - $answerCount = $statRepo->countPendingAnswers(); - $commentCount = $statRepo->countPendingComments(); - - return [ - 'article_count' => $articleCount, - 'question_count' => $questionCount, - 'answer_count' => $answerCount, - 'comment_count' => $commentCount, - ]; - } - -} diff --git a/app/Console/Tasks/MaintainTask.php b/app/Console/Tasks/MaintainTask.php index dc67e75f..1c767d06 100644 --- a/app/Console/Tasks/MaintainTask.php +++ b/app/Console/Tasks/MaintainTask.php @@ -10,7 +10,7 @@ namespace App\Console\Tasks; use App\Http\Admin\Services\Setting as SettingService; use App\Library\Utils\Password as PasswordUtil; use App\Models\ChapterVod as ChapterVodModel; -use App\Services\Utils\IndexCourseCache as IndexCourseCacheUtil; +use App\Services\Utils\IndexPageCache as IndexPageCacheUtil; use App\Validators\Account as AccountValidator; class MaintainTask extends Task @@ -26,7 +26,7 @@ class MaintainTask extends Task { $section = $params[0] ?? null; - $util = new IndexCourseCacheUtil(); + $util = new IndexPageCacheUtil(); $util->rebuild($section); @@ -64,34 +64,6 @@ class MaintainTask extends Task echo '------ reset password success ------' . PHP_EOL; } - /** - * 关闭验证码 - * - * @command: php console.php maintain disable_captcha - */ - public function disableCaptchaAction() - { - $service = new SettingService(); - - $service->updateSettings('captcha', ['enabled' => 0]); - - echo '------ disable captcha success ------' . PHP_EOL; - } - - /** - * 启用验证码 - * - * @command: php console.php maintain enable_captcha - */ - public function enableCaptchaAction() - { - $service = new SettingService(); - - $service->updateSettings('captcha', ['enabled' => 1]); - - echo '------ enable captcha success ------' . PHP_EOL; - } - /** * 关闭站点 * diff --git a/app/Validators/Account.php b/app/Validators/Account.php index 7daec3fd..4725f2c2 100644 --- a/app/Validators/Account.php +++ b/app/Validators/Account.php @@ -39,7 +39,7 @@ class Account extends Validator $account = $accountRepo->findById($name); } - if (!$account || $account->deleted == 1) { + if (!$account) { throw new BadRequestException('account.not_found'); } diff --git a/app/Validators/Category.php b/app/Validators/Category.php index d2caebe0..662844aa 100644 --- a/app/Validators/Category.php +++ b/app/Validators/Category.php @@ -137,7 +137,7 @@ class Category extends Validator return $status; } - public function checkDeleteAbility($category) + public function checkDeleteAbility(CategoryModel $category) { $categoryRepo = new CategoryRepo(); diff --git a/app/Validators/Comment.php b/app/Validators/Comment.php index 0026cbb9..8d353ebf 100644 --- a/app/Validators/Comment.php +++ b/app/Validators/Comment.php @@ -42,19 +42,6 @@ class Comment extends Validator return $comment; } - public function checkToUser($userId) - { - $userRepo = new UserRepo(); - - $user = $userRepo->findById($userId); - - if (!$user) { - throw new BadRequestException('comment.to_user_not_found'); - } - - return $user; - } - public function checkItem($itemId, $itemType) { if (!array_key_exists($itemType, CommentModel::itemTypes())) { diff --git a/app/Validators/CourseUser.php b/app/Validators/CourseUser.php index 1642733e..53a6a97f 100644 --- a/app/Validators/CourseUser.php +++ b/app/Validators/CourseUser.php @@ -15,19 +15,6 @@ use App\Repos\CourseUser as CourseUserRepo; class CourseUser extends Validator { - public function checkRelation($id) - { - $courseUserRepo = new CourseUserRepo(); - - $courseUser = $courseUserRepo->findById($id); - - if (!$courseUser) { - throw new BadRequestException('course_user.not_found'); - } - - return $courseUser; - } - public function checkCourseUser($courseId, $userId) { $repo = new CourseUserRepo(); diff --git a/app/Validators/Nav.php b/app/Validators/Nav.php index bea1b5cc..1d34ad3f 100644 --- a/app/Validators/Nav.php +++ b/app/Validators/Nav.php @@ -116,7 +116,7 @@ class Nav extends Validator return $status; } - public function checkDeleteAbility($nav) + public function checkDeleteAbility(NavModel $nav) { $navRepo = new NavRepo(); diff --git a/config/errors.php b/config/errors.php index cc7c3359..7b94647c 100644 --- a/config/errors.php +++ b/config/errors.php @@ -160,7 +160,6 @@ $error['answer.delete_not_allowed'] = '当前不允许删除回答'; */ $error['comment.not_found'] = '评论不存在'; $error['comment.parent_not_found'] = '上级评论不存在'; -$error['comment.to_user_not_found'] = '回复用户不存在'; $error['comment.invalid_item_type'] = '无效的条目类型'; $error['comment.invalid_publish_status'] = '无效的发布状态'; $error['comment.invalid_reject_reason'] = '无效的拒绝理由';