mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
Show precision time when sign remaining time is less than 1 hour
This commit is contained in:
parent
cb2ce86aae
commit
a2edc469ac
@ -74,13 +74,22 @@ class UserController extends Controller
|
||||
'msg' => trans('user.sign-success', ['score' => $acuiredScore]),
|
||||
'score' => $this->user->getScore(),
|
||||
'storage' => $this->calculatePercentageUsed($this->user->getStorageUsed(), option('score_per_storage')),
|
||||
'remaining_time' => round($this->user->getSignRemainingTime() / 3600)
|
||||
'remaining_time' => $this->getUserSignRemainingTimeWithPrecision()
|
||||
]);
|
||||
} else {
|
||||
return json(trans('user.cant-sign-until', ['time' => round($this->user->getSignRemainingTime() / 3600)]), 1);
|
||||
return json(trans('user.cant-sign-until', [
|
||||
'time' => $this->getUserSignRemainingTimeWithPrecision()
|
||||
]), 1);
|
||||
}
|
||||
}
|
||||
|
||||
public function getUserSignRemainingTimeWithPrecision()
|
||||
{
|
||||
$hours = $this->user->getSignRemainingTime() / 3600;
|
||||
|
||||
return round($hours) ?: round($hours, 1);
|
||||
}
|
||||
|
||||
public function profile()
|
||||
{
|
||||
return view('user.profile')->with('user', $this->user);
|
||||
|
2
plugins
2
plugins
@ -1 +1 @@
|
||||
Subproject commit b4eeec21d9ae5b36d2978b389830ae0f9f4dddcf
|
||||
Subproject commit 56e0b405985bdc843ec42be80f82a213e2d21198
|
@ -75,7 +75,9 @@
|
||||
</button>
|
||||
@else
|
||||
<button class="btn btn-primary pull-left" title="{{ trans('user.last-sign', ['time' => $user->getLastSignTime()]) }}" disabled="disabled">
|
||||
<i class="fa fa-calendar-check-o" aria-hidden="true"></i> {{ trans('user.sign-remain-time', ['time' => round($user->getSignRemainingTime() / 3600)]) }}
|
||||
<i class="fa fa-calendar-check-o" aria-hidden="true"></i>
|
||||
<?php $hours = $user->getSignRemainingTime() / 3600; ?>
|
||||
{{ trans('user.sign-remain-time', ['time' => round($hours) ?: round($hours, 1)]) }}
|
||||
</button>
|
||||
@endif
|
||||
</div><!-- /.box-footer -->
|
||||
|
Loading…
Reference in New Issue
Block a user