diff --git a/Library/Controller/Invite.php b/Library/Controller/Invite.php index d9abb1fa..e5094d20 100644 --- a/Library/Controller/Invite.php +++ b/Library/Controller/Invite.php @@ -41,12 +41,12 @@ public function create() $result = array( 'error' => 0, 'message' => '创建邀请码成功,刷新后可见', - 'invite_num' => $user->invite_num -1, + 'invite_num' => $user->invite_num - 1, 'invite' => $invite ); + $user->invite_num = $user->invite_num - 1; + $user->save(); } - $user->invite_num = $user->invite_num -1; - $user->save(); return $result; } diff --git a/Template/Default/panel/invite.htm b/Template/Default/panel/invite.htm index 5ace6a5d..40725470 100644 --- a/Template/Default/panel/invite.htm +++ b/Template/Default/panel/invite.htm @@ -77,6 +77,8 @@

注意!

$(document).ready(function(){ $(".invitec").click(function(){ showToastr("生成邀请码中..", 0, 2000); + var btn = $(this); + btn.attr('disabled', 'disabled'); $.ajax({ type:"GET", url:"/invite/create.json", @@ -94,17 +96,16 @@

注意!

$("#invitec_num2").html(data.invite_num); if(data.invite != null) { - $("#data-tbody").append(''+ $("#data-tbody").children("tr").length +''+data.invite.invite+'可用'); } - } else { showToastr(data.message, 0, 5000, '错误'); } - + btn.removeAttr('disabled'); }, error:function(jqXHR){ showToastr("发生错误:"+jqXHR.status, 0); + btn.removeAttr('disabled'); } }) });