From cf11dc33e0a508e57c92cdc2eaa1ef98147457b2 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Tue, 31 May 2022 01:10:20 +0800 Subject: [PATCH] revert User::getDonateStatusAttribute() --- app/Models/User.php | 14 ++++++++++++++ include/constants.php | 2 +- public/announce.php | 28 ++++++++++++++-------------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 51e83a94..8f85a709 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Http\Middleware\Locale; +use App\Repositories\ExamRepository; use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -94,6 +95,19 @@ class User extends Authenticatable return $classText; } + /** + * @see ExamRepository::isExamMatchUser() + * + * @return string + */ + public function getDonateStatusAttribute(): string + { + if ($this->isDonating()) { + return self::DONATE_YES; + } + return self::DONATE_NO; + } + /** * 为数组 / JSON 序列化准备日期。 * diff --git a/include/constants.php b/include/constants.php index 54f6a782..44a80ef0 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ $value) { - if (str_contains($value, 'downloaded')) { - unset($USERUPDATESET[$key]); - } +if($client_familyid != 0 && $client_familyid != $az['clientselect']) { + $USERUPDATESET[] = "clientselect = ".sqlesc($client_familyid); +} +/** + * VIP do not calculate downloaded + * @since 1.7.13 + */ +if ($az['class'] == UC_VIP) { + foreach ($USERUPDATESET as $key => $value) { + if (str_contains($value, 'downloaded')) { + unset($USERUPDATESET[$key]); } } +} +if(count($USERUPDATESET) && $userid) +{ sql_query("UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid); } benc_resp($rep_dict);