enhance performance of ajax sign responce
This commit is contained in:
parent
ef227b1045
commit
cda005d5d6
|
|
@ -28,9 +28,10 @@ class UserController extends BaseController
|
||||||
{
|
{
|
||||||
if ($aquired_score = $this->user->sign()) {
|
if ($aquired_score = $this->user->sign()) {
|
||||||
View::json([
|
View::json([
|
||||||
'errno' => 0,
|
'errno' => 0,
|
||||||
'msg' => '签到成功,获得了 '.$aquired_score.' 积分~',
|
'msg' => '签到成功,获得了 '.$aquired_score.' 积分~',
|
||||||
'score' => $this->user->getScore()
|
'score' => $this->user->getScore(),
|
||||||
|
'remaining_time' => $this->user->canSign(true)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
View::json($this->user->canSign(true).' 小时后才能再次签到哦~', 1);
|
View::json($this->user->canSign(true).' 小时后才能再次签到哦~', 1);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author: printempw
|
* @Author: printempw
|
||||||
* @Date: 2016-07-16 10:02:24
|
* @Date: 2016-07-16 10:02:24
|
||||||
* @Last Modified by: printempw
|
* @Last Modified by: printempw
|
||||||
* @Last Modified time: 2016-07-23 15:23:31
|
* @Last Modified time: 2016-07-24 12:28:52
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
@ -497,7 +497,8 @@ function sign() {
|
||||||
if (json.errno == 0) {
|
if (json.errno == 0) {
|
||||||
toastr.success(json.msg);
|
toastr.success(json.msg);
|
||||||
$('#score').html(json.score);
|
$('#score').html(json.score);
|
||||||
$('#sign-button').attr('disabled', 'disabled').html('<i class="fa fa-calendar-check-o" aria-hidden="true"></i> 24 小时后可签到');
|
var dom = '<i class="fa fa-calendar-check-o"></i> '+json.remaining_time+' 小时后可签到';
|
||||||
|
$('#sign-button').attr('disabled', 'disabled').html(dom);
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(json.msg);
|
toastr.warning(json.msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user