revert User::getDonateStatusAttribute()

This commit is contained in:
xiaomlove
2022-05-31 01:10:20 +08:00
parent 86bc9f136a
commit cf11dc33e0
3 changed files with 29 additions and 15 deletions

View File

@@ -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 序列化准备日期。
*

View File

@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.13');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-05-30');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-05-31');
defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");

View File

@@ -543,22 +543,22 @@ if (count($updateset)) // Update only when there is change in peer counts
sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");
}
if($client_familyid != 0 && $client_familyid != $az['clientselect'])
$USERUPDATESET[] = "clientselect = ".sqlesc($client_familyid);
if(count($USERUPDATESET) && $userid)
{
/**
* 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($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);