mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-03-07 15:16:40 +08:00
attempt to fix again
This commit is contained in:
parent
8255765ce4
commit
3ddb560e33
@ -92,15 +92,13 @@ class UserController extends Controller
|
|||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
if ($user->canSign()) {
|
if ($user->canSign()) {
|
||||||
$acquiredScore = $user->sign();
|
$acquiredScore = $user->sign();
|
||||||
$user->last_sign_at = get_datetime_string();
|
|
||||||
$user->save();
|
|
||||||
|
|
||||||
return json([
|
return json([
|
||||||
'errno' => 0,
|
'errno' => 0,
|
||||||
'msg' => trans('user.sign-success', ['score' => $acquiredScore]),
|
'msg' => trans('user.sign-success', ['score' => $acquiredScore]),
|
||||||
'score' => $user->getScore(),
|
'score' => $user->getScore(),
|
||||||
'storage' => $this->calculatePercentageUsed($user->getStorageUsed(), option('score_per_storage')),
|
'storage' => $this->calculatePercentageUsed($user->getStorageUsed(), option('score_per_storage')),
|
||||||
'remaining_time' => $this->getUserSignRemainingTimeWithPrecision()
|
'remaining_time' => $this->getUserSignRemainingTimeWithPrecision($user)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$remaining_time = $this->getUserSignRemainingTimeWithPrecision();
|
$remaining_time = $this->getUserSignRemainingTimeWithPrecision();
|
||||||
@ -113,9 +111,9 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserSignRemainingTimeWithPrecision()
|
public function getUserSignRemainingTimeWithPrecision($user = null)
|
||||||
{
|
{
|
||||||
$hours = Auth::user()->getSignRemainingTime() / 3600;
|
$hours = ($user ?? Auth::user())->getSignRemainingTime() / 3600;
|
||||||
|
|
||||||
return $hours > 1 ? round($hours) : $hours;
|
return $hours > 1 ? round($hours) : $hours;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user