mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
fix carbon addDays
This commit is contained in:
@@ -72,7 +72,7 @@ class BonusRepository extends BaseRepository
|
||||
$this->consumeUserBonus($user, $requireBonus, BonusLogs::BUSINESS_TYPE_BUY_MEDAL, "$comment(medal ID: {$medal->id})");
|
||||
$expireAt = null;
|
||||
if ($medal->duration > 0) {
|
||||
$expireAt = Carbon::now()->addDays($medal->duration)->toDateTimeString();
|
||||
$expireAt = Carbon::now()->addDays((int)$medal->duration)->toDateTimeString();
|
||||
}
|
||||
$user->medals()->attach([$medal->id => ['expire_at' => $expireAt, 'status' => UserMedal::STATUS_NOT_WEARING]]);
|
||||
if ($medal->inventory !== null) {
|
||||
@@ -116,7 +116,7 @@ class BonusRepository extends BaseRepository
|
||||
|
||||
$expireAt = null;
|
||||
if ($medal->duration > 0) {
|
||||
$expireAt = Carbon::now()->addDays($medal->duration)->toDateTimeString();
|
||||
$expireAt = Carbon::now()->addDays((int)$medal->duration)->toDateTimeString();
|
||||
}
|
||||
$msg = [
|
||||
'sender' => 0,
|
||||
|
||||
@@ -70,7 +70,7 @@ class MedalRepository extends BaseRepository
|
||||
}
|
||||
$expireAt = null;
|
||||
if ($duration > 0) {
|
||||
$expireAt = Carbon::now()->addDays($duration)->toDateTimeString();
|
||||
$expireAt = Carbon::now()->addDays(intval($duration))->toDateTimeString();
|
||||
}
|
||||
clear_user_cache($uid);
|
||||
return $user->medals()->attach([$medal->id => ['expire_at' => $expireAt, 'status' => UserMedal::STATUS_NOT_WEARING]]);
|
||||
|
||||
@@ -592,7 +592,7 @@ class UserRepository extends BaseRepository
|
||||
$operatorInfo = get_user_row($operatorId);
|
||||
$message['msg'] = nexus_trans('user.grant_props_notification.body', ['name' => $metaName, 'operator' => $operatorInfo['username'], 'duration' => $durationText], $locale);
|
||||
if (!empty($metaData['duration'])) {
|
||||
$metaData['deadline'] = now()->addDays($metaData['duration']);
|
||||
$metaData['deadline'] = now()->addDays((int)$metaData['duration']);
|
||||
}
|
||||
if ($allowMultiple) {
|
||||
//Allow multiple, just insert
|
||||
@@ -614,10 +614,10 @@ class UserRepository extends BaseRepository
|
||||
$log .= ", has duration: {$keyExistsUpdates['duration']}";
|
||||
if ($metaExists->deadline && $metaExists->deadline->gte(now())) {
|
||||
$log .= ", not expire";
|
||||
$keyExistsUpdates['deadline'] = $metaExists->deadline->addDays($keyExistsUpdates['duration']);
|
||||
$keyExistsUpdates['deadline'] = $metaExists->deadline->addDays((int)$keyExistsUpdates['duration']);
|
||||
} else {
|
||||
$log .= ", expired or not set";
|
||||
$keyExistsUpdates['deadline'] = now()->addDays($keyExistsUpdates['duration']);
|
||||
$keyExistsUpdates['deadline'] = now()->addDays((int)$keyExistsUpdates['duration']);
|
||||
}
|
||||
unset($keyExistsUpdates['duration']);
|
||||
} else {
|
||||
@@ -740,7 +740,7 @@ class UserRepository extends BaseRepository
|
||||
'invitee' => '',
|
||||
'hash' => $hash,
|
||||
'valid' => 0,
|
||||
'expired_at' => Carbon::now()->addDays($days),
|
||||
'expired_at' => Carbon::now()->addDays((int)$days),
|
||||
'created_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user