Skip to content

Commit

Permalink
Fix : invite bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Jun 4, 2016
1 parent e8eba06 commit 3f13cc4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Library/Controller/Invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3f13cc4

Please sign in to comment.