From 3f13cc4494b2549505717f5c322647128d708f68 Mon Sep 17 00:00:00 2001 From: Sendya <18x@loacg.com> Date: Sun, 5 Jun 2016 00:20:11 +0800 Subject: [PATCH] Fix : invite bug --- Library/Controller/Invite.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Controller/Invite.php b/Library/Controller/Invite.php index 8e7be725..e3542f10 100644 --- a/Library/Controller/Invite.php +++ b/Library/Controller/Invite.php @@ -35,15 +35,19 @@ public function create() $user = User::getUserByUserId(User::getCurrent()->uid); $result = array('error' => 1, 'message' => '创建邀请码失败,您没有再次创建邀请码的次数了。当然,你可以用流量购买次数。(10GB/个)'); + $user->invite_num = $user->invite_num -1; + if ($user->invite_num > 0) { $invite = InviteModel::addInvite($user->uid, 'A'); $result = array( 'error' => 0, 'message' => '创建邀请码成功,刷新后可见', - 'invite_num' => $user->invite_num - 1, + 'invite_num' => $user->invite_num, 'invite' => $invite ); } + $user->save(); + $_SESSION['currentUser'] = $user; return $result; }