|
@@ -1068,11 +1068,15 @@ class UserCenter extends Common
|
|
|
throw new Exception('参数错误');
|
|
|
}
|
|
|
$where['invite_no'] = $inviteNo;
|
|
|
- $userField = 'id,invite_no';
|
|
|
+ $userField = 'id,invite_no,pre_userid';
|
|
|
$user = model('User')->field($userField)->where($where)->find();
|
|
|
if (empty($user)) {
|
|
|
throw new Exception('无效的邀请码');
|
|
|
}
|
|
|
+ //判断邀请码用户不能是自己的下级
|
|
|
+ if ($user['pre_userid'] == $userId) {
|
|
|
+ throw new Exception('对方已被您邀请过');
|
|
|
+ }
|
|
|
$userInviteWhere['invite_user_id'] = $userId;
|
|
|
$userInvite = model('UserInvite')->where($userInviteWhere)->find();
|
|
|
if (!empty($userInvite)) {
|
|
@@ -1131,7 +1135,9 @@ class UserCenter extends Common
|
|
|
$lastWeekNum = $userInviteModel->where($userInviteWhere)->where($appendLastWhere)->count();
|
|
|
//全部
|
|
|
$totalNum = $userInviteModel->where($userInviteWhere)->count();
|
|
|
+ $inviteMoney = config('site.invite_money');
|
|
|
$result = [
|
|
|
+ 'invite_money' => (int)$inviteMoney,
|
|
|
'invite_no' => $inviteNo,//邀请码
|
|
|
'today_money' => $todayMoney,//今日收益
|
|
|
'total_money' => $totalMoney,//总收益
|