Rename sign in to sign
This commit is contained in:
parent
7d7b35f5fd
commit
3a74329548
|
|
@ -79,11 +79,11 @@ class AdminController extends Controller
|
||||||
|
|
||||||
})->handle();
|
})->handle();
|
||||||
|
|
||||||
$signIn = Option::form('sign_in', OptionForm::AUTO_DETECT, function($form)
|
$sign = Option::form('sign', OptionForm::AUTO_DETECT, function($form)
|
||||||
{
|
{
|
||||||
$form->group('sign_score')
|
$form->group('sign_score')
|
||||||
->text('sign_score_from')->addon(trans('options.sign_in.sign_score.addon1'))
|
->text('sign_score_from')->addon(trans('options.sign.sign_score.addon1'))
|
||||||
->text('sign_score_to')->addon(trans('options.sign_in.sign_score.addon2'));
|
->text('sign_score_to')->addon(trans('options.sign.sign_score.addon2'));
|
||||||
|
|
||||||
$form->group('sign_gap_time')->text('sign_gap_time')->addon();
|
$form->group('sign_gap_time')->text('sign_gap_time')->addon();
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ class AdminController extends Controller
|
||||||
'sign_score_to' => @explode(',', option('sign_score'))[1]
|
'sign_score_to' => @explode(',', option('sign_score'))[1]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return view('admin.score', ['forms' => compact('rate', 'signIn')]);
|
return view('admin.score', ['forms' => compact('rate', 'sign')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function options()
|
public function options()
|
||||||
|
|
|
||||||
|
|
@ -60,24 +60,24 @@ class UserController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle user signing in.
|
* Handle user signing.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function signIn()
|
public function sign()
|
||||||
{
|
{
|
||||||
if ($this->user->canSignIn()) {
|
if ($this->user->canSign()) {
|
||||||
$acuiredScore = $this->user->signIn();
|
$acuiredScore = $this->user->sign();
|
||||||
|
|
||||||
return json([
|
return json([
|
||||||
'errno' => 0,
|
'errno' => 0,
|
||||||
'msg' => trans('user.sign-in-success', ['score' => $acuiredScore]),
|
'msg' => trans('user.sign-success', ['score' => $acuiredScore]),
|
||||||
'score' => $this->user->getScore(),
|
'score' => $this->user->getScore(),
|
||||||
'storage' => $this->calculatePercentageUsed($this->user->getStorageUsed(), option('score_per_storage')),
|
'storage' => $this->calculatePercentageUsed($this->user->getStorageUsed(), option('score_per_storage')),
|
||||||
'remaining_time' => round($this->user->getSignInRemainingTime() / 3600)
|
'remaining_time' => round($this->user->getSignRemainingTime() / 3600)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
return json(trans('user.cant-sign-in-until', ['time' => round($this->user->getSignInRemainingTime() / 3600)]), 1);
|
return json(trans('user.cant-sign-until', ['time' => round($this->user->getSignRemainingTime() / 3600)]), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,13 +273,13 @@ class User extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign in for the user, return false if unavailable.
|
* Sign for the user, return false if unavailable.
|
||||||
*
|
*
|
||||||
* @return int|bool
|
* @return int|bool
|
||||||
*/
|
*/
|
||||||
public function signIn()
|
public function sign()
|
||||||
{
|
{
|
||||||
if ($this->canSignIn()) {
|
if ($this->canSign()) {
|
||||||
|
|
||||||
$scoreLimits = explode(',', option('sign_score'));
|
$scoreLimits = explode(',', option('sign_score'));
|
||||||
$acquiredScore = rand($scoreLimits[0], $scoreLimits[1]);
|
$acquiredScore = rand($scoreLimits[0], $scoreLimits[1]);
|
||||||
|
|
@ -299,18 +299,18 @@ class User extends Model
|
||||||
*
|
*
|
||||||
* @return int Time in seconds.
|
* @return int Time in seconds.
|
||||||
*/
|
*/
|
||||||
public function getSignInRemainingTime()
|
public function getSignRemainingTime()
|
||||||
{
|
{
|
||||||
// convert to timestamp
|
// convert to timestamp
|
||||||
$lastSignInTime = Carbon::parse($this->getLastSignInTime());
|
$lastSignTime = Carbon::parse($this->getLastSignTime());
|
||||||
|
|
||||||
if (option('sign_after_zero')) {
|
if (option('sign_after_zero')) {
|
||||||
return Carbon::now()->diffInSeconds(
|
return Carbon::now()->diffInSeconds(
|
||||||
(($lastSignInTime <= Carbon::today()) ? $lastSignInTime : Carbon::tomorrow())
|
(($lastSignTime <= Carbon::today()) ? $lastSignTime : Carbon::tomorrow())
|
||||||
, false);
|
, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Carbon::now()->diffInSeconds($lastSignInTime->addSeconds(option('sign_gap_time') * 3600), false);
|
return Carbon::now()->diffInSeconds($lastSignTime->addSeconds(option('sign_gap_time') * 3600), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -318,9 +318,9 @@ class User extends Model
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canSignIn()
|
public function canSign()
|
||||||
{
|
{
|
||||||
return ($this->getSignInRemainingTime() <= 0);
|
return ($this->getSignRemainingTime() <= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -328,7 +328,7 @@ class User extends Model
|
||||||
*
|
*
|
||||||
* @return string Formatted time string.
|
* @return string Formatted time string.
|
||||||
*/
|
*/
|
||||||
public function getLastSignInTime()
|
public function getLastSignTime()
|
||||||
{
|
{
|
||||||
return $this->last_sign_at;
|
return $this->last_sign_at;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
/* exported signIn */
|
/* exported sign */
|
||||||
|
|
||||||
function signIn() {
|
function sign() {
|
||||||
fetch({
|
fetch({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: url('user/sign-in'),
|
url: url('user/sign'),
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if (result.errno == 0) {
|
if (result.errno == 0) {
|
||||||
$('#score').html(result.score);
|
$('#score').html(result.score);
|
||||||
var dom = '<i class="fa fa-calendar-check-o"></i> ' + trans('user.signInRemainingTime', { time: String(result.remaining_time) });
|
var dom = '<i class="fa fa-calendar-check-o"></i> ' + trans('user.signRemainingTime', { time: String(result.remaining_time) });
|
||||||
$('#sign-in-button').attr('disabled', 'disabled').html(dom);
|
|
||||||
|
$('#sign-button').attr('disabled', 'disabled').html(dom);
|
||||||
|
|
||||||
if (result.storage.used > 1024) {
|
if (result.storage.used > 1024) {
|
||||||
$('#user-storage').html(`<b>${Math.round(result.storage.used)}</b>/ ${Math.round(result.storage.total)} MB`);
|
$('#user-storage').html(`<b>${Math.round(result.storage.used)}</b>/ ${Math.round(result.storage.total)} MB`);
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
deleteNotice: 'Are you sure to delete this texture?'
|
deleteNotice: 'Are you sure to delete this texture?'
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
signInRemainingTime: 'Available after :time hours',
|
signRemainingTime: 'Available after :time hours',
|
||||||
|
|
||||||
// Closet
|
// Closet
|
||||||
emptyClosetMsg: '<p>Nothing in your closet...</p><p>Why not explore the <a href=":url">Skin Library</a> for a while?</p>',
|
emptyClosetMsg: '<p>Nothing in your closet...</p><p>Why not explore the <a href=":url">Skin Library</a> for a while?</p>',
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ rate:
|
||||||
addon: scores = 1 player
|
addon: scores = 1 player
|
||||||
user_initial_score: User Initial Score
|
user_initial_score: User Initial Score
|
||||||
|
|
||||||
sign_in:
|
sign:
|
||||||
title: Signing In
|
title: Signing
|
||||||
|
|
||||||
sign_score:
|
sign_score:
|
||||||
title: Score Granted
|
title: Score Granted
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ used:
|
||||||
|
|
||||||
cur-score: Current Score
|
cur-score: Current Score
|
||||||
score-notice: Click the score to show introduction.
|
score-notice: Click the score to show introduction.
|
||||||
sign-in: Sign In
|
sign: Sign
|
||||||
sign-in-success: Signed in successfully. You got :score scores.
|
sign-success: Signed successfully. You got :score scores.
|
||||||
cant-sign-in-until: You can't sign in in :time hours
|
cant-sign-until: You can't sign in in :time hours
|
||||||
last-sign-in: Last signed in at :time
|
last-sign: Last signed at :time
|
||||||
sign-in-remain-time: Available after :time hours
|
sign-remain-time: Available after :time hours
|
||||||
announcement: Announcement
|
announcement: Announcement
|
||||||
|
|
||||||
score-intro:
|
score-intro:
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
deleteNotice: '真的要删除此材质吗?'
|
deleteNotice: '真的要删除此材质吗?'
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
signInRemainingTime: ':time 小时后可签到',
|
signRemainingTime: ':time 小时后可签到',
|
||||||
|
|
||||||
// Closet
|
// Closet
|
||||||
emptyClosetMsg: '<p>衣柜里啥都没有哦~</p><p>去<a href=":url">皮肤库</a>看看吧~</p>',
|
emptyClosetMsg: '<p>衣柜里啥都没有哦~</p><p>去<a href=":url">皮肤库</a>看看吧~</p>',
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ rate:
|
||||||
addon: 积分 = 一个角色
|
addon: 积分 = 一个角色
|
||||||
user_initial_score: 新用户默认积分
|
user_initial_score: 新用户默认积分
|
||||||
|
|
||||||
sign_in:
|
sign:
|
||||||
title: 签到配置
|
title: 签到配置
|
||||||
|
|
||||||
sign_score:
|
sign_score:
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ used:
|
||||||
|
|
||||||
cur-score: 当前积分
|
cur-score: 当前积分
|
||||||
score-notice: 点击积分查看说明
|
score-notice: 点击积分查看说明
|
||||||
sign-in: 每日签到
|
sign: 每日签到
|
||||||
sign-in-success: 签到成功,获得了 :score 积分~
|
sign-success: 签到成功,获得了 :score 积分~
|
||||||
cant-sign-in-until: :time 小时后才能再次签到哦~
|
cant-sign-until: :time 小时后才能再次签到哦~
|
||||||
last-sign-in: 上次签到于 :time
|
last-sign: 上次签到于 :time
|
||||||
sign-in-remain-time: :time 小时后可签到
|
sign-remain-time: :time 小时后可签到
|
||||||
announcement: 公告
|
announcement: 公告
|
||||||
|
|
||||||
score-intro:
|
score-intro:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{!! $forms['signIn']->render() !!}
|
{!! $forms['sign']->render() !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,13 @@
|
||||||
</div><!-- /.row -->
|
</div><!-- /.row -->
|
||||||
</div><!-- ./box-body -->
|
</div><!-- ./box-body -->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
@if ($user->canSignIn())
|
@if ($user->canSign())
|
||||||
<button id="sign-in-button" class="btn btn-primary pull-left" onclick="signIn()">
|
<button id="sign-button" class="btn btn-primary pull-left" onclick="sign()">
|
||||||
<i class="fa fa-calendar-check-o" aria-hidden="true"></i> {{ trans('user.sign-in') }}
|
<i class="fa fa-calendar-check-o" aria-hidden="true"></i> {{ trans('user.sign') }}
|
||||||
</button>
|
</button>
|
||||||
@else
|
@else
|
||||||
<button class="btn btn-primary pull-left" title="{{ trans('user.last-sign-in', ['time' => $user->getLastSignInTime()]) }}" disabled="disabled">
|
<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-in-remain-time', ['time' => round($user->getSignInRemainingTime() / 3600)]) }}
|
<i class="fa fa-calendar-check-o" aria-hidden="true"></i> {{ trans('user.sign-remain-time', ['time' => round($user->getSignRemainingTime() / 3600)]) }}
|
||||||
</button>
|
</button>
|
||||||
@endif
|
@endif
|
||||||
</div><!-- /.box-footer -->
|
</div><!-- /.box-footer -->
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ Route::group(['prefix' => 'auth'], function ()
|
||||||
Route::group(['middleware' => 'auth', 'prefix' => 'user'], function ()
|
Route::group(['middleware' => 'auth', 'prefix' => 'user'], function ()
|
||||||
{
|
{
|
||||||
Route::any ('', 'UserController@index');
|
Route::any ('', 'UserController@index');
|
||||||
Route::any ('/sign-in', 'UserController@signIn');
|
Route::any ('/sign', 'UserController@sign');
|
||||||
|
|
||||||
// Profile
|
// Profile
|
||||||
Route::get ('/profile', 'UserController@profile');
|
Route::get ('/profile', 'UserController@profile');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user