|
|
@@ -569,23 +569,20 @@ class Auth extends BaseController
|
|
569
|
569
|
}
|
|
570
|
570
|
$uid = $user->uid;
|
|
571
|
571
|
|
|
572
|
|
- // 检查推荐人手机号是否传入
|
|
573
|
572
|
if (empty($data['spread_phone'])) {
|
|
574
|
573
|
return app('json')->fail('推荐人手机号不能为空');
|
|
575
|
574
|
}
|
|
576
|
575
|
|
|
577
|
|
- // 查找推荐人用户
|
|
578
|
576
|
$spread_user = $repository->accountByUser($data['spread_phone']);
|
|
579
|
577
|
if (!$spread_user) {
|
|
580
|
578
|
return app('json')->fail('推荐人手机号不存在');
|
|
581
|
579
|
}
|
|
582
|
580
|
|
|
583
|
|
- // 防止绑定自己为推荐人
|
|
584
|
581
|
if ($spread_user['uid'] == $uid) {
|
|
585
|
582
|
return app('json')->fail('不能绑定自己为推荐人');
|
|
586
|
583
|
}
|
|
587
|
584
|
|
|
588
|
|
- // 执行绑定
|
|
|
585
|
+
|
|
589
|
586
|
$repository->bindSpread($user, intval($spread_user['uid']));
|
|
590
|
587
|
|
|
591
|
588
|
return app('json')->success('绑定成功');
|